Skip to content

Commit

Permalink
fix WGPUInstanceBackend_All for enumerateAdapters (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajveermalviya authored Jan 3, 2024
1 parent 19c9895 commit 24d654d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ pub fn map_origin3d(native: &native::WGPUOrigin3D) -> wgt::Origin3d {

#[inline]
pub fn map_instance_backend_flags(flags: native::WGPUInstanceBackend) -> wgt::Backends {
if flags == native::WGPUInstanceBackend_All {
return wgt::Backends::all();
}

let mut result = wgt::Backends::empty();
if (flags & native::WGPUInstanceBackend_BrowserWebGPU) != 0 {
result |= wgt::Backends::BROWSER_WEBGPU;
Expand Down Expand Up @@ -284,10 +288,7 @@ pub fn map_instance_descriptor(
};

wgt::InstanceDescriptor {
backends: match extras.backends as native::WGPUInstanceBackend {
native::WGPUInstanceBackend_All => wgt::Backends::all(),
backends => map_instance_backend_flags(backends),
},
backends: map_instance_backend_flags(extras.backends as native::WGPUInstanceBackend),
dx12_shader_compiler,
gles_minor_version: map_gles3_minor_version(extras.gles3MinorVersion),
flags: match extras.flags as native::WGPUInstanceFlag {
Expand Down

0 comments on commit 24d654d

Please sign in to comment.