wgpu: Make `request_adapter_and_device` take in wgpu::Instance by ref

This commit is contained in:
Nathan Adams 2023-07-16 21:07:38 +02:00
parent affff425c5
commit 030c3c50e8
4 changed files with 7 additions and 7 deletions

View File

@ -58,7 +58,7 @@ impl GuiController {
let surface = unsafe { instance.create_surface(window.as_ref()) }?;
let (adapter, device, queue) = futures::executor::block_on(request_adapter_and_device(
backend,
instance,
&instance,
Some(&surface),
opt.power.into(),
opt.trace_path(),

View File

@ -407,7 +407,7 @@ fn main() -> Result<()> {
});
let (adapter, device, queue) = futures::executor::block_on(request_adapter_and_device(
opt.graphics.into(),
instance,
&instance,
None,
opt.power.into(),
trace_path(&opt),

View File

@ -67,7 +67,7 @@ impl WgpuRenderBackend<SwapChainTarget> {
let surface = instance.create_surface_from_canvas(canvas)?;
let (adapter, device, queue) = request_adapter_and_device(
wgpu::Backends::BROWSER_WEBGPU | wgpu::Backends::GL,
instance,
&instance,
Some(&surface),
wgpu::PowerPreference::HighPerformance,
None,
@ -102,7 +102,7 @@ impl WgpuRenderBackend<SwapChainTarget> {
let surface = unsafe { instance.create_surface(window) }?;
let (adapter, device, queue) = futures::executor::block_on(request_adapter_and_device(
backend,
instance,
&instance,
Some(&surface),
power_preference,
trace_path,
@ -133,7 +133,7 @@ impl WgpuRenderBackend<crate::target::TextureTarget> {
});
let (adapter, device, queue) = futures::executor::block_on(request_adapter_and_device(
backend,
instance,
&instance,
None,
power_preference,
trace_path,
@ -1031,7 +1031,7 @@ impl<T: RenderTarget + 'static> RenderBackend for WgpuRenderBackend<T> {
pub async fn request_adapter_and_device(
backend: wgpu::Backends,
instance: wgpu::Instance,
instance: &wgpu::Instance,
surface: Option<&wgpu::Surface>,
power_preference: wgpu::PowerPreference,
trace_path: Option<&Path>,

View File

@ -18,7 +18,7 @@ use std::sync::{Arc, OnceLock};
fn create_wgpu_device() -> Option<(wgpu::Adapter, wgpu::Device, wgpu::Queue)> {
futures::executor::block_on(request_adapter_and_device(
wgpu::Backends::all(),
wgpu::Instance::new(Default::default()),
&wgpu::Instance::new(Default::default()),
None,
Default::default(),
None,