From acb7712c5a5b9ca60ef74f0a0ddb457ee9a2d316 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Thu, 15 Jun 2023 21:49:06 +0200 Subject: [PATCH] Allow empty scissor rects (#3863) --- CHANGELOG.md | 4 ++++ wgpu-core/src/command/render.rs | 4 +--- wgpu-hal/src/auxil/dxgi/exception.rs | 5 +++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f9892550..67a296351 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,10 @@ Bottom level categories: - Work around [Vulkan-ValidationLayers#5671](https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/5671) by ignoring reports of violations of [VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01912](https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01912). By @jimblandy in [#3809](https://github.com/gfx-rs/wgpu/pull/3809). +### Added/New Features + +- Empty scissor rects are allowed now, matching the specification. by @PJB3005 in [#3863](https://github.com/gfx-rs/wgpu/pull/3863). + ### Documentation #### General diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index ea4bcc3e0..e8080abba 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -1685,9 +1685,7 @@ impl Global { } RenderCommand::SetScissor(ref rect) => { let scope = PassErrorScope::SetScissorRect; - if rect.w == 0 - || rect.h == 0 - || rect.x + rect.w > info.extent.width + if rect.x + rect.w > info.extent.width || rect.y + rect.h > info.extent.height { return Err(RenderCommandError::InvalidScissorRect(*rect, info.extent)) diff --git a/wgpu-hal/src/auxil/dxgi/exception.rs b/wgpu-hal/src/auxil/dxgi/exception.rs index fceac7db5..1636989b1 100644 --- a/wgpu-hal/src/auxil/dxgi/exception.rs +++ b/wgpu-hal/src/auxil/dxgi/exception.rs @@ -87,6 +87,11 @@ unsafe extern "system" fn output_debug_string_handler( return excpt::EXCEPTION_CONTINUE_SEARCH; } + if level == log::Level::Warn && message.contains("DRAW_EMPTY_SCISSOR_RECTANGLE") { + // This is normal, WebGPU allows passing empty scissor rectangles. + return excpt::EXCEPTION_CONTINUE_SEARCH; + } + let _ = std::panic::catch_unwind(|| { log::log!(level, "{}", message); });