mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-23 07:51:08 +01:00
Avoid overflows for extreme scissor coordinates (#7459)
This commit is contained in:
1 parent
a9279de793
commit
ab38e8e430
1 file changed
+3
-1
@@ -2408,7 +2408,9 @@ fn set_push_constant(
|
||||
fn set_scissor(state: &mut State, rect: Rect<u32>) -> 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 {
|
||||
|
||||
Reference in new issue
Block a user