File tree 1 file changed +5
-0
lines changed
crates/bevy_render/src/render_resource
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,11 @@ impl ShaderCache {
135
135
. push_error_scope ( wgpu:: ErrorFilter :: Validation ) ;
136
136
let shader_module = render_device. create_shader_module ( & module_descriptor) ;
137
137
let error = render_device. wgpu_device ( ) . pop_error_scope ( ) ;
138
+
139
+ // `now_or_never` will return Some if the future is ready and None otherwise.
140
+ // On native platforms, wgpu will yield the error immediatly while on wasm it may take longer since the browser APIs are asynchronous.
141
+ // So to keep the complexity of the ShaderCache low, we will only catch this error early on native platforms,
142
+ // and on wasm the error will be handled by wgpu and crash the application.
138
143
if let Some ( Some ( wgpu:: Error :: Validation { description, .. } ) ) =
139
144
futures_helper:: now_or_never ( error)
140
145
{
You can’t perform that action at this time.
0 commit comments