fix missed examples in WebGPU update#8553
Conversation
|
(And maybe a separate issue with |
| asset_server: Res<AssetServer>, | ||
| render_device: Res<RenderDevice>, | ||
| ) { | ||
| // check if the device support the required feature |
There was a problem hiding this comment.
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.
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.
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.
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.
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.
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.
There was a problem hiding this comment.
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.
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.
I don't love this solution, but I guess it'll have to do :(
Objective
texture_binding_arrayexample no longer runs on main #8556Solution