Merge pull request #8015 from FernandoS27/fix-global-mem

Shader decompiler: Fix storage tracking in deko3d.
This commit is contained in:
bunnei 2022-03-14 16:03:23 -07:00 committed by GitHub
commit cc285b9924
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -212,11 +212,11 @@ IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Blo
} }
Optimization::SsaRewritePass(program); Optimization::SsaRewritePass(program);
Optimization::ConstantPropagationPass(program);
Optimization::GlobalMemoryToStorageBufferPass(program); Optimization::GlobalMemoryToStorageBufferPass(program);
Optimization::TexturePass(env, program); Optimization::TexturePass(env, program);
Optimization::ConstantPropagationPass(program);
if (Settings::values.resolution_info.active) { if (Settings::values.resolution_info.active) {
Optimization::RescalingPass(program); Optimization::RescalingPass(program);
} }

View file

@ -334,7 +334,8 @@ std::optional<LowAddrInfo> TrackLowAddress(IR::Inst* inst) {
/// Tries to track the storage buffer address used by a global memory instruction /// Tries to track the storage buffer address used by a global memory instruction
std::optional<StorageBufferAddr> Track(const IR::Value& value, const Bias* bias) { std::optional<StorageBufferAddr> Track(const IR::Value& value, const Bias* bias) {
const auto pred{[bias](const IR::Inst* inst) -> std::optional<StorageBufferAddr> { const auto pred{[bias](const IR::Inst* inst) -> std::optional<StorageBufferAddr> {
if (inst->GetOpcode() != IR::Opcode::GetCbufU32) { if (inst->GetOpcode() != IR::Opcode::GetCbufU32 &&
inst->GetOpcode() != IR::Opcode::GetCbufU32x2) {
return std::nullopt; return std::nullopt;
} }
const IR::Value index{inst->Arg(0)}; const IR::Value index{inst->Arg(0)};