From b358d6b2c9b455b5d79c5dd5bb61d7d7ff6d5b04 Mon Sep 17 00:00:00 2001 From: DH Date: Wed, 8 Oct 2025 13:13:10 +0300 Subject: [PATCH] shader/CFG: fixed test generation --- rpcsx/gpu/lib/gcn-shader/src/analyze.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/rpcsx/gpu/lib/gcn-shader/src/analyze.cpp b/rpcsx/gpu/lib/gcn-shader/src/analyze.cpp index 3b342ab5a..50d34ce23 100644 --- a/rpcsx/gpu/lib/gcn-shader/src/analyze.cpp +++ b/rpcsx/gpu/lib/gcn-shader/src/analyze.cpp @@ -502,18 +502,25 @@ std::string CFG::genTest() { for (auto node : getPreorderNodes()) { auto name = ns.getNameOf(node->getLabel()); if (node->getSuccessorCount() == 1) { - result += " createBranch(_" + + result += " createBranch(_" + name + ", _" + ns.getNameOf((*node->getSuccessors().begin())->getLabel()) + ");\n"; } else if (node->getSuccessorCount() == 2) { auto firstIt = node->getSuccessors().begin(); auto secondIt = std::next(firstIt); - result += " createConditionalBranch(_" + + result += " createConditionalBranch(_" + name + ", _" + ns.getNameOf((*firstIt)->getLabel()) + ", _" + ns.getNameOf((*secondIt)->getLabel()) + ");\n"; } else if (node->getSuccessorCount() == 0) { result += " createReturn(_" + name + ");\n"; + } else { + result += " createSwitch(_" + name; + for (auto succ : node->getSuccessors()) { + result += ", _" + ns.getNameOf(succ->getLabel()); + } + + result += ");\n"; } }