regl
regl copied to clipboard
Array uniforms variable passing bug
Step
- Download the minimal reproduce demo uniform1fv-bug.zip, unzip it. (Thanks to @fuzhenn Source)
- Open
index.html
in chrome. - Open developer console of the browser
Result
Uncaught TypeError: Failed to execute 'uniform1fv' on 'WebGLRenderingContext': Overload resolution failed.
at draw (eval at compile (regl.js:6018), <anonymous>:343:4)
at REGLCommand (regl.js:10297)
at run ((index):74)
at (index):80
Expected
Correctly handle array uniforms.
Reverting #591
The automated tests missed this issue.
Ran into the same issue.
Doesn't work:
shader: uniform float myArray[2];
command: "myArray[0]": 0.5,
Works:
shader: uniform vec2 myArray[2];
command: "myArray[0]": [0.5, 0.0],
are there any known work-arounds / proposals? I have a project that uses float arrays, the arrays are unknown lengths so the manual unwrap doesn't work well
I use:
uniform float values[32] // max 32 values
uniform int count //pass in the length, I have logic so it only reads the first count values
and would love to just pass uniforms like:
{
values: [0.0, 1.1, 2.2, 3.3]
count: 4
}