Bug 99854 - [WebGL] getUniformLocation fails for uniform array name without array brackets
Summary: [WebGL] getUniformLocation fails for uniform array name without array brackets
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Max Vujovic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-19 10:51 PDT by Max Vujovic
Modified: 2012-10-19 15:54 PDT (History)
4 users (show)

See Also:


Attachments
Patch (4.83 KB, patch)
2012-10-19 10:57 PDT, Max Vujovic
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Max Vujovic 2012-10-19 10:51:40 PDT
For example:

Given the GLSL:
uniform float array[10];

In JS, the following fails:
gl.getUniformLocation(program, "array");

The following succeeds:
gl.getUniformLocation(program, "array[0]");
gl.getUniformLocation(program, "array[1]");
...
gl.getUniformLocation(program, "array[9]");

According to the glGetUniformLocation man page [1], the former should succeed:
"""
Except if the last part of name indicates a uniform variable array, the location of the first element of an array can be retrieved by using the name of the array, or by using the name appended by "[0]".
"""

[1]: http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetUniformLocation.xml
Comment 1 Max Vujovic 2012-10-19 10:57:07 PDT
Created attachment 169650 [details]
Patch

For this patch's test, I've made to following change to Khronos WebGL conformance test suite: https://github.com/KhronosGroup/WebGL/commit/6451bfd138b2f603b667cbf7839885f665607c7a

Do we need a WebKit test for this or is the WebGL conformance test sufficient?
Comment 2 Roger Fong 2012-10-19 14:09:27 PDT
Hmm based on this patch it looks like just using the array name with no subscripts was probably broken before I landed r131105. Sorry I missed that :/ but at least I didn't break it! woo?

Also I think that the single size array does work properly, if it's size 1 then it'll just hit the 'else' path which behaves properly (although that probably wasn't the clearest way of doing things...). 

Hmm, o wait, I guess that in order to fix the first problem, the distinction between 'array' and 'not array' has to be made regardless.

Anyways, looks good to me, although I don't have review so we'll have to wait for dino.

Also hi!
Comment 3 Roger Fong 2012-10-19 14:10:25 PDT
(In reply to comment #1)
> Do we need a WebKit test for this or is the WebGL conformance test sufficient?

I wanna say just the conformance test, but Dean will know better.
Comment 4 Max Vujovic 2012-10-19 14:34:49 PDT
(In reply to comment #2)
> Hmm based on this patch it looks like just using the array name with no subscripts was probably broken before I landed r131105. Sorry I missed that :/ but at least I didn't break it! woo?

No worries- this was broken before you touched it :)

> 
> Also I think that the single size array does work properly, if it's size 1 then it'll just hit the 'else' path which behaves properly (although that probably wasn't the clearest way of doing things...). 

Yup, that worked properly before. I think it's just more explicit now.

> 
> Hmm, o wait, I guess that in order to fix the first problem, the distinction between 'array' and 'not array' has to be made regardless.
> 
> Anyways, looks good to me, although I don't have review so we'll have to wait for dino.

Thanks for looking over it. I'll ask Dino for a review.

> 
> Also hi!

Hi! Nice to see you working on WebKit :)

(In reply to comment #3)
> (In reply to comment #1)
> > Do we need a WebKit test for this or is the WebGL conformance test sufficient?
> 
> I wanna say just the conformance test, but Dean will know better.

Ok, will do.
Comment 5 Dean Jackson 2012-10-19 15:35:34 PDT
(In reply to comment #1)
> Created an attachment (id=169650) [details]
> Patch
> 
> For this patch's test, I've made to following change to Khronos WebGL conformance test suite: https://github.com/KhronosGroup/WebGL/commit/6451bfd138b2f603b667cbf7839885f665607c7a
> 
> Do we need a WebKit test for this or is the WebGL conformance test sufficient?

I have been submitting patches to WebKit that reference the Khronos suite. There is an open bug to merge that into WebKit. Once that's done we'll be in a great position for testing regressions.
Comment 6 Max Vujovic 2012-10-19 15:42:26 PDT
Thanks for the review!

(In reply to comment #5)
> (In reply to comment #1)
> > Created an attachment (id=169650) [details] [details]
> > Patch
> > 
> > For this patch's test, I've made to following change to Khronos WebGL conformance test suite: https://github.com/KhronosGroup/WebGL/commit/6451bfd138b2f603b667cbf7839885f665607c7a
> > 
> > Do we need a WebKit test for this or is the WebGL conformance test sufficient?
> 
> I have been submitting patches to WebKit that reference the Khronos suite. There is an open bug to merge that into WebKit. Once that's done we'll be in a great position for testing regressions.

Ok- I'm looking forward to it!
Comment 7 WebKit Review Bot 2012-10-19 15:54:52 PDT
Comment on attachment 169650 [details]
Patch

Clearing flags on attachment: 169650

Committed r131952: <http://trac.webkit.org/changeset/131952>
Comment 8 WebKit Review Bot 2012-10-19 15:54:56 PDT
All reviewed patches have been landed.  Closing bug.