@@ -85,9 +85,20 @@ impl ShaderCache {
85
85
return Err ( RenderPipelineError :: AsModuleDescriptorError ( err, processed) ) ;
86
86
}
87
87
} ;
88
- entry. insert ( Arc :: new (
89
- render_device. create_shader_module ( & module_descriptor) ,
90
- ) )
88
+
89
+ render_device
90
+ . wgpu_device ( )
91
+ . push_error_scope ( wgpu:: ErrorFilter :: Validation ) ;
92
+ let shader_module = render_device. create_shader_module ( & module_descriptor) ;
93
+ use futures_util:: future:: FutureExt ;
94
+ let error = render_device. wgpu_device ( ) . pop_error_scope ( ) ;
95
+ if let Some ( Some ( wgpu:: Error :: Validation { description, .. } ) ) =
96
+ error. now_or_never ( )
97
+ {
98
+ return Err ( RenderPipelineError :: CreateShaderModule ( description) ) ;
99
+ }
100
+
101
+ entry. insert ( Arc :: new ( shader_module) )
91
102
}
92
103
} ;
93
104
@@ -226,6 +237,8 @@ pub enum RenderPipelineError {
226
237
AsModuleDescriptorError ( AsModuleDescriptorError , ProcessedShader ) ,
227
238
#[ error( "Shader import not yet available." ) ]
228
239
ShaderImportNotYetAvailable ,
240
+ #[ error( "{0}" ) ]
241
+ CreateShaderModule ( String ) ,
229
242
}
230
243
231
244
impl RenderPipelineCache {
@@ -304,6 +317,10 @@ impl RenderPipelineCache {
304
317
log_shader_error ( source, err) ;
305
318
continue ;
306
319
}
320
+ RenderPipelineError :: CreateShaderModule ( description) => {
321
+ error ! ( "failed to create shader module: {}" , description) ;
322
+ continue ;
323
+ }
307
324
}
308
325
}
309
326
}
0 commit comments