yuzu-emu
/
yuzu
Archived
1
0
Fork 0

shader/decode: Fix constant buffer offsets

Some instances were using cbuf34.offset instead of cbuf34.GetOffset().
This returned the an invalid offset. Address those instances and rename
offset to "shifted_offset" to avoid future bugs.
This commit is contained in:
ReinUsesLisp 2020-02-05 12:18:33 -03:00
parent a0b4be4262
commit bf9a822b87
3 changed files with 5 additions and 5 deletions

View File

@ -1657,11 +1657,11 @@ union Instruction {
} xmad; } xmad;
union { union {
BitField<20, 14, u64> offset; BitField<20, 14, u64> shifted_offset;
BitField<34, 5, u64> index; BitField<34, 5, u64> index;
u64 GetOffset() const { u64 GetOffset() const {
return offset * 4; return shifted_offset * 4;
} }
} cbuf34; } cbuf34;

View File

@ -166,13 +166,13 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) {
const auto [op_rhs, test] = [&]() -> std::pair<Node, Node> { const auto [op_rhs, test] = [&]() -> std::pair<Node, Node> {
switch (opcode->get().GetId()) { switch (opcode->get().GetId()) {
case OpCode::Id::ICMP_CR: case OpCode::Id::ICMP_CR:
return {GetConstBuffer(instr.cbuf34.index, instr.cbuf34.offset), return {GetConstBuffer(instr.cbuf34.index, instr.cbuf34.GetOffset()),
GetRegister(instr.gpr39)}; GetRegister(instr.gpr39)};
case OpCode::Id::ICMP_R: case OpCode::Id::ICMP_R:
return {GetRegister(instr.gpr20), GetRegister(instr.gpr39)}; return {GetRegister(instr.gpr20), GetRegister(instr.gpr39)};
case OpCode::Id::ICMP_RC: case OpCode::Id::ICMP_RC:
return {GetRegister(instr.gpr39), return {GetRegister(instr.gpr39),
GetConstBuffer(instr.cbuf34.index, instr.cbuf34.offset)}; GetConstBuffer(instr.cbuf34.index, instr.cbuf34.GetOffset())};
case OpCode::Id::ICMP_IMM: case OpCode::Id::ICMP_IMM:
return {Immediate(instr.alu.GetSignedImm20_20()), GetRegister(instr.gpr39)}; return {Immediate(instr.alu.GetSignedImm20_20()), GetRegister(instr.gpr39)};
default: default:

View File

@ -21,7 +21,7 @@ u32 ShaderIR::DecodeBfi(NodeBlock& bb, u32 pc) {
switch (opcode->get().GetId()) { switch (opcode->get().GetId()) {
case OpCode::Id::BFI_RC: case OpCode::Id::BFI_RC:
return {GetRegister(instr.gpr39), return {GetRegister(instr.gpr39),
GetConstBuffer(instr.cbuf34.index, instr.cbuf34.offset)}; GetConstBuffer(instr.cbuf34.index, instr.cbuf34.GetOffset())};
case OpCode::Id::BFI_IMM_R: case OpCode::Id::BFI_IMM_R:
return {Immediate(instr.alu.GetSignedImm20_20()), GetRegister(instr.gpr39)}; return {Immediate(instr.alu.GetSignedImm20_20()), GetRegister(instr.gpr39)};
default: default: