From 2f80d7565de3c93b0813b360817d5f152e5c0e24 Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:30:09 -0700 Subject: [PATCH] resource_tracking_pass: Fix type handling of sample offsets. (#1337) --- src/shader_recompiler/ir/passes/resource_tracking_pass.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shader_recompiler/ir/passes/resource_tracking_pass.cpp b/src/shader_recompiler/ir/passes/resource_tracking_pass.cpp index 0cb6bff2..21f2115d 100644 --- a/src/shader_recompiler/ir/passes/resource_tracking_pass.cpp +++ b/src/shader_recompiler/ir/passes/resource_tracking_pass.cpp @@ -507,7 +507,11 @@ void PatchImageSampleInstruction(IR::Block& block, IR::Inst& inst, Info& info, } // The offsets are six-bit signed integers: X=[5:0], Y=[13:8], and Z=[21:16]. - const IR::Value arg = get_addr_reg(addr_reg++); + IR::Value arg = get_addr_reg(addr_reg++); + if (const IR::Inst* offset_inst = arg.TryInstRecursive()) { + ASSERT(offset_inst->GetOpcode() == IR::Opcode::BitCastF32U32); + arg = offset_inst->Arg(0); + } const auto read = [&](u32 off) -> IR::U32 { if (arg.IsImmediate()) {