Browse Source

Merge pull request #3379 from ReinUsesLisp/cbuf-offset

shader/decode: Fix constant buffer offsets
nce_cpp
bunnei 6 years ago
committed by GitHub
parent
commit
082ba6fc64
  1. 4
      src/video_core/engines/shader_bytecode.h
  2. 4
      src/video_core/shader/decode/arithmetic_integer.cpp
  3. 2
      src/video_core/shader/decode/bfi.cpp

4
src/video_core/engines/shader_bytecode.h

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

4
src/video_core/shader/decode/arithmetic_integer.cpp

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

2
src/video_core/shader/decode/bfi.cpp

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

Loading…
Cancel
Save