Skip to content

Commit

Permalink
resource_tracking_pass: Fix type handling of sample offsets.
Browse files Browse the repository at this point in the history
  • Loading branch information
squidbus committed Oct 10, 2024
1 parent 21eb175 commit 4dffcef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/shader_recompiler/ir/passes/resource_tracking_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,14 +507,14 @@ 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++);
const auto arg = ir.BitCast<IR::U32>(get_addr_reg(addr_reg++));

const auto read = [&](u32 off) -> IR::U32 {
if (arg.IsImmediate()) {
const u16 comp = (arg.U32() >> off) & 0x3F;
return ir.Imm32(s32(comp << 26) >> 26);
}
return ir.BitFieldExtract(IR::U32{arg}, ir.Imm32(off), ir.Imm32(6), true);
return ir.BitFieldExtract(arg, ir.Imm32(off), ir.Imm32(6), true);
};

switch (image.GetType()) {
Expand Down

0 comments on commit 4dffcef

Please sign in to comment.