From f25a79595a2030ff906e592f2b27cf41f73e6b1b Mon Sep 17 00:00:00 2001 From: Andy Leiserson Date: Thu, 31 Jul 2025 22:10:15 -0700 Subject: [PATCH] Add a missing condition to viewport validation (#8040) --- cts_runner/test.lst | 1 + wgpu-core/src/command/render.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cts_runner/test.lst b/cts_runner/test.lst index 1b7059a4d..727530d29 100644 --- a/cts_runner/test.lst +++ b/cts_runner/test.lst @@ -29,6 +29,7 @@ webgpu:api,validation,encoding,cmds,index_access:* //FAIL: webgpu:api,validation,encoding,cmds,render,draw:* webgpu:api,validation,encoding,cmds,render,draw:index_buffer_OOB:* webgpu:api,validation,encoding,cmds,render,draw:unused_buffer_bound:* +webgpu:api,validation,encoding,cmds,render,dynamic_state:* webgpu:api,validation,encoding,cmds,render,setIndexBuffer:* webgpu:api,validation,encoding,cmds,render,setVertexBuffer:* webgpu:api,validation,encoding,encoder_state:* diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index ba5fdbcd7..12d5bc86d 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -2520,7 +2520,10 @@ fn set_viewport( } .into()); } - if !(0.0..=1.0).contains(&depth_min) || !(0.0..=1.0).contains(&depth_max) { + if !(0.0..=1.0).contains(&depth_min) + || !(0.0..=1.0).contains(&depth_max) + || depth_min > depth_max + { return Err(RenderCommandError::InvalidViewportDepth(depth_min, depth_max).into()); } let r = hal::Rect {