Merge branch 'OpenSceneGraph-3.6' into MultiView
This commit is contained in:
commit
6e728811da
@ -138,9 +138,7 @@ void getPossibleConfigs(GraphicsContext* gc, BufferConfigList& colorConfigs,
|
||||
return;
|
||||
if (ext->isMultisampleSupported)
|
||||
glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamples);
|
||||
// isMultisampleCoverageSupported
|
||||
if (isGLExtensionSupported(contextID,
|
||||
"GL_NV_framebuffer_multisample_coverage"))
|
||||
if (ext->isRenderbufferMultisampleCoverageSupported())
|
||||
{
|
||||
glGetIntegerv(GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV,
|
||||
&coverageSampleConfigs);
|
||||
|
@ -530,6 +530,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
bool isTextureCompressionETC2Supported;
|
||||
bool isTextureCompressionRGTCSupported;
|
||||
bool isTextureCompressionPVRTCSupported;
|
||||
bool isTextureCompressionASTCSupported;
|
||||
bool isTextureMirroredRepeatSupported;
|
||||
bool isTextureEdgeClampSupported;
|
||||
bool isTextureBorderClampSupported;
|
||||
@ -539,6 +540,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
bool isShadowSupported;
|
||||
bool isShadowAmbientSupported;
|
||||
bool isTextureMaxLevelSupported;
|
||||
bool isTextureLODBiasSupported;
|
||||
GLint maxTextureSize;
|
||||
bool isClientStorageSupported;
|
||||
bool isTextureIntegerEXTSupported;
|
||||
|
@ -22,9 +22,6 @@
|
||||
#include <algorithm>
|
||||
#include <string.h>
|
||||
|
||||
using namespace osg;
|
||||
using namespace std;
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#include<windows.h>
|
||||
extern "C" { OSG_EXPORT DWORD NvOptimusEnablement=0x00000001; }
|
||||
@ -32,6 +29,9 @@ extern "C" { OSG_EXPORT DWORD NvOptimusEnablement=0x00000001; }
|
||||
extern "C" { int NvOptimusEnablement=0x00000001; }
|
||||
#endif
|
||||
|
||||
using namespace osg;
|
||||
using namespace std;
|
||||
|
||||
void DisplaySettings::setNvOptimusEnablement(int value)
|
||||
{
|
||||
NvOptimusEnablement = value;
|
||||
|
@ -746,7 +746,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
isOcclusionQuerySupported = validContext && osg::isGLExtensionSupported(contextID, "GL_NV_occlusion_query");
|
||||
isARBOcclusionQuerySupported = validContext && (OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID, "GL_ARB_occlusion_query"));
|
||||
|
||||
isTimerQuerySupported = validContext && osg::isGLExtensionSupported(contextID, "GL_EXT_timer_query");
|
||||
isTimerQuerySupported = validContext && (osg::isGLExtensionSupported(contextID, "GL_EXT_timer_query") || osg::isGLExtensionSupported(contextID, "GL_EXT_disjoint_timer_query"));
|
||||
isARBTimerQuerySupported = validContext && osg::isGLExtensionSupported(contextID, "GL_ARB_timer_query");
|
||||
|
||||
|
||||
@ -781,19 +781,19 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
setGLExtensionFuncPtr(glGetOcclusionQueryiv, "glGetOcclusionQueryiv","glGetOcclusionQueryivNV", validContext);
|
||||
setGLExtensionFuncPtr(glGetOcclusionQueryuiv, "glGetOcclusionQueryuiv","glGetOcclusionQueryuivNV", validContext);
|
||||
|
||||
setGLExtensionFuncPtr(glGenQueries, "glGenQueries", "glGenQueriesARB", validContext);
|
||||
setGLExtensionFuncPtr(glDeleteQueries, "glDeleteQueries", "glDeleteQueriesARB", validContext);
|
||||
setGLExtensionFuncPtr(glIsQuery, "glIsQuery", "glIsQueryARB", validContext);
|
||||
setGLExtensionFuncPtr(glBeginQuery, "glBeginQuery", "glBeginQueryARB", validContext);
|
||||
setGLExtensionFuncPtr(glEndQuery, "glEndQuery", "glEndQueryARB", validContext);
|
||||
setGLExtensionFuncPtr(glGenQueries, "glGenQueries", "glGenQueriesARB", "glGenQueriesEXT", validContext);
|
||||
setGLExtensionFuncPtr(glDeleteQueries, "glDeleteQueries", "glDeleteQueriesARB", "glDeleteQueriesEXT", validContext);
|
||||
setGLExtensionFuncPtr(glIsQuery, "glIsQuery", "glIsQueryARB", "glIsQueryEXT", validContext);
|
||||
setGLExtensionFuncPtr(glBeginQuery, "glBeginQuery", "glBeginQueryARB", "glBeginQueryEXT", validContext);
|
||||
setGLExtensionFuncPtr(glEndQuery, "glEndQuery", "glEndQueryARB", "glEndQueryEXT", validContext);
|
||||
setGLExtensionFuncPtr(glBeginQueryIndexed, "glBeginQueryIndexed", "glBeginQueryIndexedARB", validContext);
|
||||
setGLExtensionFuncPtr(glEndQueryIndexed, "glEndQueryIndexed", "glEndQueryIndexedARB", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryiv, "glGetQueryiv", "glGetQueryivARB", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryObjectiv, "glGetQueryObjectiv","glGetQueryObjectivARB", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryObjectuiv, "glGetQueryObjectuiv","glGetQueryObjectuivARB", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryObjectui64v, "glGetQueryObjectui64v","glGetQueryObjectui64vEXT", validContext);
|
||||
setGLExtensionFuncPtr(glQueryCounter, "glQueryCounter", validContext);
|
||||
setGLExtensionFuncPtr(glGetInteger64v, "glGetInteger64v", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryiv, "glGetQueryiv", "glGetQueryivARB", "glGetQueryivEXT", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryObjectiv, "glGetQueryObjectiv","glGetQueryObjectivARB", "glGetQueryObjectivEXT", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryObjectuiv, "glGetQueryObjectuiv","glGetQueryObjectuivARB", "glGetQueryObjectuivEXT", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryObjectui64v, "glGetQueryObjectui64v","glGetQueryObjectui64vEXT", "glGetQueryObjectui64vEXT", validContext);
|
||||
setGLExtensionFuncPtr(glQueryCounter, "glQueryCounter", "glQueryCounterEXT", validContext);
|
||||
setGLExtensionFuncPtr(glGetInteger64v, "glGetInteger64v", "glGetInteger64vEXT", validContext);
|
||||
|
||||
|
||||
// SampleMaski functionality
|
||||
@ -850,13 +850,26 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
isTextureFilterAnisotropicSupported = validContext && isGLExtensionSupported(contextID,"GL_EXT_texture_filter_anisotropic");
|
||||
isTextureSwizzleSupported = validContext && isGLExtensionSupported(contextID,"GL_ARB_texture_swizzle");
|
||||
isTextureCompressionARBSupported = validContext && (builtInSupport || isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_compression", 1.3f));
|
||||
isTextureCompressionS3TCSupported = validContext && (isGLExtensionSupported(contextID,"GL_EXT_texture_compression_s3tc") || isGLExtensionSupported(contextID, "GL_S3_s3tc"));
|
||||
isTextureCompressionPVRTC2BPPSupported = validContext && isGLExtensionSupported(contextID,"GL_IMG_texture_compression_pvrtc");
|
||||
isTextureCompressionS3TCSupported = validContext && (isGLExtensionSupported(contextID,"GL_EXT_texture_compression_s3tc") ||
|
||||
isGLExtensionSupported(contextID, "GL_S3_s3tc") ||
|
||||
isGLExtensionSupported(contextID, "WEBGL_compressed_texture_s3tc") ||
|
||||
isGLExtensionSupported(contextID, "MOZ_WEBGL_compressed_texture_s3tc") ||
|
||||
isGLExtensionSupported(contextID, "WEBKIT_WEBGL_compressed_texture_s3tc") ||
|
||||
isGLExtensionSupported(contextID, "WEBGL_compressed_texture_s3tc_srgb") /* TODO: separate flag */);
|
||||
isTextureCompressionPVRTC2BPPSupported = validContext && (isGLExtensionSupported(contextID,"GL_IMG_texture_compression_pvrtc") ||
|
||||
isGLExtensionSupported(contextID, "WEBGL_compressed_texture_pvrtc"));
|
||||
isTextureCompressionPVRTC4BPPSupported = isTextureCompressionPVRTC2BPPSupported;//covered by same extension
|
||||
isTextureCompressionETCSupported = validContext && isGLExtensionSupported(contextID,"GL_OES_compressed_ETC1_RGB8_texture");
|
||||
isTextureCompressionETC2Supported = validContext && isGLExtensionSupported(contextID,"GL_ARB_ES3_compatibility");
|
||||
isTextureCompressionETCSupported = validContext && (isGLExtensionSupported(contextID, "GL_OES_compressed_ETC1_RGB8_texture") ||
|
||||
isGLExtensionSupported(contextID, "WEBGL_compressed_texture_etc1"));
|
||||
isTextureCompressionETC2Supported = validContext && (isGLExtensionSupported(contextID,"GL_ARB_ES3_compatibility") ||
|
||||
isGLExtensionSupported(contextID, "WEBGL_compressed_texture_etc"));
|
||||
isTextureCompressionRGTCSupported = validContext && isGLExtensionSupported(contextID,"GL_EXT_texture_compression_rgtc");
|
||||
isTextureCompressionPVRTCSupported = validContext && isGLExtensionSupported(contextID,"GL_IMG_texture_compression_pvrtc");
|
||||
isTextureCompressionPVRTCSupported = isTextureCompressionPVRTC2BPPSupported;//covered by same extension
|
||||
|
||||
isTextureCompressionASTCSupported = validContext && (isGLExtensionSupported(contextID, "GL_KHR_texture_compression_astc_hdr") ||
|
||||
isGLExtensionSupported(contextID, "GL_KHR_texture_compression_astc_ldr") ||
|
||||
isGLExtensionSupported(contextID, "GL_OES_texture_compression_astc") ||
|
||||
isGLExtensionSupported(contextID, "WEBGL_compressed_texture_astc"));
|
||||
|
||||
isTextureMirroredRepeatSupported = validContext &&
|
||||
(builtInSupport ||
|
||||
@ -898,18 +911,22 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
{
|
||||
maxTextureSize = osg_max_size;
|
||||
}
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
isTextureMaxLevelSupported = (glVersion >= 3.0f); // WebGL 2.0 (OpenGL ES 3.0)
|
||||
isTextureLODBiasSupported = (glVersion >= 3.0f) || isGLExtensionSupported(contextID, "GL_EXT_texture_lod_bias");
|
||||
#else
|
||||
isTextureMaxLevelSupported = (glVersion >= 1.2f);
|
||||
isTextureLODBiasSupported = (glVersion >= 1.2f) || isGLExtensionSupported(contextID, "GL_EXT_texture_lod_bias");
|
||||
#endif
|
||||
|
||||
isTextureStorageEnabled = validContext && ((glVersion >= 4.2f) || isGLExtensionSupported(contextID, "GL_ARB_texture_storage"));
|
||||
|
||||
if (isTextureStorageEnabled)
|
||||
{
|
||||
std::string value;
|
||||
if (getEnvVar("OSG_GL_TEXTURE_STORAGE", value))
|
||||
{
|
||||
if (value=="OFF" || value=="DISABLE") isTextureStorageEnabled = false;
|
||||
else isTextureStorageEnabled = true;
|
||||
}
|
||||
if (getEnvVar("OSG_GL_TEXTURE_STORAGE", value) && (value == "OFF" || value == "DISABLE"))
|
||||
isTextureStorageEnabled = false;
|
||||
}
|
||||
|
||||
setGLExtensionFuncPtr(glTexStorage1D,"glTexStorage1D","glTexStorage1DARB", validContext);
|
||||
@ -1085,7 +1102,10 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
setGLExtensionFuncPtr(glGenRenderbuffers, "glGenRenderbuffers", "glGenRenderbuffersEXT", "glGenRenderbuffersOES", validContext);
|
||||
setGLExtensionFuncPtr(glRenderbufferStorage, "glRenderbufferStorage", "glRenderbufferStorageEXT", "glRenderbufferStorageOES", validContext);
|
||||
setGLExtensionFuncPtr(glRenderbufferStorageMultisample, "glRenderbufferStorageMultisample", "glRenderbufferStorageMultisampleEXT", "glRenderbufferStorageMultisampleOES", validContext);
|
||||
setGLExtensionFuncPtr(glRenderbufferStorageMultisampleCoverageNV, "glRenderbufferStorageMultisampleCoverageNV", validContext);
|
||||
if (isGLExtensionSupported(contextID, "GL_NV_framebuffer_multisample_coverage"))
|
||||
setGLExtensionFuncPtr(glRenderbufferStorageMultisampleCoverageNV, "glRenderbufferStorageMultisampleCoverageNV", validContext);
|
||||
else
|
||||
glRenderbufferStorageMultisampleCoverageNV = NULL;
|
||||
setGLExtensionFuncPtr(glBindFramebuffer, "glBindFramebuffer", "glBindFramebufferEXT", "glBindFramebufferOES", validContext);
|
||||
setGLExtensionFuncPtr(glDeleteFramebuffers, "glDeleteFramebuffers", "glDeleteFramebuffersEXT", "glDeleteFramebuffersOES", validContext);
|
||||
setGLExtensionFuncPtr(glGenFramebuffers, "glGenFramebuffers", "glGenFramebuffersEXT", "glGenFramebuffersOES", validContext);
|
||||
|
@ -176,30 +176,60 @@ InternalPixelRelations sizedDepthAndStencilInternalFormats[] = {
|
||||
};
|
||||
|
||||
InternalPixelRelations compressedInternalFormats[] = {
|
||||
// , { GL_COMPRESSED_RED , GL_RED , GL_COMPRESSED_RED }
|
||||
// , { GL_COMPRESSED_RG , GL_RG , GL_COMPRESSED_RG }
|
||||
{ GL_COMPRESSED_RGB , GL_RGB , GL_COMPRESSED_RGB }
|
||||
, { GL_COMPRESSED_RGBA , GL_RGBA , GL_COMPRESSED_RGBA }
|
||||
, { GL_COMPRESSED_SRGB , GL_RGB , GL_COMPRESSED_SRGB }
|
||||
, { GL_COMPRESSED_SRGB_ALPHA , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA }
|
||||
, { GL_COMPRESSED_RED_RGTC1_EXT , GL_RED , GL_COMPRESSED_RED_RGTC1_EXT }
|
||||
, { GL_COMPRESSED_SIGNED_RED_RGTC1_EXT , GL_RED , GL_COMPRESSED_SIGNED_RED_RGTC1_EXT }
|
||||
// , { GL_COMPRESSED_RG_RGTC2 , GL_RG , GL_COMPRESSED_RG_RGTC2 }
|
||||
// , { GL_COMPRESSED_SIGNED_RG_RGTC2 , GL_RG , GL_COMPRESSED_SIGNED_RG_RGTC2 }
|
||||
// , { GL_COMPRESSED_RGBA_BPTC_UNORM , GL_RGBA , GL_COMPRESSED_RGBA_BPTC_UNORM }
|
||||
// , { GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM }
|
||||
// , { GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT , GL_RGB , GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT }
|
||||
// , { GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT , GL_RGB , GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT }
|
||||
// , { GL_COMPRESSED_RED , GL_RED , GL_COMPRESSED_RED }
|
||||
// , { GL_COMPRESSED_RG , GL_RG , GL_COMPRESSED_RG }
|
||||
{ GL_COMPRESSED_RGB , GL_RGB , GL_COMPRESSED_RGB }
|
||||
, { GL_COMPRESSED_RGBA , GL_RGBA , GL_COMPRESSED_RGBA }
|
||||
, { GL_COMPRESSED_SRGB , GL_RGB , GL_COMPRESSED_SRGB }
|
||||
, { GL_COMPRESSED_SRGB_ALPHA , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA }
|
||||
, { GL_COMPRESSED_RED_RGTC1_EXT , GL_RED , GL_COMPRESSED_RED_RGTC1_EXT }
|
||||
, { GL_COMPRESSED_SIGNED_RED_RGTC1_EXT , GL_RED , GL_COMPRESSED_SIGNED_RED_RGTC1_EXT }
|
||||
// , { GL_COMPRESSED_RG_RGTC2 , GL_RG , GL_COMPRESSED_RG_RGTC2 }
|
||||
// , { GL_COMPRESSED_SIGNED_RG_RGTC2 , GL_RG , GL_COMPRESSED_SIGNED_RG_RGTC2 }
|
||||
// , { GL_COMPRESSED_RGBA_BPTC_UNORM , GL_RGBA , GL_COMPRESSED_RGBA_BPTC_UNORM }
|
||||
// , { GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM }
|
||||
// , { GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT , GL_RGB , GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT }
|
||||
// , { GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT , GL_RGB , GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT }
|
||||
|
||||
, { GL_COMPRESSED_RGB_S3TC_DXT1_EXT , GL_RGB , GL_COMPRESSED_RGB_S3TC_DXT1_EXT }
|
||||
, { GL_COMPRESSED_RGBA_S3TC_DXT1_EXT , GL_RGBA , GL_COMPRESSED_RGBA_S3TC_DXT1_EXT }
|
||||
, { GL_COMPRESSED_RGBA_S3TC_DXT3_EXT , GL_RGBA , GL_COMPRESSED_RGBA_S3TC_DXT3_EXT }
|
||||
, { GL_COMPRESSED_RGBA_S3TC_DXT5_EXT , GL_RGBA , GL_COMPRESSED_RGBA_S3TC_DXT5_EXT }
|
||||
, { GL_COMPRESSED_RGB_S3TC_DXT1_EXT , GL_RGB , GL_COMPRESSED_RGB_S3TC_DXT1_EXT }
|
||||
, { GL_COMPRESSED_RGBA_S3TC_DXT1_EXT , GL_RGBA , GL_COMPRESSED_RGBA_S3TC_DXT1_EXT }
|
||||
, { GL_COMPRESSED_RGBA_S3TC_DXT3_EXT , GL_RGBA , GL_COMPRESSED_RGBA_S3TC_DXT3_EXT }
|
||||
, { GL_COMPRESSED_RGBA_S3TC_DXT5_EXT , GL_RGBA , GL_COMPRESSED_RGBA_S3TC_DXT5_EXT }
|
||||
|
||||
, { GL_COMPRESSED_SRGB_S3TC_DXT1_EXT , GL_RGB , GL_COMPRESSED_SRGB_S3TC_DXT1_EXT }
|
||||
, { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT }
|
||||
, { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT }
|
||||
, { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT }
|
||||
, { GL_COMPRESSED_SRGB_S3TC_DXT1_EXT , GL_RGB , GL_COMPRESSED_SRGB_S3TC_DXT1_EXT }
|
||||
, { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT }
|
||||
, { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT }
|
||||
, { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT }
|
||||
|
||||
, { GL_COMPRESSED_RGBA_ASTC_4x4_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_4x4_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_5x4_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_5x4_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_5x5_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_5x5_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_6x5_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_6x5_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_6x6_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_6x6_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_8x5_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_8x5_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_8x6_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_8x6_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_8x8_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_8x8_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_10x5_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_10x5_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_10x6_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_10x6_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_10x8_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_10x8_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_10x10_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_10x10_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_12x10_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_12x10_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_12x12_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_12x12_KHR }
|
||||
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR }
|
||||
};
|
||||
|
||||
bool isSizedInternalFormat(GLint internalFormat)
|
||||
@ -289,57 +319,109 @@ void Texture::TextureProfile::computeSize()
|
||||
|
||||
switch(_internalFormat)
|
||||
{
|
||||
case(1): numBitsPerTexel = 8; break;
|
||||
case(GL_ALPHA): numBitsPerTexel = 8; break;
|
||||
case(GL_LUMINANCE): numBitsPerTexel = 8; break;
|
||||
case(GL_INTENSITY): numBitsPerTexel = 8; break;
|
||||
case 1:
|
||||
case GL_ALPHA:
|
||||
case GL_LUMINANCE:
|
||||
case GL_INTENSITY:
|
||||
case GL_RED:
|
||||
numBitsPerTexel = 8;
|
||||
break;
|
||||
|
||||
case(GL_LUMINANCE_ALPHA): numBitsPerTexel = 16; break;
|
||||
case(2): numBitsPerTexel = 16; break;
|
||||
case 2:
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
case GL_RG:
|
||||
numBitsPerTexel = 16;
|
||||
break;
|
||||
|
||||
case(GL_RGB): numBitsPerTexel = 24; break;
|
||||
case(GL_BGR): numBitsPerTexel = 24; break;
|
||||
case(3): numBitsPerTexel = 24; break;
|
||||
case 3:
|
||||
case GL_RGB:
|
||||
case GL_BGR:
|
||||
numBitsPerTexel = 24;
|
||||
break;
|
||||
|
||||
case(GL_RGBA): numBitsPerTexel = 32; break;
|
||||
case(4): numBitsPerTexel = 32; break;
|
||||
case 4:
|
||||
case GL_RGBA:
|
||||
case GL_BGRA:
|
||||
numBitsPerTexel = 32;
|
||||
break;
|
||||
|
||||
case(GL_COMPRESSED_ALPHA_ARB): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_INTENSITY_ARB): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_LUMINANCE_ALPHA_ARB): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_ALPHA_ARB: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_INTENSITY_ARB: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: numBitsPerTexel = 4; break;
|
||||
|
||||
case(GL_COMPRESSED_RGB_ARB): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT): numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_RGB_ARB: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: numBitsPerTexel = 8; break;
|
||||
|
||||
case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_RED_RGTC1_EXT): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_RED_GREEN_RGTC2_EXT): numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_RED_RGTC1_EXT: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_RED_GREEN_RGTC2_EXT: numBitsPerTexel = 8; break;
|
||||
|
||||
case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG): numBitsPerTexel = 2; break;
|
||||
case(GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG): numBitsPerTexel = 2; break;
|
||||
case(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG): numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: numBitsPerTexel = 2; break;
|
||||
case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: numBitsPerTexel = 2; break;
|
||||
case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: numBitsPerTexel = 4; break;
|
||||
|
||||
case(GL_ETC1_RGB8_OES): numBitsPerTexel = 4; break;
|
||||
case GL_ETC1_RGB8_OES: numBitsPerTexel = 4; break;
|
||||
|
||||
case(GL_COMPRESSED_RGB8_ETC2): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_SRGB8_ETC2): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_RGBA8_ETC2_EAC): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_R11_EAC): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_SIGNED_R11_EAC): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_RG11_EAC): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_SIGNED_RG11_EAC): numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_RGB8_ETC2: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_SRGB8_ETC2: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_RGBA8_ETC2_EAC: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_R11_EAC: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_SIGNED_R11_EAC: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_RG11_EAC: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_SIGNED_RG11_EAC: numBitsPerTexel = 8; break;
|
||||
|
||||
// ASTC
|
||||
case GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_5x4_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_5x5_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_6x5_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_6x6_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_8x5_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_8x6_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_8x8_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_10x5_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_10x6_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_10x8_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_10x10_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_12x12_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
|
||||
{
|
||||
_size = 0;
|
||||
for (int i = 0; i < std::max(_numMipmapLevels, 1); ++i)
|
||||
{
|
||||
GLint blockSize;
|
||||
GLint size;
|
||||
getCompressedSize(_internalFormat, _width/(1 << i), _height/(1 << i), _depth, blockSize, size);
|
||||
_size += size;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_size = (unsigned int)(ceil(double(_width * _height * _depth * numBitsPerTexel)/8.0));
|
||||
@ -1786,39 +1868,67 @@ bool Texture::isCompressedInternalFormat() const
|
||||
|
||||
bool Texture::isCompressedInternalFormat(GLint internalFormat)
|
||||
{
|
||||
switch(internalFormat)
|
||||
switch (internalFormat)
|
||||
{
|
||||
case(GL_COMPRESSED_ALPHA_ARB):
|
||||
case(GL_COMPRESSED_INTENSITY_ARB):
|
||||
case(GL_COMPRESSED_LUMINANCE_ALPHA_ARB):
|
||||
case(GL_COMPRESSED_LUMINANCE_ARB):
|
||||
case(GL_COMPRESSED_RGBA_ARB):
|
||||
case(GL_COMPRESSED_RGB_ARB):
|
||||
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT):
|
||||
case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT):
|
||||
case(GL_COMPRESSED_RED_RGTC1_EXT):
|
||||
case(GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT):
|
||||
case(GL_COMPRESSED_RED_GREEN_RGTC2_EXT):
|
||||
case(GL_ETC1_RGB8_OES):
|
||||
case(GL_COMPRESSED_RGB8_ETC2):
|
||||
case(GL_COMPRESSED_SRGB8_ETC2):
|
||||
case(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2):
|
||||
case(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2):
|
||||
case(GL_COMPRESSED_RGBA8_ETC2_EAC):
|
||||
case(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC):
|
||||
case(GL_COMPRESSED_R11_EAC):
|
||||
case(GL_COMPRESSED_SIGNED_R11_EAC):
|
||||
case(GL_COMPRESSED_RG11_EAC):
|
||||
case(GL_COMPRESSED_SIGNED_RG11_EAC):
|
||||
case(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG):
|
||||
case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG):
|
||||
case(GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG):
|
||||
case(GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG):
|
||||
case (GL_COMPRESSED_ALPHA_ARB):
|
||||
case (GL_COMPRESSED_INTENSITY_ARB):
|
||||
case (GL_COMPRESSED_LUMINANCE_ALPHA_ARB):
|
||||
case (GL_COMPRESSED_LUMINANCE_ARB):
|
||||
case (GL_COMPRESSED_RGBA_ARB):
|
||||
case (GL_COMPRESSED_RGB_ARB):
|
||||
case (GL_COMPRESSED_RGB_S3TC_DXT1_EXT):
|
||||
case (GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
|
||||
case (GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
|
||||
case (GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT):
|
||||
case (GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
|
||||
case (GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT):
|
||||
case (GL_COMPRESSED_SIGNED_RED_RGTC1_EXT):
|
||||
case (GL_COMPRESSED_RED_RGTC1_EXT):
|
||||
case (GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT):
|
||||
case (GL_COMPRESSED_RED_GREEN_RGTC2_EXT):
|
||||
case (GL_ETC1_RGB8_OES):
|
||||
case (GL_COMPRESSED_RGB8_ETC2):
|
||||
case (GL_COMPRESSED_SRGB8_ETC2):
|
||||
case (GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2):
|
||||
case (GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2):
|
||||
case (GL_COMPRESSED_RGBA8_ETC2_EAC):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC):
|
||||
case (GL_COMPRESSED_R11_EAC):
|
||||
case (GL_COMPRESSED_SIGNED_R11_EAC):
|
||||
case (GL_COMPRESSED_RG11_EAC):
|
||||
case (GL_COMPRESSED_SIGNED_RG11_EAC):
|
||||
case (GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG):
|
||||
case (GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG):
|
||||
case (GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG):
|
||||
case (GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_4x4_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_5x4_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_5x5_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_6x5_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_6x6_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_8x5_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_8x6_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_8x8_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_10x5_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_10x6_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_10x8_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_10x10_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_12x10_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_12x12_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -1862,7 +1972,7 @@ void Texture::getCompressedSize(GLenum internalFormat, GLint width, GLint height
|
||||
|
||||
size = widthBlocks * heightBlocks * ((blockSize * bpp) / 8);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG || internalFormat == GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG)
|
||||
{
|
||||
blockSize = 4 * 4; // Pixel by pixel block size for 4bpp
|
||||
@ -1879,6 +1989,91 @@ void Texture::getCompressedSize(GLenum internalFormat, GLint width, GLint height
|
||||
size = widthBlocks * heightBlocks * ((blockSize * bpp) / 8);
|
||||
return;
|
||||
}
|
||||
// ASTC compression (block size is always equal to 16)
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_4x4_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/4.0)*ceil(height/4.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_5x4_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/5.0)*ceil(height/4.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_5x5_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/5.0)*ceil(height/5.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_6x5_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/6.0)*ceil(height/5.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_6x6_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/6.0)*ceil(height/6.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_8x5_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/8.0)*ceil(height/5.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_8x6_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/8.0)*ceil(height/6.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_8x8_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/8.0)*ceil(height/8.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_10x5_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/10.0)*ceil(height/5.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_10x6_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/10.0)*ceil(height/6.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_10x8_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/10.0)*ceil(height/8.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_10x10_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/10.0)*ceil(height/10.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_12x10_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/12.0)*ceil(height/10.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_12x12_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/12.0)*ceil(height/12.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_WARN<<"Texture::getCompressedSize(...) : cannot compute correct size of compressed format ("<<internalFormat<<") returning 0."<<std::endl;
|
||||
@ -2032,7 +2227,8 @@ void Texture::applyTexParameters(GLenum target, State& state) const
|
||||
glTexParameterf(target, GL_TEXTURE_MAX_LOD, _maxlod);
|
||||
}
|
||||
|
||||
glTexParameterf(target, GL_TEXTURE_LOD_BIAS, _lodbias);
|
||||
if (extensions->isTextureLODBiasSupported)
|
||||
glTexParameterf(target, GL_TEXTURE_LOD_BIAS, _lodbias);
|
||||
|
||||
getTextureParameterDirty(state.getContextID()) = false;
|
||||
|
||||
|
@ -235,7 +235,6 @@
|
||||
#include "CameraConfig.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace osgProducer;
|
||||
|
||||
static void ConfigParser_error( const char * );
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include <Producer/CameraConfig>
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace Producer;
|
||||
|
||||
static void ConfigParser_error( const char * );
|
||||
|
@ -15,6 +15,7 @@ class ReaderWriterFreeType : public osgDB::ReaderWriter
|
||||
supportsExtension("pfb","type1 binary format");
|
||||
supportsExtension("pfa","type2 ascii format");
|
||||
supportsExtension("cid","Postscript CID-Fonts format");
|
||||
supportsExtension("otf","OpenType format");
|
||||
supportsExtension("cff","OpenType format");
|
||||
supportsExtension("cef","OpenType format");
|
||||
supportsExtension("fon","Windows bitmap fonts format");
|
||||
|
Loading…
Reference in New Issue
Block a user