Skip to content

q5-webgpu: User defined uniform data #105

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

Open
quinton-ashley opened this issue Mar 5, 2025 · 0 comments
Open

q5-webgpu: User defined uniform data #105

quinton-ashley opened this issue Mar 5, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@quinton-ashley
Copy link
Collaborator

quinton-ashley commented Mar 5, 2025

Support user defined uniform data in custom shaders.

https://p5js.org/reference/p5.Shader/setUniform/

In p5, setting uniform data is typically a necessity, as p5 doesn't provide any instance data such as width, height, mouseX, etc.

q5 does provide uniform data about the q5 instance by default though. So in q5, shader.setUniform would just be for custom data that users want to feed into the shader each frame. Pretty advanced stuff.

If q5 were to support this, I think the assumption would be the user's data is just f32 floats. q5 would make a struct for the data behind the scenes. It'd be put in a buffer each frame just like q5's default uniform data.

In q5, it'd be nice for users to be able to set uniform data in a JS object when they apply a shader, instead of having to use setUniform multiple times.

shader(myCustomShader, {
  myUniform0: 1000,
  myUniform1: 2000
});
@quinton-ashley quinton-ashley added the enhancement New feature or request label Mar 18, 2025
@quinton-ashley quinton-ashley moved this to Maybe in q5 Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Maybe
Development

No branches or pull requests

1 participant