Using WebGL2 returns wrong Uniform Buffer Object indices for uniform arrays
Categories
(Core :: Graphics: CanvasWebGL, defect, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox106 | --- | fixed |
People
(Reporter: nikoloffgeorgi, Assigned: jgilbert)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36
Steps to reproduce:
I am writing a WebGL app which uses Uniform Buffer Objects. I declare my UBO in my shader like so:
uniform Lighting {
vec3 pointLightPositions[4];
vec3 pointLightColors[4];
float pointLightIntensity;
float diffuseLightMixFactor;
};
My shaders compile and link in a program successfully. However, once I try to obtain the individual UBO member indices by calling:
const uniformIndices = gl.getUniformIndices(program, [
'pointLightPositions,
'pointLightColors,
'pointLightIntensity',
'diffuseLightMixFactor'
])
I get back the following indices:
0: 4294967295
1: 4294967295
2: 7
3: 8
Clearly the first two are wrong, while the third and last ones are ok. I suspect it has to do with the fact that the first two members are using uniform arrays. Please also notice how the third and fourth members, which are simple floats, have correct indices + correct offsets. So the offsets are being calculated correctly, but the indices are totally wrong.
Comment 1•4 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Canvas: WebGL' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 2•4 years ago
|
||
The severity field is not set for this bug.
:jgilbert, could you have a look please?
For more information, please visit auto_nag documentation.
| Assignee | ||
Comment 3•4 years ago
|
||
-
Does getUniformIndices(program, ['pointLightPositions[0]']) work?
-
Are pointLightPositions and pointLightColors both used by the shader? (They can return -1 if the compiler thinks they are unused)
| Assignee | ||
Updated•4 years ago
|
Hell yes, someone else is having the same issue. I can confirm this is happening to me.
my shader contains this:
uniform Group {
vec3 groupPosition[10];
vec3 rotor[10];
};
my js code calls this:
const uboVariableIndices = gl.getUniformIndices(
shaderPrograms,
["groupPosition", "rotor"]
);
and getUniformIndices returns:
uboVariableIndices
0: 4294967295
1: 4294967295
The same code works in chrome and safari. Check meatdumpling.com to see this in action.
Just wondering, do you need more proof than a completely unrelated party chiming in and saying that this is happening and providing a working demonstration? Right now I'm creating a suboptimal workaround for this because I believe in you guys and the fucking awesome piece of tech that is The Fox but I'm really hoping that this gets fixed.
Just in case anyone happens upon this issue, in order to get around the getUniformIndices issue what you can do is check another browser's indices and copy them over. The subsequent call to getActiveUniforms that you may do with the provided indices is equivalent from what I can tell. Time may change things.
I tried to delve into the code to figure out where this function was being called but after a few hours I still have no idea. So, workaround time. On the bright side, my code is fast again. ¯_(ツ)_/¯
Comment 7•3 years ago
|
||
Redirect a needinfo that is pending on an inactive user to the triage owner.
:jgilbert, since the bug has high priority and recent activity, could you please find another way to get the information or close the bug as INCOMPLETE if it is not actionable?
For more information, please visit auto_nag documentation.
| Assignee | ||
Comment 8•3 years ago
|
||
The preferred workaround is to query arrays via e.g. ["groupPosition[0]", "rotor[0]"].
Firefox's bug is that we're supposed to treat e.g. "groupPosition" the same as "groupPosition[0]" if groupPosition is an array.
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Comment 9•3 years ago
|
||
Upstreaming test: https://github.com/KhronosGroup/WebGL/pull/3492
| Assignee | ||
Comment 10•3 years ago
|
||
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Comment 11•3 years ago
|
||
Comment 12•3 years ago
|
||
Comment 13•3 years ago
|
||
| bugherder | ||
Description
•