Skip to content

Commit

Permalink
Remove workaround in Global::instance_create_surface's.
Browse files Browse the repository at this point in the history
As of gfx-rs#3022, the local `init` function no longer needs a dummy
argument.
  • Loading branch information
jimblandy committed Oct 13, 2022
1 parent 647d705 commit 9249d78
Showing 1 changed file with 5 additions and 35 deletions.
40 changes: 5 additions & 35 deletions wgpu-core/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
) -> SurfaceId {
profiling::scope!("Instance::create_surface");

// Note: using a dummy argument to work around the following
// error:

// > cannot provide explicit generic arguments when `impl Trait` is used in argument position
fn init<A: hal::Api>(
_: A,
inst: &Option<A::Instance>,
display_handle: raw_window_handle::RawDisplayHandle,
window_handle: raw_window_handle::RawWindowHandle,
Expand All @@ -475,40 +470,15 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let surface = Surface {
presentation: None,
#[cfg(vulkan)]
vulkan: init(
hal::api::Vulkan,
&self.instance.vulkan,
display_handle,
window_handle,
),
vulkan: init::<hal::api::Vulkan>(&self.instance.vulkan, display_handle, window_handle),
#[cfg(metal)]
metal: init(
hal::api::Metal,
&self.instance.metal,
display_handle,
window_handle,
),
metal: init::<hal::api::Metal>(&self.instance.metal, display_handle, window_handle),
#[cfg(dx12)]
dx12: init(
hal::api::Dx12,
&self.instance.dx12,
display_handle,
window_handle,
),
dx12: init::<hal::api::Dx12>(&self.instance.dx12, display_handle, window_handle),
#[cfg(dx11)]
dx11: init(
hal::api::Dx11,
&self.instance.dx11,
display_handle,
window_handle,
),
dx11: init::<hal::api::Dx11>(&self.instance.dx11, display_handle, window_handle),
#[cfg(gl)]
gl: init(
hal::api::Gles,
&self.instance.gl,
display_handle,
window_handle,
),
gl: init::<hal::api::Gles>(&self.instance.gl, display_handle, window_handle),
};

let mut token = Token::root();
Expand Down

0 comments on commit 9249d78

Please sign in to comment.