MCPcopy Create free account
hub / github.com/DioxusLabs/anyrender / resize

Method resize

crates/wgpu_context/src/buffer_renderer.rs:79–98  ·  view source on GitHub ↗
(&mut self, width: u32, height: u32)

Source from the content-addressed store, hash-verified

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) {

Callers 2

set_sizeMethod · 0.45
set_sizeMethod · 0.45

Calls 1

create_textureFunction · 0.85

Tested by

no test coverage detected