-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Work around naga/wgpu WGSL instance_index -> GLSL gl_InstanceID bug on WebGL2 #9383
Work around naga/wgpu WGSL instance_index -> GLSL gl_InstanceID bug on WebGL2 #9383
Conversation
…n WebGL2 naga and wgpu should polyfill WGSL instance_index functionality where it is not available in GLSL. Until that is done, we can work around it in bevy using a push constant which is converted to a uniform by naga and wgpu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code looks good to me.
works on win/nvidia with vulkan and dx12. i always forget how to best test wasm...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK for me on metal, webgl2 and webgpu
@robtfm I use the wasm-server-runner approach from https://bevy-cheatbook.github.io/platforms/wasm.html to test wasm builds |
it has this error with webgl2 in CI:
|
I can't reproduce. Looks like wasm32 + webgl and both the pipeline descriptor and draw parts are gated by those cfg. I did find that prepass was missing the change. |
naga and wgpu should polyfill WGSL instance_index functionality where it is not available in GLSL. Until that is done, we can work around it in bevy using a push constant which is converted to a uniform by naga and wgpu.
Objective
Solution
TODO
Changelog
bevy_render::instance_index
shader import which includes a workaround for the lack of a WGSLinstance_index
polyfill for WebGL2 in naga and wgpu for the time being. It uses a push_constant which gets converted to a plain uniform by naga and wgpu.Migration Guide
Shader code before:
After: