diff options
| author | 2020-06-03 16:33:38 +1000 | |
|---|---|---|
| committer | 2020-06-03 16:33:38 +1000 | |
| commit | 411f5527d41ba5c4f09b914b4fb4df0c6493f744 (patch) | |
| tree | de34bb541a8d2fa4a3ff411dccb2aef8a5a24574 /src | |
| parent | Pass by reference instead of copying parameters (diff) | |
| download | yuzu-411f5527d41ba5c4f09b914b4fb4df0c6493f744.tar.gz yuzu-411f5527d41ba5c4f09b914b4fb4df0c6493f744.tar.xz yuzu-411f5527d41ba5c4f09b914b4fb4df0c6493f744.zip | |
Mark parameters as const
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 3 | ||||
| -rw-r--r-- | src/video_core/macro/macro.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/macro/macro.h | 4 | ||||
| -rw-r--r-- | src/video_core/macro/macro_interpreter.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/macro/macro_interpreter.h | 2 | ||||
| -rw-r--r-- | src/video_core/macro/macro_jit_x64.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/macro/macro_jit_x64.h | 5 |
8 files changed, 11 insertions, 11 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 0c0a7c1ed..14ad40250 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -115,7 +115,7 @@ void Maxwell3D::InitializeRegisterDefaults() { | |||
| 115 | mme_inline[MAXWELL3D_REG_INDEX(index_array.count)] = true; | 115 | mme_inline[MAXWELL3D_REG_INDEX(index_array.count)] = true; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | void Maxwell3D::CallMacroMethod(u32 method, std::vector<u32>& parameters) { | 118 | void Maxwell3D::CallMacroMethod(u32 method, const std::vector<u32>& parameters) { |
| 119 | // Reset the current macro. | 119 | // Reset the current macro. |
| 120 | executing_macro = 0; | 120 | executing_macro = 0; |
| 121 | 121 | ||
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 651f37b4d..b827b112f 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -1466,7 +1466,6 @@ private: | |||
| 1466 | 1466 | ||
| 1467 | /// Interpreter for the macro codes uploaded to the GPU. | 1467 | /// Interpreter for the macro codes uploaded to the GPU. |
| 1468 | std::unique_ptr<MacroEngine> macro_engine; | 1468 | std::unique_ptr<MacroEngine> macro_engine; |
| 1469 | // MacroInterpreter macro_interpreter; | ||
| 1470 | 1469 | ||
| 1471 | static constexpr u32 null_cb_data = 0xFFFFFFFF; | 1470 | static constexpr u32 null_cb_data = 0xFFFFFFFF; |
| 1472 | struct { | 1471 | struct { |
| @@ -1495,7 +1494,7 @@ private: | |||
| 1495 | * @param num_parameters Number of arguments | 1494 | * @param num_parameters Number of arguments |
| 1496 | * @param parameters Arguments to the method call | 1495 | * @param parameters Arguments to the method call |
| 1497 | */ | 1496 | */ |
| 1498 | void CallMacroMethod(u32 method, std::vector<u32>& parameters); | 1497 | void CallMacroMethod(u32 method, const std::vector<u32>& parameters); |
| 1499 | 1498 | ||
| 1500 | /// Handles writes to the macro uploading register. | 1499 | /// Handles writes to the macro uploading register. |
| 1501 | void ProcessMacroUpload(u32 data); | 1500 | void ProcessMacroUpload(u32 data); |
diff --git a/src/video_core/macro/macro.cpp b/src/video_core/macro/macro.cpp index d05a88479..89077a2d8 100644 --- a/src/video_core/macro/macro.cpp +++ b/src/video_core/macro/macro.cpp | |||
| @@ -15,7 +15,7 @@ void MacroEngine::AddCode(u32 method, u32 data) { | |||
| 15 | uploaded_macro_code[method].push_back(data); | 15 | uploaded_macro_code[method].push_back(data); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | void MacroEngine::Execute(u32 method, std::vector<u32>& parameters) { | 18 | void MacroEngine::Execute(u32 method, const std::vector<u32>& parameters) { |
| 19 | auto compiled_macro = macro_cache.find(method); | 19 | auto compiled_macro = macro_cache.find(method); |
| 20 | if (compiled_macro != macro_cache.end()) { | 20 | if (compiled_macro != macro_cache.end()) { |
| 21 | compiled_macro->second->Execute(parameters, method); | 21 | compiled_macro->second->Execute(parameters, method); |
diff --git a/src/video_core/macro/macro.h b/src/video_core/macro/macro.h index 49fc4d6bc..b76ed891f 100644 --- a/src/video_core/macro/macro.h +++ b/src/video_core/macro/macro.h | |||
| @@ -102,7 +102,7 @@ public: | |||
| 102 | * @param code The macro byte code to execute | 102 | * @param code The macro byte code to execute |
| 103 | * @param parameters The parameters of the macro | 103 | * @param parameters The parameters of the macro |
| 104 | */ | 104 | */ |
| 105 | virtual void Execute(std::vector<u32>& parameters, u32 method) = 0; | 105 | virtual void Execute(const std::vector<u32>& parameters, u32 method) = 0; |
| 106 | }; | 106 | }; |
| 107 | 107 | ||
| 108 | class MacroEngine { | 108 | class MacroEngine { |
| @@ -113,7 +113,7 @@ public: | |||
| 113 | void AddCode(u32 method, u32 data); | 113 | void AddCode(u32 method, u32 data); |
| 114 | 114 | ||
| 115 | // Compiles the macro if its not in the cache, and executes the compiled macro | 115 | // Compiles the macro if its not in the cache, and executes the compiled macro |
| 116 | void Execute(u32 method, std::vector<u32>& parameters); | 116 | void Execute(u32 method, const std::vector<u32>& parameters); |
| 117 | 117 | ||
| 118 | protected: | 118 | protected: |
| 119 | virtual std::unique_ptr<CachedMacro> Compile(const std::vector<u32>& code) = 0; | 119 | virtual std::unique_ptr<CachedMacro> Compile(const std::vector<u32>& code) = 0; |
diff --git a/src/video_core/macro/macro_interpreter.cpp b/src/video_core/macro/macro_interpreter.cpp index e63296a21..5edff27aa 100644 --- a/src/video_core/macro/macro_interpreter.cpp +++ b/src/video_core/macro/macro_interpreter.cpp | |||
| @@ -21,7 +21,7 @@ MacroInterpreterImpl::MacroInterpreterImpl(Engines::Maxwell3D& maxwell3d, | |||
| 21 | const std::vector<u32>& code) | 21 | const std::vector<u32>& code) |
| 22 | : maxwell3d(maxwell3d), code(code) {} | 22 | : maxwell3d(maxwell3d), code(code) {} |
| 23 | 23 | ||
| 24 | void MacroInterpreterImpl::Execute(std::vector<u32>& parameters, u32 method) { | 24 | void MacroInterpreterImpl::Execute(const std::vector<u32>& parameters, u32 method) { |
| 25 | MICROPROFILE_SCOPE(MacroInterp); | 25 | MICROPROFILE_SCOPE(MacroInterp); |
| 26 | Reset(); | 26 | Reset(); |
| 27 | 27 | ||
diff --git a/src/video_core/macro/macro_interpreter.h b/src/video_core/macro/macro_interpreter.h index fb923f7b9..90217fc89 100644 --- a/src/video_core/macro/macro_interpreter.h +++ b/src/video_core/macro/macro_interpreter.h | |||
| @@ -29,7 +29,7 @@ private: | |||
| 29 | class MacroInterpreterImpl : public CachedMacro { | 29 | class MacroInterpreterImpl : public CachedMacro { |
| 30 | public: | 30 | public: |
| 31 | MacroInterpreterImpl(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& code); | 31 | MacroInterpreterImpl(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& code); |
| 32 | void Execute(std::vector<u32>& parameters, u32 method) override; | 32 | void Execute(const std::vector<u32>& parameters, u32 method) override; |
| 33 | 33 | ||
| 34 | private: | 34 | private: |
| 35 | /// Resets the execution engine state, zeroing registers, etc. | 35 | /// Resets the execution engine state, zeroing registers, etc. |
diff --git a/src/video_core/macro/macro_jit_x64.cpp b/src/video_core/macro/macro_jit_x64.cpp index 48501e582..11c1cc3be 100644 --- a/src/video_core/macro/macro_jit_x64.cpp +++ b/src/video_core/macro/macro_jit_x64.cpp | |||
| @@ -47,7 +47,7 @@ MacroJITx64Impl::MacroJITx64Impl(Engines::Maxwell3D& maxwell3d, const std::vecto | |||
| 47 | 47 | ||
| 48 | MacroJITx64Impl::~MacroJITx64Impl() = default; | 48 | MacroJITx64Impl::~MacroJITx64Impl() = default; |
| 49 | 49 | ||
| 50 | void MacroJITx64Impl::Execute(std::vector<u32>& parameters, u32 method) { | 50 | void MacroJITx64Impl::Execute(const std::vector<u32>& parameters, u32 method) { |
| 51 | MICROPROFILE_SCOPE(MacroJitExecute); | 51 | MICROPROFILE_SCOPE(MacroJitExecute); |
| 52 | ASSERT_OR_EXECUTE(program != nullptr, { return; }); | 52 | ASSERT_OR_EXECUTE(program != nullptr, { return; }); |
| 53 | JITState state{}; | 53 | JITState state{}; |
diff --git a/src/video_core/macro/macro_jit_x64.h b/src/video_core/macro/macro_jit_x64.h index 729ed7713..6152cb501 100644 --- a/src/video_core/macro/macro_jit_x64.h +++ b/src/video_core/macro/macro_jit_x64.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include "video_core/macro/macro.h" | 13 | #include "video_core/macro/macro.h" |
| 14 | 14 | ||
| 15 | namespace Tegra { | 15 | namespace Tegra { |
| 16 | |||
| 16 | namespace Engines { | 17 | namespace Engines { |
| 17 | class Maxwell3D; | 18 | class Maxwell3D; |
| 18 | } | 19 | } |
| @@ -36,7 +37,7 @@ public: | |||
| 36 | MacroJITx64Impl(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& code); | 37 | MacroJITx64Impl(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& code); |
| 37 | ~MacroJITx64Impl(); | 38 | ~MacroJITx64Impl(); |
| 38 | 39 | ||
| 39 | void Execute(std::vector<u32>& parameters, u32 method) override; | 40 | void Execute(const std::vector<u32>& parameters, u32 method) override; |
| 40 | 41 | ||
| 41 | void Compile_ALU(Macro::Opcode opcode); | 42 | void Compile_ALU(Macro::Opcode opcode); |
| 42 | void Compile_AddImmediate(Macro::Opcode opcode); | 43 | void Compile_AddImmediate(Macro::Opcode opcode); |
| @@ -66,7 +67,7 @@ private: | |||
| 66 | struct JITState { | 67 | struct JITState { |
| 67 | Engines::Maxwell3D* maxwell3d{}; | 68 | Engines::Maxwell3D* maxwell3d{}; |
| 68 | std::array<u32, Macro::NUM_MACRO_REGISTERS> registers{}; | 69 | std::array<u32, Macro::NUM_MACRO_REGISTERS> registers{}; |
| 69 | u32* parameters{}; | 70 | const u32* parameters{}; |
| 70 | u32 carry_flag{}; | 71 | u32 carry_flag{}; |
| 71 | }; | 72 | }; |
| 72 | static_assert(offsetof(JITState, maxwell3d) == 0, "Maxwell3D is not at 0x0"); | 73 | static_assert(offsetof(JITState, maxwell3d) == 0, "Maxwell3D is not at 0x0"); |