void GraphicsContext3DInternal::uniform1iv(GC3Dint location, GC3Dsizei size, GC3Dint* v)
{
+ /// This is a fix for WebGL conformance test (uniform-samplers-test.html)
+ // OpenGL spec doesn't define behavior for uniform() with v larger than max texture units.
+ // However, DDK returns INVALID_VALUE for uniform1i but not for uniform1iv,
+ // so added that part here.
+ static int maxTextureUnits = 0;
+ if (maxTextureUnits == 0)
+ getIntegerv(GraphicsContext3D::MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
+
+ if (*v >= maxTextureUnits) {
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
+ return;
+ }
+
makeContextCurrent();
GL_CMD(glUniform1iv(location, size, v));
}