Fixed crash when decompressing DDS texture.

This commit is contained in:
bkaradzic
2013-07-13 23:11:02 -07:00
parent 1e458f4332
commit d30a5240d7
2 changed files with 25 additions and 29 deletions

View File

@@ -1380,6 +1380,7 @@ namespace bgfx
{
uint8_t textureFormat = dds.m_type;
bool decompress = TextureFormat::Unknown > textureFormat;
uint32_t bpp = tfi.m_bpp;
if (decompress)
{
@@ -1388,6 +1389,7 @@ namespace bgfx
internalFmt = tfi.m_internalFmt;
m_fmt = tfi.m_fmt;
m_type = tfi.m_type;
bpp = tfi.m_bpp;
}
bool swizzle = GL_RGBA == m_fmt;
@@ -1402,7 +1404,7 @@ namespace bgfx
}
#endif // BGFX_CONFIG_RENDERER_OPENGL
uint8_t* bits = (uint8_t*)g_realloc(NULL, dds.m_width*dds.m_height*tfi.m_bpp/8);
uint8_t* bits = (uint8_t*)g_realloc(NULL, dds.m_width*dds.m_height*bpp/8);
for (uint8_t side = 0, numSides = dds.m_cubeMap ? 6 : 1; side < numSides; ++side)
{