From 0f9166166074be844bce88bf25f6cf6cef1a77a0 Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:58:01 -0700 Subject: [PATCH] resource_tracking_pass: Make sure immediate offset is accessed as correct type. (#1339) --- src/shader_recompiler/ir/passes/resource_tracking_pass.cpp | 4 +++- 1 file changed, 3 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 21f2115d..0d91badd 100644 --- a/src/shader_recompiler/ir/passes/resource_tracking_pass.cpp +++ b/src/shader_recompiler/ir/passes/resource_tracking_pass.cpp @@ -515,7 +515,9 @@ void PatchImageSampleInstruction(IR::Block& block, IR::Inst& inst, Info& info, const auto read = [&](u32 off) -> IR::U32 { if (arg.IsImmediate()) { - const u16 comp = (arg.U32() >> off) & 0x3F; + const u32 imm = + arg.Type() == IR::Type::F32 ? std::bit_cast(arg.F32()) : arg.U32(); + const u16 comp = (imm >> off) & 0x3F; return ir.Imm32(s32(comp << 26) >> 26); } return ir.BitFieldExtract(IR::U32{arg}, ir.Imm32(off), ir.Imm32(6), true);