From 420ca6c43c2d65d822b2f2c7da5e2808af867f4c Mon Sep 17 00:00:00 2001 From: Sludge <96552222+SludgePhD@users.noreply.github.com> Date: Sat, 20 Jul 2024 16:18:12 +0200 Subject: [PATCH] Make `Viewport::default()` return a 1x1 viewport (#14372) # Objective - The current default viewport crashes bevy due to a wgpu validation error, this PR fixes that - Fixes https://github.com/bevyengine/bevy/issues/14355 ## Solution - `Viewport::default()` now returns a 1x1 viewport ## Testing - I modified the `3d_viewport_to_world` example to use `Viewport::default()`, and it works as expected (only the top-left pixel is rendered) --- crates/bevy_render/src/camera/camera.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_render/src/camera/camera.rs b/crates/bevy_render/src/camera/camera.rs index 97b94e2762..2a1f3dcf47 100644 --- a/crates/bevy_render/src/camera/camera.rs +++ b/crates/bevy_render/src/camera/camera.rs @@ -61,7 +61,7 @@ impl Default for Viewport { fn default() -> Self { Self { physical_position: Default::default(), - physical_size: Default::default(), + physical_size: UVec2::new(1, 1), depth: 0.0..1.0, } }