Bug 631643 - Check for ARB_ES2_compatibility before using it, fix MAX_VARYING_VECTORS emulation, clean up getParameters - r=vlad, a=jrmuizel

This commit is contained in:
Benoit Jacob
2011-02-11 18:11:30 -05:00
parent f65822eee6
commit 7f5f157af1
4 changed files with 32 additions and 22 deletions

View File

@@ -440,7 +440,7 @@ WebGLContext::InitAndValidateGL()
gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS, (GLint*) &mGLMaxTextureImageUnits);
gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, (GLint*) &mGLMaxVertexTextureImageUnits);
if (gl->IsGLES2()) {
if (gl->HasES2Compatibility()) {
gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS, (GLint*) &mGLMaxFragmentUniformVectors);
gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS, (GLint*) &mGLMaxVertexUniformVectors);
gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_VECTORS, (GLint*) &mGLMaxVaryingVectors);
@@ -449,8 +449,13 @@ WebGLContext::InitAndValidateGL()
mGLMaxFragmentUniformVectors /= 4;
gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS, (GLint*) &mGLMaxVertexUniformVectors);
mGLMaxVertexUniformVectors /= 4;
gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_FLOATS, (GLint*) &mGLMaxVaryingVectors);
mGLMaxVaryingVectors /= 4;
// The formula below comes from the public_webgl list, "problematic GetParameter pnames" thread
GLint maxVertexOutputComponents = 0,
maxFragmentInputComponents = 0;
gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_OUTPUT_COMPONENTS, &maxVertexOutputComponents);
gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_INPUT_COMPONENTS, &maxFragmentInputComponents);
mGLMaxVaryingVectors = PR_MIN(maxVertexOutputComponents, maxFragmentInputComponents) / 4;
}
#if 0