diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/shader/decode/memory.cpp | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/src/video_core/shader/decode/memory.cpp b/src/video_core/shader/decode/memory.cpp index e59bfa25e..0caa5062d 100644 --- a/src/video_core/shader/decode/memory.cpp +++ b/src/video_core/shader/decode/memory.cpp | |||
| @@ -27,32 +27,27 @@ using Tegra::Shader::StoreType; | |||
| 27 | 27 | ||
| 28 | namespace { | 28 | namespace { |
| 29 | 29 | ||
| 30 | Node getAtomOperation(AtomicOp op, bool is_signed, Node memory, Node data) { | 30 | Node GetAtomOperation(AtomicOp op, bool is_signed, Node memory, Node data) { |
| 31 | switch (op) { | 31 | const OperationCode operation_code = [op] { |
| 32 | case AtomicOp::Add: | 32 | switch (op) { |
| 33 | return SignedOperation(OperationCode::AtomicIAdd, is_signed, std::move(memory), | 33 | case AtomicOp::Add: |
| 34 | std::move(data)); | 34 | return OperationCode::AtomicIAdd; |
| 35 | case AtomicOp::Min: | 35 | case AtomicOp::Min: |
| 36 | return SignedOperation(OperationCode::AtomicIMin, is_signed, std::move(memory), | 36 | return OperationCode::AtomicIMin; |
| 37 | std::move(data)); | 37 | case AtomicOp::Max: |
| 38 | case AtomicOp::Max: | 38 | return OperationCode::AtomicIMax; |
| 39 | return SignedOperation(OperationCode::AtomicIMax, is_signed, std::move(memory), | 39 | case AtomicOp::And: |
| 40 | std::move(data)); | 40 | return OperationCode::AtomicIAnd; |
| 41 | case AtomicOp::And: | 41 | case AtomicOp::Or: |
| 42 | return SignedOperation(OperationCode::AtomicIAnd, is_signed, std::move(memory), | 42 | return OperationCode::AtomicIOr; |
| 43 | std::move(data)); | 43 | case AtomicOp::Xor: |
| 44 | case AtomicOp::Or: | 44 | return OperationCode::AtomicIXor; |
| 45 | return SignedOperation(OperationCode::AtomicIOr, is_signed, std::move(memory), | 45 | case AtomicOp::Exch: |
| 46 | std::move(data)); | 46 | return OperationCode::AtomicIExchange; |
| 47 | case AtomicOp::Xor: | 47 | } |
| 48 | return SignedOperation(OperationCode::AtomicIXor, is_signed, std::move(memory), | 48 | }(); |
| 49 | std::move(data)); | 49 | return SignedOperation(operation_code, is_signed, std::move(memory), |
| 50 | case AtomicOp::Exch: | ||
| 51 | return SignedOperation(OperationCode::AtomicIExchange, is_signed, std::move(memory), | ||
| 52 | std::move(data)); | 50 | std::move(data)); |
| 53 | default: | ||
| 54 | return Immediate(0); | ||
| 55 | } | ||
| 56 | } | 51 | } |
| 57 | 52 | ||
| 58 | bool IsUnaligned(Tegra::Shader::UniformType uniform_type) { | 53 | bool IsUnaligned(Tegra::Shader::UniformType uniform_type) { |
| @@ -408,7 +403,7 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) { | |||
| 408 | const bool is_signed = | 403 | const bool is_signed = |
| 409 | instr.atoms.type == AtomicType::S32 || instr.atoms.type == AtomicType::S64; | 404 | instr.atoms.type == AtomicType::S32 || instr.atoms.type == AtomicType::S64; |
| 410 | Node gmem = MakeNode<GmemNode>(real_address, base_address, descriptor); | 405 | Node gmem = MakeNode<GmemNode>(real_address, base_address, descriptor); |
| 411 | Node value = getAtomOperation(static_cast<AtomicOp>(instr.atom.operation), is_signed, gmem, | 406 | Node value = GetAtomOperation(static_cast<AtomicOp>(instr.atom.operation), is_signed, gmem, |
| 412 | GetRegister(instr.gpr20)); | 407 | GetRegister(instr.gpr20)); |
| 413 | SetRegister(bb, instr.gpr0, std::move(value)); | 408 | SetRegister(bb, instr.gpr0, std::move(value)); |
| 414 | break; | 409 | break; |
| @@ -426,7 +421,7 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) { | |||
| 426 | Node address = GetRegister(instr.gpr8); | 421 | Node address = GetRegister(instr.gpr8); |
| 427 | address = Operation(OperationCode::IAdd, std::move(address), Immediate(offset)); | 422 | address = Operation(OperationCode::IAdd, std::move(address), Immediate(offset)); |
| 428 | Node value = | 423 | Node value = |
| 429 | getAtomOperation(static_cast<AtomicOp>(instr.atoms.operation), is_signed, | 424 | GetAtomOperation(static_cast<AtomicOp>(instr.atoms.operation), is_signed, |
| 430 | GetSharedMemory(std::move(address)), GetRegister(instr.gpr20)); | 425 | GetSharedMemory(std::move(address)), GetRegister(instr.gpr20)); |
| 431 | SetRegister(bb, instr.gpr0, std::move(value)); | 426 | SetRegister(bb, instr.gpr0, std::move(value)); |
| 432 | break; | 427 | break; |