diff --git a/node-graph/libraries/wgpu-executor/src/context.rs b/node-graph/libraries/wgpu-executor/src/context.rs index 3c0a4e4ecb..a1d8d840b0 100644 --- a/node-graph/libraries/wgpu-executor/src/context.rs +++ b/node-graph/libraries/wgpu-executor/src/context.rs @@ -81,6 +81,16 @@ impl ContextBuilder { }; instance.request_adapter(&request_adapter_options).await.ok() } + fn is_supported_adapter(adapter: &Adapter) -> bool { + let info = adapter.get_info(); + + //Reject CPU-based adapters (e.g. llvmpipe / software Vulkan) + if info.device_type == wgpu::DeviceType::Cpu { + return false; + } + true + } + async fn request_device(&self, adapter: &Adapter) -> Option<(Device, Queue)> { let device_descriptor = wgpu::DeviceDescriptor { label: None, @@ -111,6 +121,11 @@ impl ContextBuilder { let adapter = if let Some(adapter) = selected_adapter { adapter } else { self.request_adapter(&instance).await? }; + //Fail early if the selected adapter is not supported + if !Self::is_supported_adapter(&adapter) { + return None; + } + let (device, queue) = self.request_device(&adapter).await?; Some(Context { device: Arc::new(device),