diff options
author | 2020-05-29 02:00:28 +0200 | |
---|---|---|
committer | 2020-05-29 02:00:28 +0200 | |
commit | 0cde20b3550ede81bc7ddef628b91eec225aa8af (patch) | |
tree | 56920437979012cceb49718f2dd4ce27d5ba5d40 /wgpu/src/window/swap_chain.rs | |
parent | 67b6f044e870df41be92cdc79f571682b97a5d0d (diff) | |
parent | e11b5c614f5bf73c137b8b4f24f56047617527eb (diff) | |
download | iced-0cde20b3550ede81bc7ddef628b91eec225aa8af.tar.gz iced-0cde20b3550ede81bc7ddef628b91eec225aa8af.tar.bz2 iced-0cde20b3550ede81bc7ddef628b91eec225aa8af.zip |
Merge branch 'master' into improvement/update-wgpu_glyph
Diffstat (limited to 'wgpu/src/window/swap_chain.rs')
-rw-r--r-- | wgpu/src/window/swap_chain.rs | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/wgpu/src/window/swap_chain.rs b/wgpu/src/window/swap_chain.rs deleted file mode 100644 index 72e58a50..00000000 --- a/wgpu/src/window/swap_chain.rs +++ /dev/null @@ -1,61 +0,0 @@ -use crate::Viewport; - -/// The rendering target of a window. -/// -/// It represents a series of virtual framebuffers with a scale factor. -#[derive(Debug)] -pub struct SwapChain { - raw: wgpu::SwapChain, - viewport: Viewport, -} - -impl SwapChain {} - -impl SwapChain { - /// Creates a new [`SwapChain`] for the given surface. - /// - /// [`SwapChain`]: struct.SwapChain.html - pub fn new( - device: &wgpu::Device, - surface: &wgpu::Surface, - format: wgpu::TextureFormat, - width: u32, - height: u32, - ) -> SwapChain { - SwapChain { - raw: new_swap_chain(surface, format, width, height, device), - viewport: Viewport::new(width, height), - } - } - - /// Returns the next frame of the [`SwapChain`] alongside its [`Viewport`]. - /// - /// [`SwapChain`]: struct.SwapChain.html - /// [`Viewport`]: ../struct.Viewport.html - pub fn next_frame( - &mut self, - ) -> Result<(wgpu::SwapChainOutput, &Viewport), wgpu::TimeOut> { - let viewport = &self.viewport; - - self.raw.get_next_texture().map(|output| (output, viewport)) - } -} - -fn new_swap_chain( - surface: &wgpu::Surface, - format: wgpu::TextureFormat, - width: u32, - height: u32, - device: &wgpu::Device, -) -> wgpu::SwapChain { - device.create_swap_chain( - &surface, - &wgpu::SwapChainDescriptor { - usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT, - format, - width, - height, - present_mode: wgpu::PresentMode::Mailbox, - }, - ) -} |