From 20e4ff829c0d8261a3e3c70322089e98b17e894b Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Thu, 25 Apr 2024 18:07:28 +0100 Subject: [PATCH] Allow configuration of gpu backends, features, and limits --- src/context.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/context.rs b/src/context.rs index 9ea609a..a05560f 100644 --- a/src/context.rs +++ b/src/context.rs @@ -29,10 +29,15 @@ pub struct Context<'window> { } impl<'window> Context<'window> { - pub async fn new(window: Arc, limits: wgpu::Limits) -> Result { + pub async fn new( + window: Arc, + backends: wgpu::Backends, + required_features: wgpu::Features, + required_limits: wgpu::Limits, + ) -> Result { log::info!("Initialising WGPU context..."); let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { - backends: wgpu::Backends::VULKAN, + backends, dx12_shader_compiler: Default::default(), ..Default::default() }); @@ -63,8 +68,8 @@ impl<'window> Context<'window> { .request_device( &wgpu::DeviceDescriptor { label: None, - required_features: wgpu::Features::empty(), - required_limits: limits, + required_features, + required_limits, }, None, )