File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,9 +82,13 @@ impl PortableCameraBlur {
8282 . await
8383 . map_err ( |error| anyhow ! ( "camera blur device: {error}" ) )
8484 } ) ?;
85- let mut processor =
86- cap_camera_effects:: BlurProcessor :: new ( & device, wgpu:: TextureFormat :: Rgba8Unorm )
87- . context ( "camera blur processor" ) ?;
85+ device. push_error_scope ( wgpu:: ErrorFilter :: Validation ) ;
86+ let processor =
87+ cap_camera_effects:: BlurProcessor :: new ( & device, wgpu:: TextureFormat :: Rgba8Unorm ) ;
88+ if let Some ( error) = runtime. block_on ( device. pop_error_scope ( ) ) {
89+ anyhow:: bail!( "camera blur GPU validation: {error}" ) ;
90+ }
91+ let mut processor = processor. context ( "camera blur processor" ) ?;
8892 processor. set_inference_interval ( INFERENCE_INTERVAL ) ;
8993
9094 Ok ( Self {
@@ -294,6 +298,19 @@ mod tests {
294298 ) ;
295299 }
296300
301+ #[ test]
302+ fn unsupported_gpu_returns_an_error_without_panicking ( ) {
303+ if std:: env:: var_os ( "CAP_GPUI_TEST_UNSUPPORTED_BLUR_GPU" ) . is_none ( ) {
304+ return ;
305+ }
306+
307+ cap_camera_effects:: initialize_onnx_runtime ( ) . expect ( "ONNX Runtime available" ) ;
308+ let error = PortableCameraBlur :: new ( )
309+ . err ( )
310+ . expect ( "unsupported GPU rejected" ) ;
311+ assert ! ( error. to_string( ) . contains( "camera blur GPU validation" ) ) ;
312+ }
313+
297314 #[ test]
298315 fn portable_blur_processes_bgra_frames_without_changing_dimensions ( ) {
299316 #[ cfg( not( target_os = "macos" ) ) ]
You can’t perform that action at this time.
0 commit comments