Skip to content

Commit

Permalink
resource_tracking_pass: Make sure immediate offset is accessed as cor…
Browse files Browse the repository at this point in the history
…rect type.
  • Loading branch information
squidbus committed Oct 10, 2024
1 parent 2f80d75 commit e368229
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/shader_recompiler/ir/passes/resource_tracking_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<u32>(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);
Expand Down

0 comments on commit e368229

Please sign in to comment.