Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions apps/desktop-gpui/src/camera_blur_portable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ impl PortableCameraBlur {
.await
.map_err(|error| anyhow!("camera blur device: {error}"))
})?;
let mut processor =
cap_camera_effects::BlurProcessor::new(&device, wgpu::TextureFormat::Rgba8Unorm)
.context("camera blur processor")?;
device.push_error_scope(wgpu::ErrorFilter::Validation);
let processor =
cap_camera_effects::BlurProcessor::new(&device, wgpu::TextureFormat::Rgba8Unorm);
if let Some(error) = runtime.block_on(device.pop_error_scope()) {
anyhow::bail!("camera blur GPU validation: {error}");
}
let mut processor = processor.context("camera blur processor")?;
processor.set_inference_interval(INFERENCE_INTERVAL);

Ok(Self {
Expand Down Expand Up @@ -294,6 +298,19 @@ mod tests {
);
}

#[test]
fn unsupported_gpu_returns_an_error_without_panicking() {
if std::env::var_os("CAP_GPUI_TEST_UNSUPPORTED_BLUR_GPU").is_none() {
return;
}

cap_camera_effects::initialize_onnx_runtime().expect("ONNX Runtime available");
let error = PortableCameraBlur::new()
.err()
.expect("unsupported GPU rejected");
assert!(error.to_string().contains("camera blur GPU validation"));
}

#[test]
fn portable_blur_processes_bgra_frames_without_changing_dimensions() {
#[cfg(not(target_os = "macos"))]
Expand Down
Loading