[WebGL] Correct symbol lookup logic to handle 1-element arrays
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jan 2014 02:11:58 +0000 (02:11 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jan 2014 02:11:58 +0000 (02:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=126411
<rdar://problem/15394564>

Reviewed by Dean Jackson.

Source/WebCore:

Tested by revisions to webgl/1.0.2/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html

* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::getUniformLocation): Revise to
handle access to zeroeth element of the array.

LayoutTests:

* webgl/1.0.2/resources/webgl_test_files/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html: Add test for accessing the
single-element array.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161247 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/WebGLRenderingContext.cpp

index 7eaedee..054dd6e 100644 (file)
@@ -1,3 +1,14 @@
+2014-01-02  Brent Fulgham  <bfulgham@apple.com>
+
+        [WebGL] Correct symbol lookup logic to handle 1-element arrays
+        https://bugs.webkit.org/show_bug.cgi?id=126411
+        <rdar://problem/15394564>
+
+        Reviewed by Dean Jackson.
+
+        * webgl/1.0.2/resources/webgl_test_files/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html: Add test for accessing the
+        single-element array.
+
 2014-01-02  Jinwoo Song  <jinwoo7.song@samsung.com>
 
         Unreviewed EFL gardening. Rebaselining after r161140.
index 7525417..a390933 100644 (file)
@@ -109,6 +109,8 @@ for (var ii = 0; ii < 2; ++ii) {
 
 var program = wtu.setupProgram(gl, ["vshader", "fshader-with-one-element-arrays"], ["a_position"]);
 var green_loc = gl.getUniformLocation(program, "u_colors[0].color[0]");
+var zeroth_color = gl.getUniformLocation(program, "u_colors[0].color");
+shouldBeTrue("zeroth_color != undefined");
 gl.uniform4fv(green_loc, [0, 1, 0, 1]);
 wtu.clearAndDrawUnitQuad(gl);
 wtu.checkCanvas(gl, [0, 255, 0, 255], "Should be green");
index f49964b..9494429 100644 (file)
@@ -1,3 +1,17 @@
+2014-01-02  Brent Fulgham  <bfulgham@apple.com>
+
+        [WebGL] Correct symbol lookup logic to handle 1-element arrays
+        https://bugs.webkit.org/show_bug.cgi?id=126411
+        <rdar://problem/15394564>
+
+        Reviewed by Dean Jackson.
+
+        Tested by revisions to webgl/1.0.2/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::getUniformLocation): Revise to
+        handle access to zeroeth element of the array.
+
 2014-01-02  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Crash in WebCore::translateIntersectionPointsToSkipInkBoundaries
index f675076..ab57c3a 100644 (file)
@@ -3174,16 +3174,11 @@ PassRefPtr<WebGLUniformLocation> WebGLRenderingContext::getUniformLocation(WebGL
             info.name = info.name.left(info.name.length() - 3);
         // If it's an array, we need to iterate through each element, appending "[index]" to the name.
         for (GC3Dint index = 0; index < info.size; ++index) {
-            if (info.size > 1) {
-                String arrayBrackets = "[" + String::number(index) + "]";
-                String uniformName = info.name + arrayBrackets;
+            String arrayBrackets = "[" + String::number(index) + "]";
+            String uniformName = info.name + arrayBrackets;
 
-                if (name == uniformName || name == info.name)
-                    return WebGLUniformLocation::create(program, uniformLocation, info.type);
-            } else {
-                if (name == info.name)
-                    return WebGLUniformLocation::create(program, uniformLocation, info.type);
-            }
+            if (name == uniformName || name == info.name)
+                return WebGLUniformLocation::create(program, uniformLocation, info.type);
         }
     }
     return 0;