diff options
| author | 2020-04-25 18:51:32 -0300 | |
|---|---|---|
| committer | 2020-04-25 22:54:14 -0300 | |
| commit | d5237342668db88cc81fefbee81f468b5214e655 (patch) | |
| tree | 5c9072ebe0b136d48ff229585e2bfd04f0ba3ff3 /src/video_core/shader/decode | |
| parent | Merge pull request #3721 from ReinUsesLisp/sort-devices (diff) | |
| download | yuzu-d5237342668db88cc81fefbee81f468b5214e655.tar.gz yuzu-d5237342668db88cc81fefbee81f468b5214e655.tar.xz yuzu-d5237342668db88cc81fefbee81f468b5214e655.zip | |
decode/register_set_predicate: Use move for shared pointers
Avoid atomic counters used by shared pointers.
Diffstat (limited to 'src/video_core/shader/decode')
| -rw-r--r-- | src/video_core/shader/decode/register_set_predicate.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/video_core/shader/decode/register_set_predicate.cpp b/src/video_core/shader/decode/register_set_predicate.cpp index 8d54cce34..a6733255d 100644 --- a/src/video_core/shader/decode/register_set_predicate.cpp +++ b/src/video_core/shader/decode/register_set_predicate.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <utility> | ||
| 6 | |||
| 5 | #include "common/assert.h" | 7 | #include "common/assert.h" |
| 6 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 7 | #include "video_core/engines/shader_bytecode.h" | 9 | #include "video_core/engines/shader_bytecode.h" |
| @@ -10,6 +12,7 @@ | |||
| 10 | 12 | ||
| 11 | namespace VideoCommon::Shader { | 13 | namespace VideoCommon::Shader { |
| 12 | 14 | ||
| 15 | using std::move; | ||
| 13 | using Tegra::Shader::Instruction; | 16 | using Tegra::Shader::Instruction; |
| 14 | using Tegra::Shader::OpCode; | 17 | using Tegra::Shader::OpCode; |
| 15 | 18 | ||
| @@ -23,7 +26,7 @@ u32 ShaderIR::DecodeRegisterSetPredicate(NodeBlock& bb, u32 pc) { | |||
| 23 | 26 | ||
| 24 | UNIMPLEMENTED_IF(instr.p2r_r2p.mode != Tegra::Shader::R2pMode::Pr); | 27 | UNIMPLEMENTED_IF(instr.p2r_r2p.mode != Tegra::Shader::R2pMode::Pr); |
| 25 | 28 | ||
| 26 | const Node apply_mask = [&] { | 29 | Node apply_mask = [this, opcode, instr] { |
| 27 | switch (opcode->get().GetId()) { | 30 | switch (opcode->get().GetId()) { |
| 28 | case OpCode::Id::R2P_IMM: | 31 | case OpCode::Id::R2P_IMM: |
| 29 | case OpCode::Id::P2R_IMM: | 32 | case OpCode::Id::P2R_IMM: |
| @@ -34,25 +37,23 @@ u32 ShaderIR::DecodeRegisterSetPredicate(NodeBlock& bb, u32 pc) { | |||
| 34 | } | 37 | } |
| 35 | }(); | 38 | }(); |
| 36 | 39 | ||
| 37 | const auto offset = static_cast<u32>(instr.p2r_r2p.byte) * 8; | 40 | const u32 offset = static_cast<u32>(instr.p2r_r2p.byte) * 8; |
| 38 | 41 | ||
| 39 | switch (opcode->get().GetId()) { | 42 | switch (opcode->get().GetId()) { |
| 40 | case OpCode::Id::R2P_IMM: { | 43 | case OpCode::Id::R2P_IMM: { |
| 41 | const Node mask = GetRegister(instr.gpr8); | 44 | Node mask = GetRegister(instr.gpr8); |
| 42 | 45 | ||
| 43 | for (u64 pred = 0; pred < NUM_PROGRAMMABLE_PREDICATES; ++pred) { | 46 | for (u64 pred = 0; pred < NUM_PROGRAMMABLE_PREDICATES; ++pred) { |
| 44 | const auto shift = static_cast<u32>(pred); | 47 | const u32 shift = static_cast<u32>(pred); |
| 45 | 48 | ||
| 46 | const Node apply_compare = BitfieldExtract(apply_mask, shift, 1); | 49 | Node apply = BitfieldExtract(apply_mask, shift, 1); |
| 47 | const Node condition = | 50 | Node condition = Operation(OperationCode::LogicalUNotEqual, apply, Immediate(0)); |
| 48 | Operation(OperationCode::LogicalUNotEqual, apply_compare, Immediate(0)); | ||
| 49 | 51 | ||
| 50 | const Node value_compare = BitfieldExtract(mask, offset + shift, 1); | 52 | Node compare = BitfieldExtract(mask, offset + shift, 1); |
| 51 | const Node value = | 53 | Node value = Operation(OperationCode::LogicalUNotEqual, move(compare), Immediate(0)); |
| 52 | Operation(OperationCode::LogicalUNotEqual, value_compare, Immediate(0)); | ||
| 53 | 54 | ||
| 54 | const Node code = Operation(OperationCode::LogicalAssign, GetPredicate(pred), value); | 55 | Node code = Operation(OperationCode::LogicalAssign, GetPredicate(pred), move(value)); |
| 55 | bb.push_back(Conditional(condition, {code})); | 56 | bb.push_back(Conditional(condition, {move(code)})); |
| 56 | } | 57 | } |
| 57 | break; | 58 | break; |
| 58 | } | 59 | } |
| @@ -61,12 +62,12 @@ u32 ShaderIR::DecodeRegisterSetPredicate(NodeBlock& bb, u32 pc) { | |||
| 61 | for (u64 pred = 0; pred < NUM_PROGRAMMABLE_PREDICATES; ++pred) { | 62 | for (u64 pred = 0; pred < NUM_PROGRAMMABLE_PREDICATES; ++pred) { |
| 62 | Node bit = Operation(OperationCode::Select, GetPredicate(pred), Immediate(1U << pred), | 63 | Node bit = Operation(OperationCode::Select, GetPredicate(pred), Immediate(1U << pred), |
| 63 | Immediate(0)); | 64 | Immediate(0)); |
| 64 | value = Operation(OperationCode::UBitwiseOr, std::move(value), std::move(bit)); | 65 | value = Operation(OperationCode::UBitwiseOr, move(value), move(bit)); |
| 65 | } | 66 | } |
| 66 | value = Operation(OperationCode::UBitwiseAnd, std::move(value), apply_mask); | 67 | value = Operation(OperationCode::UBitwiseAnd, move(value), apply_mask); |
| 67 | value = BitfieldInsert(GetRegister(instr.gpr8), std::move(value), offset, 8); | 68 | value = BitfieldInsert(GetRegister(instr.gpr8), move(value), offset, 8); |
| 68 | 69 | ||
| 69 | SetRegister(bb, instr.gpr0, std::move(value)); | 70 | SetRegister(bb, instr.gpr0, move(value)); |
| 70 | break; | 71 | break; |
| 71 | } | 72 | } |
| 72 | default: | 73 | default: |