Skip to content

Commit

Permalink
wgpu: Initialize InstanceDescriptor from env. (#774)
Browse files Browse the repository at this point in the history
This makes the instance descriptor fully configurable from the
environment using the underlying wgpu mechanisms.
  • Loading branch information
waywardmonkeys authored Dec 19, 2024
1 parent a71236c commit 8a84a4a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions vello/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ impl RenderContext {
reason = "Creating a wgpu Instance is something which should only be done rarely"
)]
pub fn new() -> Self {
let backends = wgpu::util::backend_bits_from_env().unwrap_or_default();
let flags = wgpu::InstanceFlags::from_build_config().with_env();
let dx12_shader_compiler = wgpu::util::dx12_shader_compiler_from_env().unwrap_or_default();
let gles_minor_version = wgpu::util::gles_minor_version_from_env().unwrap_or_default();

let instance = Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::util::backend_bits_from_env().unwrap_or(wgpu::Backends::PRIMARY),
dx12_shader_compiler: wgpu::Dx12Compiler::Fxc,
..Default::default()
backends,
flags,
dx12_shader_compiler,
gles_minor_version,
});
Self {
instance,
Expand Down

0 comments on commit 8a84a4a

Please sign in to comment.