diff options
| author | 2019-08-25 01:08:35 -0300 | |
|---|---|---|
| committer | 2019-09-04 01:55:01 -0300 | |
| commit | 701dedcfad3001c1aecb2d714da1e22cc407a5ea (patch) | |
| tree | 990c44e2e99ad830e5b028f3dae0d08961623e2a /src/video_core/macro_interpreter.cpp | |
| parent | Merge pull request #2835 from chris062689/master (diff) | |
| download | yuzu-701dedcfad3001c1aecb2d714da1e22cc407a5ea.tar.gz yuzu-701dedcfad3001c1aecb2d714da1e22cc407a5ea.tar.xz yuzu-701dedcfad3001c1aecb2d714da1e22cc407a5ea.zip | |
maxwell_3d: Avoid moving macro_params
Diffstat (limited to 'src/video_core/macro_interpreter.cpp')
| -rw-r--r-- | src/video_core/macro_interpreter.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/video_core/macro_interpreter.cpp b/src/video_core/macro_interpreter.cpp index 9f59a2dc1..4e1cb98db 100644 --- a/src/video_core/macro_interpreter.cpp +++ b/src/video_core/macro_interpreter.cpp | |||
| @@ -14,11 +14,18 @@ namespace Tegra { | |||
| 14 | 14 | ||
| 15 | MacroInterpreter::MacroInterpreter(Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {} | 15 | MacroInterpreter::MacroInterpreter(Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {} |
| 16 | 16 | ||
| 17 | void MacroInterpreter::Execute(u32 offset, std::vector<u32> parameters) { | 17 | void MacroInterpreter::Execute(u32 offset, std::size_t num_parameters, const u32* parameters) { |
| 18 | MICROPROFILE_SCOPE(MacroInterp); | 18 | MICROPROFILE_SCOPE(MacroInterp); |
| 19 | Reset(); | 19 | Reset(); |
| 20 | |||
| 20 | registers[1] = parameters[0]; | 21 | registers[1] = parameters[0]; |
| 21 | this->parameters = std::move(parameters); | 22 | |
| 23 | if (num_parameters > parameters_capacity) { | ||
| 24 | parameters_capacity = num_parameters; | ||
| 25 | this->parameters = std::make_unique<u32[]>(num_parameters); | ||
| 26 | } | ||
| 27 | std::memcpy(this->parameters.get(), parameters, num_parameters * sizeof(u32)); | ||
| 28 | this->num_parameters = num_parameters; | ||
| 22 | 29 | ||
| 23 | // Execute the code until we hit an exit condition. | 30 | // Execute the code until we hit an exit condition. |
| 24 | bool keep_executing = true; | 31 | bool keep_executing = true; |
| @@ -27,7 +34,7 @@ void MacroInterpreter::Execute(u32 offset, std::vector<u32> parameters) { | |||
| 27 | } | 34 | } |
| 28 | 35 | ||
| 29 | // Assert the the macro used all the input parameters | 36 | // Assert the the macro used all the input parameters |
| 30 | ASSERT(next_parameter_index == this->parameters.size()); | 37 | ASSERT(next_parameter_index == num_parameters); |
| 31 | } | 38 | } |
| 32 | 39 | ||
| 33 | void MacroInterpreter::Reset() { | 40 | void MacroInterpreter::Reset() { |
| @@ -35,7 +42,7 @@ void MacroInterpreter::Reset() { | |||
| 35 | pc = 0; | 42 | pc = 0; |
| 36 | delayed_pc = {}; | 43 | delayed_pc = {}; |
| 37 | method_address.raw = 0; | 44 | method_address.raw = 0; |
| 38 | parameters.clear(); | 45 | num_parameters = 0; |
| 39 | // The next parameter index starts at 1, because $r1 already has the value of the first | 46 | // The next parameter index starts at 1, because $r1 already has the value of the first |
| 40 | // parameter. | 47 | // parameter. |
| 41 | next_parameter_index = 1; | 48 | next_parameter_index = 1; |
| @@ -229,7 +236,8 @@ void MacroInterpreter::ProcessResult(ResultOperation operation, u32 reg, u32 res | |||
| 229 | } | 236 | } |
| 230 | 237 | ||
| 231 | u32 MacroInterpreter::FetchParameter() { | 238 | u32 MacroInterpreter::FetchParameter() { |
| 232 | return parameters.at(next_parameter_index++); | 239 | ASSERT(next_parameter_index < num_parameters); |
| 240 | return parameters[next_parameter_index++]; | ||
| 233 | } | 241 | } |
| 234 | 242 | ||
| 235 | u32 MacroInterpreter::GetRegister(u32 register_id) const { | 243 | u32 MacroInterpreter::GetRegister(u32 register_id) const { |