request high performance adapter
This commit is contained in:
parent
8d7e5c152e
commit
33a9b2252c
|
@ -81,21 +81,32 @@ impl RendererBackend for WgpuBackend {
|
|||
.create_surface_unsafe(wgpu::SurfaceTargetUnsafe::from_window(window)?)
|
||||
}?;
|
||||
|
||||
let adapter = manager
|
||||
.instance
|
||||
.enumerate_adapters(wgpu::Backends::all())
|
||||
.into_iter()
|
||||
.find(|adapter| adapter.is_surface_supported(&surface))
|
||||
.ok_or(Self::RendererError::NoAdapter)?;
|
||||
let (device, queue) = block_on(adapter.request_device(
|
||||
&wgpu::DeviceDescriptor {
|
||||
required_features: wgpu::Features::ADDRESS_MODE_CLAMP_TO_BORDER,
|
||||
required_limits: wgpu::Limits::default(),
|
||||
label: None,
|
||||
},
|
||||
None,
|
||||
))?;
|
||||
let (device, queue) = (Arc::new(device), Arc::new(queue));
|
||||
let (adapter, device, queue) = block_on(async {
|
||||
let adapter = manager
|
||||
.instance
|
||||
.request_adapter(&wgpu::RequestAdapterOptions {
|
||||
power_preference: wgpu::PowerPreference::HighPerformance,
|
||||
force_fallback_adapter: false,
|
||||
compatible_surface: Some(&surface),
|
||||
})
|
||||
.await
|
||||
.ok_or(Self::RendererError::NoAdapter)?;
|
||||
let (device, queue) = adapter
|
||||
.request_device(
|
||||
&wgpu::DeviceDescriptor {
|
||||
required_features: wgpu::Features::ADDRESS_MODE_CLAMP_TO_BORDER,
|
||||
required_limits: wgpu::Limits::default(),
|
||||
label: None,
|
||||
},
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
Ok::<(wgpu::Adapter, Arc<wgpu::Device>, Arc<wgpu::Queue>), Self::RendererError>((
|
||||
adapter,
|
||||
Arc::new(device),
|
||||
Arc::new(queue),
|
||||
))
|
||||
})?;
|
||||
|
||||
let capabilities = surface.get_capabilities(&adapter);
|
||||
let format = capabilities
|
||||
|
|
Loading…
Reference in a new issue