Fixed NaCl crash.

This commit is contained in:
Branimir Karadžić 2014-04-10 19:21:10 -07:00
parent ea34b9476c
commit aadd9bd1c1

View file

@ -670,13 +670,16 @@ namespace bgfx
const TextureFormatInfo& tfi = s_textureFormat[_format]; const TextureFormatInfo& tfi = s_textureFormat[_format];
GLsizei size = (16*16*getBitsPerPixel(_format) )/8;
void* data = alloca(size);
if (isCompressed(_format) ) if (isCompressed(_format) )
{ {
glCompressedTexImage2D(GL_TEXTURE_2D, 0, tfi.m_internalFmt, 16, 16, 0, (16*16*getBitsPerPixel(_format) )/8, NULL); glCompressedTexImage2D(GL_TEXTURE_2D, 0, tfi.m_internalFmt, 16, 16, 0, size, data);
} }
else else
{ {
glTexImage2D(GL_TEXTURE_2D, 0, tfi.m_internalFmt, 16, 16, 0, tfi.m_fmt, tfi.m_type, NULL); glTexImage2D(GL_TEXTURE_2D, 0, tfi.m_internalFmt, 16, 16, 0, tfi.m_fmt, tfi.m_type, data);
} }
GLenum err = glGetError(); GLenum err = glGetError();