diff options
| author | 2019-10-17 19:21:09 -0300 | |
|---|---|---|
| committer | 2019-10-17 19:21:09 -0300 | |
| commit | a21b88ef8f10900f93bfd5fef2c721b349f67bc8 (patch) | |
| tree | 01f0e24dca6e0c73a99f5c26899e81e9c6b97127 /src/video_core/macro_interpreter.h | |
| parent | Merge pull request #2989 from lioncash/apm (diff) | |
| parent | video_core/macro_interpreter: Make definitions of most private enums/unions h... (diff) | |
| download | yuzu-a21b88ef8f10900f93bfd5fef2c721b349f67bc8.tar.gz yuzu-a21b88ef8f10900f93bfd5fef2c721b349f67bc8.tar.xz yuzu-a21b88ef8f10900f93bfd5fef2c721b349f67bc8.zip | |
Merge pull request #2979 from lioncash/macro
video_core/macro_interpreter: Make definitions of most private enums/unions hidden
Diffstat (limited to 'src/video_core/macro_interpreter.h')
| -rw-r--r-- | src/video_core/macro_interpreter.h | 80 |
1 files changed, 8 insertions, 72 deletions
diff --git a/src/video_core/macro_interpreter.h b/src/video_core/macro_interpreter.h index 76b6a895b..631146d89 100644 --- a/src/video_core/macro_interpreter.h +++ b/src/video_core/macro_interpreter.h | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <optional> | 8 | #include <optional> |
| 9 | #include <vector> | ||
| 10 | 9 | ||
| 11 | #include "common/bit_field.h" | 10 | #include "common/bit_field.h" |
| 12 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| @@ -28,75 +27,11 @@ public: | |||
| 28 | void Execute(u32 offset, std::size_t num_parameters, const u32* parameters); | 27 | void Execute(u32 offset, std::size_t num_parameters, const u32* parameters); |
| 29 | 28 | ||
| 30 | private: | 29 | private: |
| 31 | enum class Operation : u32 { | 30 | enum class ALUOperation : u32; |
| 32 | ALU = 0, | 31 | enum class BranchCondition : u32; |
| 33 | AddImmediate = 1, | 32 | enum class ResultOperation : u32; |
| 34 | ExtractInsert = 2, | ||
| 35 | ExtractShiftLeftImmediate = 3, | ||
| 36 | ExtractShiftLeftRegister = 4, | ||
| 37 | Read = 5, | ||
| 38 | Unused = 6, // This operation doesn't seem to be a valid encoding. | ||
| 39 | Branch = 7, | ||
| 40 | }; | ||
| 41 | |||
| 42 | enum class ALUOperation : u32 { | ||
| 43 | Add = 0, | ||
| 44 | AddWithCarry = 1, | ||
| 45 | Subtract = 2, | ||
| 46 | SubtractWithBorrow = 3, | ||
| 47 | // Operations 4-7 don't seem to be valid encodings. | ||
| 48 | Xor = 8, | ||
| 49 | Or = 9, | ||
| 50 | And = 10, | ||
| 51 | AndNot = 11, | ||
| 52 | Nand = 12 | ||
| 53 | }; | ||
| 54 | |||
| 55 | enum class ResultOperation : u32 { | ||
| 56 | IgnoreAndFetch = 0, | ||
| 57 | Move = 1, | ||
| 58 | MoveAndSetMethod = 2, | ||
| 59 | FetchAndSend = 3, | ||
| 60 | MoveAndSend = 4, | ||
| 61 | FetchAndSetMethod = 5, | ||
| 62 | MoveAndSetMethodFetchAndSend = 6, | ||
| 63 | MoveAndSetMethodSend = 7 | ||
| 64 | }; | ||
| 65 | 33 | ||
| 66 | enum class BranchCondition : u32 { | 34 | union Opcode; |
| 67 | Zero = 0, | ||
| 68 | NotZero = 1, | ||
| 69 | }; | ||
| 70 | |||
| 71 | union Opcode { | ||
| 72 | u32 raw; | ||
| 73 | BitField<0, 3, Operation> operation; | ||
| 74 | BitField<4, 3, ResultOperation> result_operation; | ||
| 75 | BitField<4, 1, BranchCondition> branch_condition; | ||
| 76 | BitField<5, 1, u32> | ||
| 77 | branch_annul; // If set on a branch, then the branch doesn't have a delay slot. | ||
| 78 | BitField<7, 1, u32> is_exit; | ||
| 79 | BitField<8, 3, u32> dst; | ||
| 80 | BitField<11, 3, u32> src_a; | ||
| 81 | BitField<14, 3, u32> src_b; | ||
| 82 | // The signed immediate overlaps the second source operand and the alu operation. | ||
| 83 | BitField<14, 18, s32> immediate; | ||
| 84 | |||
| 85 | BitField<17, 5, ALUOperation> alu_operation; | ||
| 86 | |||
| 87 | // Bitfield instructions data | ||
| 88 | BitField<17, 5, u32> bf_src_bit; | ||
| 89 | BitField<22, 5, u32> bf_size; | ||
| 90 | BitField<27, 5, u32> bf_dst_bit; | ||
| 91 | |||
| 92 | u32 GetBitfieldMask() const { | ||
| 93 | return (1 << bf_size) - 1; | ||
| 94 | } | ||
| 95 | |||
| 96 | s32 GetBranchTarget() const { | ||
| 97 | return static_cast<s32>(immediate * sizeof(u32)); | ||
| 98 | } | ||
| 99 | }; | ||
| 100 | 35 | ||
| 101 | union MethodAddress { | 36 | union MethodAddress { |
| 102 | u32 raw; | 37 | u32 raw; |
| @@ -149,9 +84,10 @@ private: | |||
| 149 | 84 | ||
| 150 | Engines::Maxwell3D& maxwell3d; | 85 | Engines::Maxwell3D& maxwell3d; |
| 151 | 86 | ||
| 152 | u32 pc; ///< Current program counter | 87 | /// Current program counter |
| 153 | std::optional<u32> | 88 | u32 pc; |
| 154 | delayed_pc; ///< Program counter to execute at after the delay slot is executed. | 89 | /// Program counter to execute at after the delay slot is executed. |
| 90 | std::optional<u32> delayed_pc; | ||
| 155 | 91 | ||
| 156 | static constexpr std::size_t NumMacroRegisters = 8; | 92 | static constexpr std::size_t NumMacroRegisters = 8; |
| 157 | 93 | ||