Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array uniforms variable passing bug #611

Open
HeGanjie opened this issue Mar 8, 2021 · 3 comments
Open

Array uniforms variable passing bug #611

HeGanjie opened this issue Mar 8, 2021 · 3 comments

Comments

@HeGanjie
Copy link

HeGanjie commented Mar 8, 2021

Step

  1. Download the minimal reproduce demo uniform1fv-bug.zip, unzip it. (Thanks to @fuzhenn Source)
  2. Open index.html in chrome.
  3. 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.

@mikolalysenko
Copy link
Collaborator

Reverting #591

The automated tests missed this issue.

@dionysiusmarquis
Copy link

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],

@thisispete
Copy link

thisispete commented Dec 10, 2022

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants