Manually merged "ASTC Compression Support Added; GLExtensions improvements" from 3.6 into master
This commit is contained in:
parent
3141cea7c1
commit
60f0dd7d14
@ -549,6 +549,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
bool isTextureCompressionETC2Supported;
|
||||
bool isTextureCompressionRGTCSupported;
|
||||
bool isTextureCompressionPVRTCSupported;
|
||||
bool isTextureCompressionASTCSupported;
|
||||
bool isTextureMirroredRepeatSupported;
|
||||
bool isTextureEdgeClampSupported;
|
||||
bool isTextureBorderClampSupported;
|
||||
@ -558,6 +559,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
bool isShadowSupported;
|
||||
bool isShadowAmbientSupported;
|
||||
bool isTextureMaxLevelSupported;
|
||||
bool isTextureLODBiasSupported;
|
||||
GLint maxTextureSize;
|
||||
bool isClientStorageSupported;
|
||||
bool isTextureIntegerEXTSupported;
|
||||
|
@ -755,7 +755,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");
|
||||
|
||||
|
||||
@ -790,19 +790,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
|
||||
@ -859,13 +859,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 ||
|
||||
@ -907,18 +920,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);
|
||||
|
@ -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)
|
||||
@ -291,57 +321,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));
|
||||
@ -1794,39 +1876,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;
|
||||
@ -1870,7 +1980,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
|
||||
@ -1887,6 +1997,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;
|
||||
@ -2040,7 +2235,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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user