@@ -1995,85 +1995,85 @@ void Texture::getCompressedSize(GLenum internalFormat, GLint width, GLint height
19951995 else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_4x4_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR)
19961996 {
19971997 blockSize = 16 ;
1998- size = ceil ( width/ 4.0 )* ceil ( height/ 4.0 ) *blockSize;
1998+ size = (( width+ 3 )/ 4 )*(( height+ 3 )/ 4 )*depth *blockSize;
19991999 return ;
20002000 }
20012001 else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_5x4_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR)
20022002 {
20032003 blockSize = 16 ;
2004- size = ceil ( width/ 5.0 )* ceil ( height/ 4.0 ) *blockSize;
2004+ size = (( width+ 4 )/ 5 )*(( height+ 3 )/ 4 )*depth *blockSize;
20052005 return ;
20062006 }
20072007 else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_5x5_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR)
20082008 {
20092009 blockSize = 16 ;
2010- size = ceil ( width/ 5.0 )* ceil ( height/ 5.0 ) *blockSize;
2010+ size = (( width+ 4 )/ 5 )*(( height+ 4 )/ 5 )*depth *blockSize;
20112011 return ;
20122012 }
20132013 else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_6x5_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR)
20142014 {
20152015 blockSize = 16 ;
2016- size = ceil ( width/ 6.0 )* ceil ( height/ 5.0 ) *blockSize;
2016+ size = (( width+ 5 )/ 6 )*(( height+ 4 )/ 5 )*depth *blockSize;
20172017 return ;
20182018 }
20192019 else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_6x6_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR)
20202020 {
20212021 blockSize = 16 ;
2022- size = ceil ( width/ 6.0 )* ceil ( height/ 6.0 ) *blockSize;
2022+ size = (( width+ 5 )/ 6 )*(( height+ 5 )/ 6 )*depth *blockSize;
20232023 return ;
20242024 }
20252025 else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_8x5_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR)
20262026 {
20272027 blockSize = 16 ;
2028- size = ceil ( width/ 8.0 )* ceil ( height/ 5.0 ) *blockSize;
2028+ size = (( width+ 7 )/ 8 )*(( height+ 4 )/ 5 )*depth *blockSize;
20292029 return ;
20302030 }
20312031 else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_8x6_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR)
20322032 {
20332033 blockSize = 16 ;
2034- size = ceil ( width/ 8.0 )* ceil ( height/ 6.0 ) *blockSize;
2034+ size = (( width+ 7 )/ 8 )*(( height+ 5 )/ 6 )*depth *blockSize;
20352035 return ;
20362036 }
20372037 else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_8x8_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR)
20382038 {
20392039 blockSize = 16 ;
2040- size = ceil ( width/ 8.0 )* ceil ( height/ 8.0 ) *blockSize;
2040+ size = (( width+ 7 )/ 8 )*(( height+ 7 )/ 8 )*depth *blockSize;
20412041 return ;
20422042 }
20432043 else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_10x5_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR)
20442044 {
20452045 blockSize = 16 ;
2046- size = ceil ( width/10.0 )* ceil ( height/ 5.0 ) *blockSize;
2046+ size = (( width+ 9 ) /10 )*(( height+ 4 )/ 5 )*depth *blockSize;
20472047 return ;
20482048 }
20492049 else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_10x6_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR)
20502050 {
20512051 blockSize = 16 ;
2052- size = ceil ( width/10.0 )* ceil ( height/ 6.0 ) *blockSize;
2052+ size = (( width+ 9 ) /10 )*(( height+ 5 )/ 6 )*depth *blockSize;
20532053 return ;
20542054 }
20552055 else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_10x8_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR)
20562056 {
20572057 blockSize = 16 ;
2058- size = ceil ( width/10.0 )* ceil ( height/ 8.0 ) *blockSize;
2058+ size = (( width+ 9 ) /10 )*(( height+ 7 )/ 8 )*depth *blockSize;
20592059 return ;
20602060 }
20612061 else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_10x10_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR)
20622062 {
20632063 blockSize = 16 ;
2064- size = ceil ( width/10.0 )* ceil ( height/10.0 ) *blockSize;
2064+ size = (( width+ 9 ) /10 )*(( height+ 9 ) /10 )*depth *blockSize;
20652065 return ;
20662066 }
20672067 else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_12x10_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR)
20682068 {
20692069 blockSize = 16 ;
2070- size = ceil ( width/12.0 )* ceil ( height/10.0 ) *blockSize;
2070+ size = (( width+ 11 ) /12 )*(( height+ 9 ) /10 )*depth *blockSize;
20712071 return ;
20722072 }
20732073 else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_12x12_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR)
20742074 {
20752075 blockSize = 16 ;
2076- size = ceil ( width/12.0 )* ceil ( height/12.0 ) *blockSize;
2076+ size = (( width+ 11 ) /12 )*(( height+ 11 ) /12 )*depth *blockSize;
20772077 return ;
20782078 }
20792079 else
0 commit comments