RESOLVED FIXED 126411
[WebGL] Correct symbol lookup logic to handle 1-element arrays
https://bugs.webkit.org/show_bug.cgi?id=126411
Summary [WebGL] Correct symbol lookup logic to handle 1-element arrays
Brent Fulgham
Reported 2014-01-02 16:27:54 PST
The optimization made in Bug 122607 introduced a bug when dealing with array types. As documented in the ANGLEWebKitBridge.cpp file, ANGLE identifies arrays by affixing "[0]" to the name. The new logic incorrectly assumed arrays would always have sizes > 1, and deleted the "[0]" characters at the end of the name. However, there are a number of cases where single-element arrays are used, and the new logic prevented WebKit from finding them in its symbol store. The attached patch corrects the problem so that the following three.js examples work properly: http://threejs.org/examples/#webgl_lights_hemisphere http://threejs.org/examples/#webgl_materials2
Attachments
Patch (2.56 KB, patch)
2014-01-02 16:30 PST, Brent Fulgham
no flags
Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2 (461.04 KB, application/zip)
2014-01-02 17:28 PST, Build Bot
no flags
Patch (2.11 KB, patch)
2014-01-02 17:33 PST, Brent Fulgham
no flags
Patch (with Test Case) (3.92 KB, patch)
2014-01-02 17:49 PST, Brent Fulgham
no flags
Patch (1.65 KB, patch)
2014-01-06 15:16 PST, Brent Fulgham
dino: review+
Brent Fulgham
Comment 1 2014-01-02 16:28:01 PST
Brent Fulgham
Comment 2 2014-01-02 16:30:15 PST
WebKit Commit Bot
Comment 3 2014-01-02 16:32:04 PST
Attachment 220266 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/html/canvas/WebGLRenderingContext.cpp', '--commit-queue']" exit_code: 1 ERROR: Source/WebCore/ChangeLog:9: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Dean Jackson
Comment 4 2014-01-02 16:43:04 PST
Comment on attachment 220266 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=220266&action=review > Source/WebCore/html/canvas/WebGLRenderingContext.cpp:3179 > + String arrayBrackets = "[" + String::number(index) + "]"; > + String uniformName = info.name + arrayBrackets; I guess we could do this in one line, although I always forget the optimisation rules for string building.
Roger Fong
Comment 5 2014-01-02 17:12:44 PST
I think this'll fail if we have a size 1 array, say soo int foo[1] or something, but then try to getUniformLocation of foo[0].
Brent Fulgham
Comment 6 2014-01-02 17:14:45 PST
Brent Fulgham
Comment 7 2014-01-02 17:24:47 PST
Roger pointed out that we might do the wrong thing now if we try to access the zeroeth element of an array, because we always strip off the "[0]" bracket and only test for "[x]" when we have an array size greater than 1.
Build Bot
Comment 8 2014-01-02 17:28:29 PST
Comment on attachment 220266 [details] Patch Attachment 220266 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/4513015000989696 New failing tests: webgl/1.0.2/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html webgl/1.0.2/conformance/glsl/misc/shader-with-similar-uniform-array-names.html
Build Bot
Comment 9 2014-01-02 17:28:31 PST
Created attachment 220270 [details] Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-16 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Brent Fulgham
Comment 10 2014-01-02 17:33:41 PST
Brent Fulgham
Comment 11 2014-01-02 17:34:53 PST
(In reply to comment #8) > (From update of attachment 220266 [details]) > Attachment 220266 [details] did not pass mac-wk2-ews (mac-wk2): > Output: http://webkit-queues.appspot.com/results/4513015000989696 > > New failing tests: > webgl/1.0.2/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html > webgl/1.0.2/conformance/glsl/misc/shader-with-similar-uniform-array-names.html This may have been caused by the 0-th element case Roger pointed out.
Brent Fulgham
Comment 12 2014-01-02 17:49:08 PST
Created attachment 220274 [details] Patch (with Test Case)
Brent Fulgham
Comment 13 2014-01-02 18:08:13 PST
Darin Adler
Comment 14 2014-01-06 11:57:55 PST
Comment on attachment 220266 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=220266&action=review >> Source/WebCore/html/canvas/WebGLRenderingContext.cpp:3179 >> + String arrayBrackets = "[" + String::number(index) + "]"; >> + String uniformName = info.name + arrayBrackets; > > I guess we could do this in one line, although I always forget the optimisation rules for string building. This needs to be done in one line. It will do less memory allocation. String uniformName = info.name + "[" + String::number(index) + "]";
Brent Fulgham
Comment 15 2014-01-06 15:12:10 PST
Reopen to incorporate Darin's suggestion.
Brent Fulgham
Comment 16 2014-01-06 15:16:18 PST
Brent Fulgham
Comment 17 2014-01-06 15:19:36 PST
Note You need to log in before you can comment on or make changes to this bug.