mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Vulkan: Don't set a negative offset in scissor rect
The spec/validation layers say this is invalid.
This commit is contained in:
parent
906ccdb1b4
commit
5399995c61
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user