Vulkan: Clamp framebuffer resolve rectangle to texture size

This is invalid and was causing the NVIDIA driver to throw an error.
This commit is contained in:
Stenzek
2017-04-15 19:55:32 +10:00
parent eef7b6cf7a
commit 69b0a31938
5 changed files with 32 additions and 7 deletions

View File

@ -97,6 +97,16 @@ u32 GetTexelSize(VkFormat format)
}
}
VkRect2D ClampRect2D(const VkRect2D& rect, u32 width, u32 height)
{
VkRect2D out;
out.offset.x = MathUtil::Clamp(rect.offset.x, 0, static_cast<int32_t>(width - 1));
out.offset.y = MathUtil::Clamp(rect.offset.y, 0, static_cast<int32_t>(height - 1));
out.extent.width = std::min(rect.extent.width, width - static_cast<uint32_t>(rect.offset.x));
out.extent.height = std::min(rect.extent.height, height - static_cast<uint32_t>(rect.offset.y));
return out;
}
VkBlendFactor GetAlphaBlendFactor(VkBlendFactor factor)
{
switch (factor)