Skip to content

Commit

Permalink
Fix a VK validation failure when opening the homebrew menu
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Mar 11, 2019
1 parent 3445f39 commit 624587c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ext/native/thin3d/VulkanRenderManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
7 changes: 5 additions & 2 deletions ext/native/ui/ui_context.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#include "ppsspp_config.h"

#include <algorithm>

#include "base/display.h"
#include "ui/ui.h"
#include "ui/view.h"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 624587c

Please sign in to comment.