summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/Renderer.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2019-04-28 16:01:07 +1000
committerStenzek <stenzek@gmail.com>2019-04-28 16:01:09 +1000
commit5399995c611f6ae4197baca2cd5e3746f4827d1e (patch)
tree88e619f51659df3a4f682a8751900a4b34adbaa6 /Source/Core/VideoBackends/Vulkan/Renderer.cpp
parent906ccdb1b43345d26f8065e537be0adbf811e0bf (diff)
Vulkan: Don't set a negative offset in scissor rect
The spec/validation layers say this is invalid.
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/Renderer.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/Renderer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp
index 8d702adb45..ac3dbe4c2a 100644
--- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp
+++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp
@@ -561,6 +561,19 @@ void Renderer::SetScissorRect(const MathUtil::Rectangle<int>& rc)
{
VkRect2D scissor = {{rc.left, rc.top},
{static_cast<u32>(rc.GetWidth()), static_cast<u32>(rc.GetHeight())}};
+
+ // See Vulkan spec for vkCmdSetScissor:
+ // The x and y members of offset must be greater than or equal to 0.
+ if (scissor.offset.x < 0)
+ {
+ scissor.extent.width -= -scissor.offset.x;
+ scissor.offset.x = 0;
+ }
+ if (scissor.offset.y < 0)
+ {
+ scissor.extent.height -= -scissor.offset.y;
+ scissor.offset.y = 0;
+ }
StateTracker::GetInstance()->SetScissor(scissor);
}