Revert "[vk, ogl/IR, dynarmic/IR] friendlier IR identity pointer chasing, inline AA passes (#2565)" (#3249)

FUCK. Fixes crash on Linux and SteamDeck
.
This reverts commit 46b32b7688.

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3249
Reviewed-by: DraVee <dravee@eden-emu.dev>
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie 2026-01-01 07:02:44 +01:00 committed by crueter
parent 9c3f2d2af5
commit 82f9d489e7
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
11 changed files with 149 additions and 141 deletions

View file

@ -1,11 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <vector>
#include <boost/container/small_vector.hpp>
#include "shader_recompiler/frontend/ir/basic_block.h"
#include "shader_recompiler/frontend/ir/value.h"
@ -14,30 +10,28 @@
namespace Shader::Optimization {
void IdentityRemovalPass(IR::Program& program) {
boost::container::small_vector<IR::Inst*, 16> to_invalidate;
std::vector<IR::Inst*> to_invalidate;
for (IR::Block* const block : program.blocks) {
for (auto it = block->begin(); it != block->end();) {
const size_t num_args{it->NumArgs()};
for (auto inst = block->begin(); inst != block->end();) {
const size_t num_args{inst->NumArgs()};
for (size_t i = 0; i < num_args; ++i) {
IR::Value arg = it->Arg(i);
if (arg.IsIdentity()) {
do { // Pointer chasing (3-derefs)
arg = arg.Inst()->Arg(0);
} while (arg.IsIdentity());
it->SetArg(i, arg);
IR::Value arg;
while ((arg = inst->Arg(i)).IsIdentity()) {
inst->SetArg(i, arg.Inst()->Arg(0));
}
}
if (it->GetOpcode() == IR::Opcode::Identity || it->GetOpcode() == IR::Opcode::Void) {
to_invalidate.push_back(&*it);
it = block->Instructions().erase(it);
if (inst->GetOpcode() == IR::Opcode::Identity ||
inst->GetOpcode() == IR::Opcode::Void) {
to_invalidate.push_back(&*inst);
inst = block->Instructions().erase(inst);
} else {
++it;
++inst;
}
}
}
for (IR::Inst* const inst : to_invalidate)
for (IR::Inst* const inst : to_invalidate) {
inst->Invalidate();
}
}
} // namespace Shader::Optimization