diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index 72bb2fab6..67f3dd487 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -2408,7 +2408,9 @@ fn set_push_constant( fn set_scissor(state: &mut State, rect: Rect) -> Result<(), RenderPassErrorInner> { api_log!("RenderPass::set_scissor_rect {rect:?}"); - if rect.x + rect.w > state.info.extent.width || rect.y + rect.h > state.info.extent.height { + if rect.x.saturating_add(rect.w) > state.info.extent.width + || rect.y.saturating_add(rect.h) > state.info.extent.height + { return Err(RenderCommandError::InvalidScissorRect(rect, state.info.extent).into()); } let r = hal::Rect {