(&mut self, width: u32, height: u32)
| 77 | } |
| 78 | |
| 79 | pub fn resize(&mut self, width: u32, height: u32) { |
| 80 | self.config.width = width; |
| 81 | self.config.height = height; |
| 82 | self.texture_view = create_texture( |
| 83 | self.config.width, |
| 84 | self.config.height, |
| 85 | TextureFormat::Rgba8Unorm, |
| 86 | self.config.usage | TextureUsages::COPY_SRC, |
| 87 | &self.device_handle.device, |
| 88 | ); |
| 89 | |
| 90 | let padded_byte_width = (width * 4).next_multiple_of(256); |
| 91 | let buffer_size = padded_byte_width as u64 * height as u64; |
| 92 | self.gpu_buffer = self.device_handle.device.create_buffer(&BufferDescriptor { |
| 93 | label: None, |
| 94 | size: buffer_size, |
| 95 | usage: BufferUsages::MAP_READ | BufferUsages::COPY_DST, |
| 96 | mapped_at_creation: false, |
| 97 | }); |
| 98 | } |
| 99 | |
| 100 | // /// Resizes the surface to the new dimensions. |
| 101 | // pub fn resize(&mut self, width: u32, height: u32) { |
no test coverage detected