resource_tracking_pass: Make sure immediate offset is accessed as correct type. (#1339)

This commit is contained in:
squidbus 2024-10-10 13:58:01 -07:00 committed by GitHub
parent 2f80d7565d
commit 0f91661660
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);