diff options
author | 2020-03-24 19:08:21 +0100 | |
---|---|---|
committer | 2020-03-24 19:08:21 +0100 | |
commit | e77fa175aa0eaf62be4ebafbd8e0dbc5df18f006 (patch) | |
tree | 78608f77c6db3ff1e61a58008bd54d114f32352c /wgpu/src/window | |
parent | 7cb1452d29ddfdcd29fd7ecc7c96a79ea2681fce (diff) | |
parent | fd7d9622e333a0a2cd5c2e8e6cc38cc09d7981e4 (diff) | |
download | iced-e77fa175aa0eaf62be4ebafbd8e0dbc5df18f006.tar.gz iced-e77fa175aa0eaf62be4ebafbd8e0dbc5df18f006.tar.bz2 iced-e77fa175aa0eaf62be4ebafbd8e0dbc5df18f006.zip |
Merge branch 'master' into feature/text-selection
Diffstat (limited to '')
-rw-r--r-- | wgpu/src/window/backend.rs | 12 | ||||
-rw-r--r-- | wgpu/src/window/swap_chain.rs | 6 |
2 files changed, 14 insertions, 4 deletions
diff --git a/wgpu/src/window/backend.rs b/wgpu/src/window/backend.rs index 4c9f289b..5b269f36 100644 --- a/wgpu/src/window/backend.rs +++ b/wgpu/src/window/backend.rs @@ -8,6 +8,7 @@ use raw_window_handle::HasRawWindowHandle; pub struct Backend { device: wgpu::Device, queue: wgpu::Queue, + format: wgpu::TextureFormat, } impl iced_native::window::Backend for Backend { @@ -37,7 +38,14 @@ impl iced_native::window::Backend for Backend { let renderer = Renderer::new(&mut device, settings); - (Backend { device, queue }, renderer) + ( + Backend { + device, + queue, + format: settings.format, + }, + renderer, + ) } fn create_surface<W: HasRawWindowHandle>( @@ -53,7 +61,7 @@ impl iced_native::window::Backend for Backend { width: u32, height: u32, ) -> SwapChain { - SwapChain::new(&self.device, surface, width, height) + SwapChain::new(&self.device, surface, self.format, width, height) } fn draw<T: AsRef<str>>( diff --git a/wgpu/src/window/swap_chain.rs b/wgpu/src/window/swap_chain.rs index 6f545fce..4ca2901b 100644 --- a/wgpu/src/window/swap_chain.rs +++ b/wgpu/src/window/swap_chain.rs @@ -18,11 +18,12 @@ impl SwapChain { pub fn new( device: &wgpu::Device, surface: &wgpu::Surface, + format: wgpu::TextureFormat, width: u32, height: u32, ) -> SwapChain { SwapChain { - raw: new_swap_chain(surface, width, height, device), + raw: new_swap_chain(surface, format, width, height, device), viewport: Viewport::new(width, height), } } @@ -38,6 +39,7 @@ impl SwapChain { fn new_swap_chain( surface: &wgpu::Surface, + format: wgpu::TextureFormat, width: u32, height: u32, device: &wgpu::Device, @@ -46,7 +48,7 @@ fn new_swap_chain( &surface, &wgpu::SwapChainDescriptor { usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT, - format: wgpu::TextureFormat::Bgra8UnormSrgb, + format, width, height, present_mode: wgpu::PresentMode::Vsync, |