Don't check framebuffer dimensions against image, check renderarea

* The framebuffer is allowed to be a smaller size, the renderarea is what we
  need to check to ensure we don't render outside the image with some stale
  state.
This commit is contained in:
baldurk
2020-12-11 14:48:03 +00:00
parent 76e86db3bd
commit 32cb98f800
+11 -12
View File
@@ -497,18 +497,6 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
VulkanCreationInfo::Image &iminfo = m_pDriver->m_CreationInfo.m_Image[texid];
// bail out if the framebuffer dimensions don't match the current framebuffer, or draws will fail.
// This is an order-of-operations problem, if the overlay is set when the event is changed it is
// refreshed before the UI layer can update the current texture.
{
const VulkanCreationInfo::Framebuffer &fb =
m_pDriver->m_CreationInfo.m_Framebuffer[m_pDriver->m_RenderState.GetFramebuffer()];
if(fb.width != RDCMAX(1U, iminfo.extent.width >> sub.mip) ||
fb.height != RDCMAX(1U, iminfo.extent.height >> sub.mip))
return GetResID(m_Overlay.Image);
}
VkCommandBuffer cmd = m_pDriver->GetNextCmd();
VkCommandBufferBeginInfo beginInfo = {VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, NULL,
@@ -712,6 +700,17 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
// needs to match the depth texture type wherever our draw is.
}
// bail out if the render area is outside our image.
// This is an order-of-operations problem, if the overlay is set when the event is changed it is
// refreshed before the UI layer can update the current texture.
if(m_pDriver->m_RenderState.renderArea.offset.x + m_pDriver->m_RenderState.renderArea.extent.width >
(m_Overlay.ImageDim.width >> sub.mip) ||
m_pDriver->m_RenderState.renderArea.offset.y + m_pDriver->m_RenderState.renderArea.extent.height >
(m_Overlay.ImageDim.height >> sub.mip))
{
return GetResID(m_Overlay.Image);
}
{
VkImageSubresourceRange fullSubRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, VK_REMAINING_MIP_LEVELS,
0, VK_REMAINING_ARRAY_LAYERS};