[wgpu 0.7] Update window/compositor.rs

Notes:
- wgpu::PowerPreference::Default no longer exists, maybe there is another way to replicate its behavior.
This commit is contained in:
Poly 2021-02-03 19:32:30 +01:00
parent 2d76c7165c
commit 98d108d2b7
1 changed files with 6 additions and 3 deletions

View File

@ -27,7 +27,7 @@ impl Compositor {
let adapter = instance
.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: if settings.antialiasing.is_none() {
wgpu::PowerPreference::Default
wgpu::PowerPreference::default()
} else {
wgpu::PowerPreference::HighPerformance
},
@ -38,12 +38,14 @@ impl Compositor {
let (device, queue) = adapter
.request_device(
&wgpu::DeviceDescriptor {
label: Some(
"iced_wgpu::window::Compositor Device Descriptor",
),
features: wgpu::Features::empty(),
limits: wgpu::Limits {
max_bind_groups: 2,
..wgpu::Limits::default()
},
shader_validation: false,
},
None,
)
@ -103,7 +105,7 @@ impl iced_graphics::window::Compositor for Compositor {
self.device.create_swap_chain(
surface,
&wgpu::SwapChainDescriptor {
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT,
usage: wgpu::TextureUsage::RENDER_ATTACHMENT,
format: self.settings.format,
present_mode: self.settings.present_mode,
width,
@ -130,6 +132,7 @@ impl iced_graphics::window::Compositor for Compositor {
);
let _ = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("iced_wgpu::window::Compositor Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
attachment: &frame.output.view,
resolve_target: None,