Handle glGetIntermalformativ being missing

* Fixes a reported crash.
* This function was only core in 4.2 so it's perfectly valid for it to
  be missing - if so then we just skip using it to determine the size of
  a format and default to 8-bit colour or 32-bit depth/stencil formats.
This commit is contained in:
baldurk
2015-04-21 20:37:00 +02:00
parent 49b2cfc8f6
commit 3701b46611
+11 -2
View File
@@ -390,8 +390,17 @@ GLenum GetSizedFormat(const GLHookSet &gl, GLenum target, GLenum internalFormat)
}
GLint red, depth;
gl.glGetInternalformativ(target, internalFormat, eGL_INTERNALFORMAT_RED_SIZE, sizeof(GLint), &red);
gl.glGetInternalformativ(target, internalFormat, eGL_INTERNALFORMAT_DEPTH_SIZE, sizeof(GLint), &depth);
if(gl.glGetInternalformativ)
{
gl.glGetInternalformativ(target, internalFormat, eGL_INTERNALFORMAT_RED_SIZE, sizeof(GLint), &red);
gl.glGetInternalformativ(target, internalFormat, eGL_INTERNALFORMAT_DEPTH_SIZE, sizeof(GLint), &depth);
}
else
{
// without the query function, just default to sensible defaults
red = 8;
depth = 32;
}
switch(internalFormat)
{