Stop renderpass merging at readbacks.

This commit is contained in:
Henrik Rydgård 2019-08-21 21:13:56 +02:00
parent 597b034b5c
commit 773cb5fa70

View File

@ -380,7 +380,6 @@ void VulkanQueueRunner::RunSteps(VkCommandBuffer cmd, std::vector<VKRStep *> &st
// Planned optimizations:
// * Create copies of render target that are rendered to multiple times and textured from in sequence, and push those render passes
// as early as possible in the frame (Wipeout billboards).
// * Merge subsequent render passes to the same target that are interspersed with unrelated draws to other render targets (God of War).
for (int j = 0; j < (int)steps.size(); j++) {
if (steps[j]->stepType == VKRStepType::RENDER &&
@ -721,10 +720,10 @@ std::string VulkanQueueRunner::StepToString(const VKRStep &step) const {
snprintf(buffer, sizeof(buffer), "Blit (%dx%d->%dx%d)", step.blit.srcRect.extent.width, step.blit.srcRect.extent.height, step.blit.dstRect.extent.width, step.blit.dstRect.extent.height);
break;
case VKRStepType::READBACK:
snprintf(buffer, sizeof(buffer), "Readback (%dx%d)", step.readback.srcRect.extent.width, step.readback.srcRect.extent.height);
snprintf(buffer, sizeof(buffer), "Readback (%dx%d, fb: %p)", step.readback.srcRect.extent.width, step.readback.srcRect.extent.height, step.readback.src);
break;
case VKRStepType::READBACK_IMAGE:
snprintf(buffer, sizeof(buffer), "ReadbackImage");
snprintf(buffer, sizeof(buffer), "ReadbackImage (%dx%d)", step.readback_image.srcRect.extent.width, step.readback_image.srcRect.extent.height);
break;
case VKRStepType::RENDER_SKIP:
snprintf(buffer, sizeof(buffer), "(SKIPPED RenderPass)");
@ -740,7 +739,6 @@ std::string VulkanQueueRunner::StepToString(const VKRStep &step) const {
// much a guaranteed neutral or win in terms of GPU power. However, dependency calculation really
// must be perfect!
void VulkanQueueRunner::ApplyRenderPassMerge(std::vector<VKRStep *> &steps) {
return;
// First let's count how many times each framebuffer is rendered to.
// If it's more than one, let's do our best to merge them. This can help God of War quite a bit.
@ -784,6 +782,11 @@ void VulkanQueueRunner::ApplyRenderPassMerge(std::vector<VKRStep *> &steps) {
goto done_fb;
}
break;
case VKRStepType::READBACK:
if (steps[j]->readback.src == fb) {
goto done_fb;
}
break;
}
}
done_fb:
@ -864,20 +867,20 @@ void VulkanQueueRunner::LogRenderPass(const VKRStep &pass) {
ILOG("RenderPass End(%x)", fb);
}
void VulkanQueueRunner::LogCopy(const VKRStep &pass) {
ILOG("Copy()");
void VulkanQueueRunner::LogCopy(const VKRStep &step) {
ILOG("%s", StepToString(step).c_str());
}
void VulkanQueueRunner::LogBlit(const VKRStep &pass) {
ILOG("Blit()");
void VulkanQueueRunner::LogBlit(const VKRStep &step) {
ILOG("%s", StepToString(step).c_str());
}
void VulkanQueueRunner::LogReadback(const VKRStep &pass) {
ILOG("Readback");
void VulkanQueueRunner::LogReadback(const VKRStep &step) {
ILOG("%s", StepToString(step).c_str());
}
void VulkanQueueRunner::LogReadbackImage(const VKRStep &pass) {
ILOG("ReadbackImage");
void VulkanQueueRunner::LogReadbackImage(const VKRStep &step) {
ILOG("%s", StepToString(step).c_str());
}
void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer cmd) {