Vulkan Clear-renderpass merging: If a copy step is found that reads from the affected buffer, don't merge the clear into the later renderpass.

This commit is contained in:
Henrik Rydgård 2018-03-18 09:43:13 +01:00
parent 648b4eac51
commit 33a1e6a080

View File

@ -286,6 +286,11 @@ void VulkanQueueRunner::RunSteps(VkCommandBuffer cmd, const std::vector<VKRStep
// Cheaply skip the first step.
steps[j]->stepType = VKRStepType::RENDER_SKIP;
break;
} else if (steps[i]->stepType == VKRStepType::COPY &&
steps[i]->copy.src == steps[j]->render.framebuffer) {
// Can't eliminate the clear if a game copies from it before it's
// rendered to. However this should be rare.
break;
}
}
}
@ -445,7 +450,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
}
}
// Don't execute empty renderpasses.
// Don't execute empty renderpasses that keep the contents.
if (step.commands.empty() && step.render.color == VKRRenderPassAction::KEEP && step.render.depth == VKRRenderPassAction::KEEP && step.render.stencil == VKRRenderPassAction::KEEP) {
// Nothing to do.
return;