-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix missed examples in WebGPU update #8553
Conversation
(And maybe a separate issue with |
) { | ||
// check if the device support the required feature |
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.
If I recall correctly, this was in main partially as a way of demonstrating graceful handling of missing features.
But now with wasm/webgl2 at least, we get a panic before this code gets a chance to run.
Is this code even useful anymore?
sm.js:387 panicked at 'wgpu error: Validation Error
Caused by:
In Device::create_bind_group_layout
note: label = `bindless_material_layout`
Binding 0 entry is invalid
Features Features(TEXTURE_BINDING_ARRAY) are required but not enabled on the device
', /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.16.0/src/backend/direct.rs:3019:5
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.
That should really be moved to main(), after the default plugin is setup and before the custom material is setup.
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.
But now with wasm/webgl2 at least, we get a panic before this code gets a chance to run.
Oh that gives the correct log in wasm/WebGPU, but not in wasm/WebGL2...
That should really be moved to main(), after the default plugin is setup and before the custom material is setup.
That's not possible anymore, the renderer is not available before the winit event loop is started.
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.
Is it only the device that needs to be created in finish()? Can we create an adapter in the main plugin build, and use that to check for feature support?
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.
Getting the adapter is async: https://docs.rs/wgpu/latest/wgpu/struct.Instance.html#method.request_adapter
Getting the device is async: https://docs.rs/wgpu/latest/wgpu/struct.Adapter.html#method.request_device
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.
A more complete fix would be to introduce a "fake" plugin in the example that just does the check, but nothing else from what's expected from a plugin
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.
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.
I'm not sure. What I need is the ability to add a plugin only if certain features are supported. Here's an example: https://github.com/JMS55/bevy/blob/solari/crates/bevy_solari/src/lib.rs#L45-L62.
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.
That's not going to be possible like that, without putting all the app initialisation as async.
What you can do is add your plugins, but have them do nothing if the features are not available.
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.
I don't love this solution, but I guess it'll have to do :(
Objective
texture_binding_array
example no longer runs on main #8556Solution