mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-16 11:03:45 +01:00
Vulkan: Prevent some bad merging of renderpasses. Thanks Unknown for writing it up.
This commit is contained in:
1 parent
773cb5fa70
commit
05b2e11c5c
2 files changed
+29
-6
No files matched your search
@@ -754,19 +754,18 @@ void VulkanQueueRunner::ApplyRenderPassMerge(std::vector<VKRStep *> &steps) {
|
||||
for (int i = 0; i < (int)steps.size(); i++) {
|
||||
if (steps[i]->stepType == VKRStepType::RENDER && counts[steps[i]->render.framebuffer] > 1) {
|
||||
auto fb = steps[i]->render.framebuffer;
|
||||
TinySet<VKRFramebuffer *, 8> touchedFramebuffers; // must be the same fast-size as the dependencies TinySet for annoying reasons.
|
||||
for (int j = i + 1; j < (int)steps.size(); j++) {
|
||||
// If any other passes are reading from this framebuffer as-is, we cancel the scan.
|
||||
switch (steps[j]->stepType) {
|
||||
case VKRStepType::COPY:
|
||||
if (steps[j]->copy.src == fb) {
|
||||
// We're done.
|
||||
goto done_fb;
|
||||
}
|
||||
break;
|
||||
case VKRStepType::RENDER:
|
||||
if (steps[j]->dependencies.contains(fb)) {
|
||||
goto done_fb;
|
||||
}
|
||||
// Prevent Unknown's example case from https://github.com/hrydgard/ppsspp/pull/12242
|
||||
if (steps[j]->dependencies.contains(touchedFramebuffers)) {
|
||||
goto done_fb;
|
||||
}
|
||||
if (steps[j]->render.framebuffer == fb) {
|
||||
// ok. Now, if it's a render, slurp up all the commands
|
||||
// and kill the step.
|
||||
@@ -775,8 +774,18 @@ void VulkanQueueRunner::ApplyRenderPassMerge(std::vector<VKRStep *> &steps) {
|
||||
steps[i]->commands.insert(steps[i]->commands.end(), steps[j]->commands.begin(), steps[j]->commands.end());
|
||||
steps[j]->stepType = VKRStepType::RENDER_SKIP;
|
||||
}
|
||||
// Remember the framebuffer this wrote to. We can't merge with later passes that depend on these.
|
||||
if (steps[j]->render.framebuffer != fb) {
|
||||
touchedFramebuffers.insert(steps[j]->render.framebuffer);
|
||||
}
|
||||
// keep going.
|
||||
break;
|
||||
case VKRStepType::COPY:
|
||||
if (steps[j]->copy.src == fb) {
|
||||
// We're done.
|
||||
goto done_fb;
|
||||
}
|
||||
break;
|
||||
case VKRStepType::BLIT:
|
||||
if (steps[j]->blit.src == fb) {
|
||||
goto done_fb;
|
||||
|
||||
Reference in new issue
Block a user