Skip to content

Commit 62df6ed

Browse files
timon-schellingKeavon
authored andcommitted
move surface reconfiguration
1 parent b0798e8 commit 62df6ed

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

desktop/src/render/state.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ impl RenderState {
188188
pub(crate) fn resize(&mut self, width: u32, height: u32) {
189189
self.desired_width = width;
190190
self.desired_height = height;
191+
192+
if width > 0 && height > 0 && (self.config.width != width || self.config.height != height) {
193+
self.config.width = width;
194+
self.config.height = height;
195+
self.surface.configure(&self.context.device, &self.config);
196+
}
191197
}
192198

193199
pub(crate) fn bind_viewport_texture(&mut self, viewport_texture: wgpu::Texture) {
@@ -201,17 +207,8 @@ impl RenderState {
201207
}
202208

203209
pub(crate) fn bind_ui_texture(&mut self, bind_ui_texture: wgpu::Texture) {
204-
let width = bind_ui_texture.width();
205-
let height = bind_ui_texture.height();
206-
207210
self.ui_texture = Some(bind_ui_texture);
208211
self.update_bindgroup();
209-
210-
if width > 0 && height > 0 && (self.config.width != width || self.config.height != height) {
211-
self.config.width = width;
212-
self.config.height = height;
213-
self.surface.configure(&self.context.device, &self.config);
214-
}
215212
}
216213

217214
pub(crate) fn set_viewport_scale(&mut self, scale: [f32; 2]) {

0 commit comments

Comments
 (0)