opengles emulator: limit GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS

A bug in the ATI OpenGL driver causes glGet(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS)
to return 32, although the driver supports only 16. The minimum required
by the spec is 2, so limit the number to 16.

Change-Id: Ife99dc5544f80ad872362414e9a5d9d2722d8a42
This commit is contained in:
Yochai Shefi Simchon
2011-07-26 13:00:31 +03:00
committed by David 'Digit' Turner
parent 0652403155
commit a182a1a7e4
2 changed files with 20 additions and 0 deletions

View File

@@ -902,6 +902,16 @@ GL_API void GL_APIENTRY glGetIntegerv( GLenum pname, GLint *params) {
ctx->dispatcher().glGetFloatv(pname,&f);
*params = (int)(f * (float)0x7fffffff);
break;
case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
ctx->dispatcher().glGetIntegerv(pname,params);
if(*params > 16)
{
// GLES spec requires only 2, and the ATI driver erronously
// returns 32 (although it supports only 16). This WAR is simple,
// compliant and good enough for developers.
*params = 16;
}
break;
default:
ctx->dispatcher().glGetIntegerv(pname,params);

View File

@@ -899,6 +899,16 @@ GL_APICALL void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* params){
*params = 16;
break;
case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
ctx->dispatcher().glGetIntegerv(pname,params);
if(*params > 16)
{
// GLES spec requires only 2, and the ATI driver erronously
// returns 32 (although it supports only 16). This WAR is simple,
// compliant and good enough for developers.
*params = 16;
}
break;
default:
ctx->dispatcher().glGetIntegerv(pname,params);
}