From 33a1e6a080c00d644a5705228182eb25da1b1379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 18 Mar 2018 09:43:13 +0100 Subject: [PATCH] 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. --- ext/native/thin3d/VulkanQueueRunner.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ext/native/thin3d/VulkanQueueRunner.cpp b/ext/native/thin3d/VulkanQueueRunner.cpp index 1206b74e5..6e1f7380c 100644 --- a/ext/native/thin3d/VulkanQueueRunner.cpp +++ b/ext/native/thin3d/VulkanQueueRunner.cpp @@ -286,6 +286,11 @@ void VulkanQueueRunner::RunSteps(VkCommandBuffer cmd, const std::vectorstepType = 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;