From 09f7ac21d0d3c4bb6b178bed33c84203ca8e1b73 Mon Sep 17 00:00:00 2001 From: Dario Date: Sun, 28 Jul 2024 16:35:08 -0300 Subject: [PATCH] Handle empty scissors correctly. --- src/render/rt64_framebuffer_renderer.cpp | 4 ++-- src/rhi/rt64_render_interface_types.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/render/rt64_framebuffer_renderer.cpp b/src/render/rt64_framebuffer_renderer.cpp index 5df1252..5fc39f9 100644 --- a/src/render/rt64_framebuffer_renderer.cpp +++ b/src/render/rt64_framebuffer_renderer.cpp @@ -544,8 +544,8 @@ namespace RT64 { const auto &triangles = drawCall.triangles; assert(triangles.pipeline != nullptr); - // Draw calls can sometimes end up with empty viewports and cause validation errors. We just skip them. - if (triangles.viewport.isEmpty()) { + // Draw calls can sometimes end up with empty viewports or scissors and cause validation errors. We just skip them. + if (triangles.viewport.isEmpty() || triangles.scissor.isEmpty()) { continue; } diff --git a/src/rhi/rt64_render_interface_types.h b/src/rhi/rt64_render_interface_types.h index 758ac0f..f2996ba 100644 --- a/src/rhi/rt64_render_interface_types.h +++ b/src/rhi/rt64_render_interface_types.h @@ -1485,6 +1485,10 @@ namespace RT64 { bool operator!=(const RenderRect &v) const { return (left != v.left) || (top != v.top) || (right != v.right) || (bottom != v.bottom); } + + bool isEmpty() const { + return (left >= right) || (top >= bottom); + } }; struct RenderBox {