mirror of
https://github.com/RPCSX/rpcsx.git
synced 2025-12-06 07:12:14 +01:00
shader: switch canonicalization: fix ordering
Some checks are pending
Formatting check / formatting-check (push) Waiting to run
Build RPCSX / build-linux (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.1-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.2-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.4-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.5-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv9-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv9.1-a) (push) Waiting to run
Build RPCSX / build-android (x86_64, x86-64) (push) Waiting to run
Some checks are pending
Formatting check / formatting-check (push) Waiting to run
Build RPCSX / build-linux (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.1-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.2-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.4-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.5-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv9-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv9.1-a) (push) Waiting to run
Build RPCSX / build-android (x86_64, x86-64) (push) Waiting to run
This commit is contained in:
parent
06f86132c3
commit
a70fecb111
|
|
@ -2,6 +2,7 @@
|
||||||
#include "SpvConverter.hpp"
|
#include "SpvConverter.hpp"
|
||||||
#include "analyze.hpp"
|
#include "analyze.hpp"
|
||||||
#include "dialect.hpp"
|
#include "dialect.hpp"
|
||||||
|
#include <algorithm>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <rx/die.hpp>
|
#include <rx/die.hpp>
|
||||||
|
|
||||||
|
|
@ -316,6 +317,7 @@ toCanonicalSwitchSelectionConstruct(spv::Context &context,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
std::vector<ir::Block> workList;
|
std::vector<ir::Block> workList;
|
||||||
|
|
||||||
for (auto &[target, caseInfo] : cases) {
|
for (auto &[target, caseInfo] : cases) {
|
||||||
|
|
@ -345,32 +347,31 @@ toCanonicalSwitchSelectionConstruct(spv::Context &context,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::list<ir::Block> sortedCases;
|
std::list<ir::Block> sortedCases;
|
||||||
|
std::list<std::pair<ir::Block, ir::Block>> workList;
|
||||||
|
|
||||||
for (auto &[target, caseInfo] : cases) {
|
for (auto &[target, caseInfo] : cases) {
|
||||||
if (caseInfo.fallthroughBlock == nullptr) {
|
if (caseInfo.fallthroughBlock == nullptr) {
|
||||||
sortedCases.push_back(target);
|
sortedCases.push_back(target);
|
||||||
|
} else {
|
||||||
|
workList.emplace_back(target, caseInfo.fallthroughBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!sortedCases.empty());
|
assert(!sortedCases.empty());
|
||||||
|
|
||||||
for (auto &[target, caseInfo] : cases) {
|
while (!workList.empty()) {
|
||||||
if (caseInfo.fallthroughBlock == nullptr) {
|
auto [block, fallthroughBlock] = workList.front();
|
||||||
continue;
|
workList.pop_front();
|
||||||
}
|
|
||||||
|
|
||||||
auto it = sortedCases.begin();
|
if (auto it = std::ranges::find(sortedCases, fallthroughBlock);
|
||||||
while (it != sortedCases.end()) {
|
it != sortedCases.end()) {
|
||||||
if (caseInfo.fallthroughBlock == *it) {
|
sortedCases.insert(it, block);
|
||||||
break;
|
} else {
|
||||||
|
workList.emplace_back(block, fallthroughBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
|
|
||||||
sortedCases.insert(it, target);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto target : sortedCases) {
|
for (auto target : sortedCases) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue