Generate error when uniform1iv is called with invalid texture units.
authorHeejin Chung <heejin.r.chung@samsung.com>
Thu, 9 May 2013 01:16:58 +0000 (10:16 +0900)
committerGerrit Code Review <gerrit2@kim11>
Thu, 9 May 2013 09:45:31 +0000 (18:45 +0900)
[Title] Generate error when uniform1iv is called with invalid texture units
[Issue#] TWEB-1129
[Problem] No error is returned when uniform1iv is called with invalid texture units
[Cause] DDK doesn't generate error.
[Solution] Synthesize INVALID_VALUE error when uniform1iv is called with invalud texture units

Change-Id: Iba63a92bdd68619c44fb08b88dbb670b9bdf13a4

Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DInternal.cpp

index 0cdd8c4..d242512 100755 (executable)
@@ -957,6 +957,19 @@ void GraphicsContext3DInternal::uniform1i(GC3Dint location, GC3Dint x)
 
 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));
 }