diff --git a/ext/native/thin3d/VulkanRenderManager.h b/ext/native/thin3d/VulkanRenderManager.h index a01482b69eb4..cfac32d75c9c 100644 --- a/ext/native/thin3d/VulkanRenderManager.h +++ b/ext/native/thin3d/VulkanRenderManager.h @@ -118,6 +118,7 @@ class VulkanRenderManager { void SetViewport(const VkViewport &vp) { _dbg_assert_(G3D, curRenderStep_ && curRenderStep_->stepType == VKRStepType::RENDER); + _dbg_assert_(G3D, (int)vp.width >= 0); VkRenderData data{ VKRRenderCommand::VIEWPORT }; data.viewport.vp.x = vp.x; data.viewport.vp.y = vp.y; @@ -132,6 +133,8 @@ class VulkanRenderManager { void SetScissor(const VkRect2D &rc) { _dbg_assert_(G3D, curRenderStep_ && curRenderStep_->stepType == VKRStepType::RENDER); + _dbg_assert_(G3D, (int)rc.extent.width >= 0); + _dbg_assert_(G3D, (int)rc.extent.height >= 0); VkRenderData data{ VKRRenderCommand::SCISSOR }; data.scissor.scissor = rc; curRenderStep_->commands.push_back(data); diff --git a/ext/native/ui/ui_context.cpp b/ext/native/ui/ui_context.cpp index 0106888ec468..b5f7ba204fa3 100644 --- a/ext/native/ui/ui_context.cpp +++ b/ext/native/ui/ui_context.cpp @@ -1,4 +1,7 @@ #include "ppsspp_config.h" + +#include + #include "base/display.h" #include "ui/ui.h" #include "ui/view.h" @@ -111,8 +114,8 @@ void UIContext::ActivateTopScissor() { bounds = scissorStack_.back(); int x = floorf(scale_x * bounds.x); int y = floorf(scale_y * bounds.y); - int w = ceilf(scale_x * bounds.w); - int h = ceilf(scale_y * bounds.h); + int w = std::max(0.0f, ceilf(scale_x * bounds.w)); + int h = std::max(0.0f, ceilf(scale_y * bounds.h)); draw_->SetScissorRect(x, y, w, h); } else { // Avoid rounding errors