Skip to content

Commit 773cb5f

Browse files
committed
Stop renderpass merging at readbacks.
1 parent 597b034 commit 773cb5f

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

ext/native/thin3d/VulkanQueueRunner.cpp

+15-12
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ void VulkanQueueRunner::RunSteps(VkCommandBuffer cmd, std::vector<VKRStep *> &st
380380
// Planned optimizations:
381381
// * Create copies of render target that are rendered to multiple times and textured from in sequence, and push those render passes
382382
// as early as possible in the frame (Wipeout billboards).
383-
// * Merge subsequent render passes to the same target that are interspersed with unrelated draws to other render targets (God of War).
384383

385384
for (int j = 0; j < (int)steps.size(); j++) {
386385
if (steps[j]->stepType == VKRStepType::RENDER &&
@@ -721,10 +720,10 @@ std::string VulkanQueueRunner::StepToString(const VKRStep &step) const {
721720
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);
722721
break;
723722
case VKRStepType::READBACK:
724-
snprintf(buffer, sizeof(buffer), "Readback (%dx%d)", step.readback.srcRect.extent.width, step.readback.srcRect.extent.height);
723+
snprintf(buffer, sizeof(buffer), "Readback (%dx%d, fb: %p)", step.readback.srcRect.extent.width, step.readback.srcRect.extent.height, step.readback.src);
725724
break;
726725
case VKRStepType::READBACK_IMAGE:
727-
snprintf(buffer, sizeof(buffer), "ReadbackImage");
726+
snprintf(buffer, sizeof(buffer), "ReadbackImage (%dx%d)", step.readback_image.srcRect.extent.width, step.readback_image.srcRect.extent.height);
728727
break;
729728
case VKRStepType::RENDER_SKIP:
730729
snprintf(buffer, sizeof(buffer), "(SKIPPED RenderPass)");
@@ -740,7 +739,6 @@ std::string VulkanQueueRunner::StepToString(const VKRStep &step) const {
740739
// much a guaranteed neutral or win in terms of GPU power. However, dependency calculation really
741740
// must be perfect!
742741
void VulkanQueueRunner::ApplyRenderPassMerge(std::vector<VKRStep *> &steps) {
743-
return;
744742
// First let's count how many times each framebuffer is rendered to.
745743
// If it's more than one, let's do our best to merge them. This can help God of War quite a bit.
746744

@@ -784,6 +782,11 @@ void VulkanQueueRunner::ApplyRenderPassMerge(std::vector<VKRStep *> &steps) {
784782
goto done_fb;
785783
}
786784
break;
785+
case VKRStepType::READBACK:
786+
if (steps[j]->readback.src == fb) {
787+
goto done_fb;
788+
}
789+
break;
787790
}
788791
}
789792
done_fb:
@@ -864,20 +867,20 @@ void VulkanQueueRunner::LogRenderPass(const VKRStep &pass) {
864867
ILOG("RenderPass End(%x)", fb);
865868
}
866869

867-
void VulkanQueueRunner::LogCopy(const VKRStep &pass) {
868-
ILOG("Copy()");
870+
void VulkanQueueRunner::LogCopy(const VKRStep &step) {
871+
ILOG("%s", StepToString(step).c_str());
869872
}
870873

871-
void VulkanQueueRunner::LogBlit(const VKRStep &pass) {
872-
ILOG("Blit()");
874+
void VulkanQueueRunner::LogBlit(const VKRStep &step) {
875+
ILOG("%s", StepToString(step).c_str());
873876
}
874877

875-
void VulkanQueueRunner::LogReadback(const VKRStep &pass) {
876-
ILOG("Readback");
878+
void VulkanQueueRunner::LogReadback(const VKRStep &step) {
879+
ILOG("%s", StepToString(step).c_str());
877880
}
878881

879-
void VulkanQueueRunner::LogReadbackImage(const VKRStep &pass) {
880-
ILOG("ReadbackImage");
882+
void VulkanQueueRunner::LogReadbackImage(const VKRStep &step) {
883+
ILOG("%s", StepToString(step).c_str());
881884
}
882885

883886
void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer cmd) {

0 commit comments

Comments
 (0)