summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-04-04 10:18:09 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:26 +0200
commitffca21487f9728015a2c036fa581ead7d3d074d9 (patch)
treed467f65099cd9498bb8bf6e8587f98db7b1e784c
parentshader: Add subgroup masks (diff)
downloadyuzu-ffca21487f9728015a2c036fa581ead7d3d074d9.tar
yuzu-ffca21487f9728015a2c036fa581ead7d3d074d9.tar.gz
yuzu-ffca21487f9728015a2c036fa581ead7d3d074d9.tar.bz2
yuzu-ffca21487f9728015a2c036fa581ead7d3d074d9.tar.lz
yuzu-ffca21487f9728015a2c036fa581ead7d3d074d9.tar.xz
yuzu-ffca21487f9728015a2c036fa581ead7d3d074d9.tar.zst
yuzu-ffca21487f9728015a2c036fa581ead7d3d074d9.zip
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/frontend/maxwell/program.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/program.cpp b/src/shader_recompiler/frontend/maxwell/program.cpp
index 7b08f11b0..05b7591bc 100644
--- a/src/shader_recompiler/frontend/maxwell/program.cpp
+++ b/src/shader_recompiler/frontend/maxwell/program.cpp
@@ -14,20 +14,20 @@
#include "shader_recompiler/ir_opt/passes.h"
namespace Shader::Maxwell {
-
-static void RemoveUnreachableBlocks(IR::Program& program) {
+namespace {
+void RemoveUnreachableBlocks(IR::Program& program) {
// Some blocks might be unreachable if a function call exists unconditionally
// If this happens the number of blocks and post order blocks will mismatch
if (program.blocks.size() == program.post_order_blocks.size()) {
return;
}
- const IR::BlockList& post_order{program.post_order_blocks};
- std::erase_if(program.blocks, [&](IR::Block* block) {
- return std::ranges::find(post_order, block) == post_order.end();
- });
+ const auto begin{std::next(program.blocks.begin())};
+ const auto end{program.blocks.end()};
+ const auto pred{[](IR::Block* block) { return block->ImmediatePredecessors().empty(); }};
+ program.blocks.erase(std::remove_if(begin, end, pred), end);
}
-static void CollectInterpolationInfo(Environment& env, IR::Program& program) {
+void CollectInterpolationInfo(Environment& env, IR::Program& program) {
if (program.stage != Stage::Fragment) {
return;
}
@@ -60,6 +60,7 @@ static void CollectInterpolationInfo(Environment& env, IR::Program& program) {
}();
}
}
+} // Anonymous namespace
IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Block>& block_pool,
Environment& env, Flow::CFG& cfg) {