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

@ -462,6 +462,12 @@ Texture2D* FramebufferManager::ResolveEFBColorTexture(const VkRect2D& region)
// Can't resolve within a render pass.
StateTracker::GetInstance()->EndRenderPass();
// It's not valid to resolve out-of-bounds coordinates.
// Ensuring the region is within the image is the caller's responsibility.
_assert_(region.offset.x >= 0 && region.offset.y >= 0 &&
(static_cast<u32>(region.offset.x) + region.extent.width) <= m_efb_width &&
(static_cast<u32>(region.offset.y) + region.extent.height) <= m_efb_height);
// Resolving is considered to be a transfer operation.
m_efb_color_texture->TransitionToLayout(g_command_buffer_mgr->GetCurrentCommandBuffer(),
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);