fixed constant re-creation of associated scene data if frame size is 0px
@@ -1286,7 +1286,10 @@ impl Renderer {
for (scene_handle, scene) in scenes.pair_iter().filter(|(_, s)| s.enabled) {
let graph = &scene.graph;
- let frame_size = scene.render_target.as_ref().map_or_else(
+ let frame_size = scene
+ .render_target
+ .as_ref()
+ .map_or_else(
// Use either backbuffer size
|| Vector2::new(backbuffer_width, backbuffer_height),
// Or framebuffer size
@@ -1297,7 +1300,9 @@ impl Renderer {
panic!("only rectangle textures can be used as render target!")
}
},
- );
+ )
+ // Clamp to [1.0; infinity] range.
+ .sup(&Vector2::new(1.0, 1.0));
let state = &mut self.state;
@@ -1310,14 +1315,14 @@ impl Renderer {
if data.gbuffer.width != frame_size.x as i32
|| data.gbuffer.height != frame_size.y as i32
{
- let width = (frame_size.x as usize).max(1);
- let height = (frame_size.y as usize).max(1);
+ let width = frame_size.x as usize;
+ let height = frame_size.y as usize;
*data = AssociatedSceneData::new(state, width, height).unwrap();
}
})
.or_insert_with(|| {
- let width = (frame_size.x as usize).max(1);
- let height = (frame_size.y as usize).max(1);
+ let width = frame_size.x as usize;
+ let height = frame_size.y as usize;
AssociatedSceneData::new(state, width, height).unwrap()
});
