-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Provide GlobalsUniform in UiMaterial shaders #10739
Conversation
thanks for opening this! can we please put globals in (there are also performance considerations against using group 2 for globals - rebinding the material group 1 would cause group 2 to be rebound as well) |
Done, thanks for the great suggestion! |
21277b9
to
7ace792
Compare
`GlobalsUniform` provides the current time to shaders, which is useful for animations. `UiMaterial` is an abstraction that makes it easier to write custom shaders for UI elements. This PR makes it possible to use the `GlobalsUniform` in `UiMaterial` shaders. The `GlobalsUniform` is bound to `@group(0) @binding(1)`. It is accessible in shaders with: ```wgsl @group(0) @binding(1) var<uniform> globals: Globals; ``` --- Added `GlobalsUniform` in `UiMaterial` shaders Should I modify the existing ui_material example to showcase this?
Objective
GlobalsUniform
provides the current time to shaders, which is useful for animations.UiMaterial
is an abstraction that makes it easier to write custom shaders for UI elements.This PR makes it possible to use the
GlobalsUniform
inUiMaterial
shaders.Solution
The
GlobalsUniform
is bound to@group(0) @binding(1)
. It is accessible in shaders with:Changelog
Added
GlobalsUniform
inUiMaterial
shadersDiscussion
Should I modify the existing ui_material example to showcase this?