diff options
| author | 2018-07-22 10:24:20 -0700 | |
|---|---|---|
| committer | 2018-07-22 10:24:20 -0700 | |
| commit | 3618a68f93d0f5a795fd9fda84aea530ace4a93c (patch) | |
| tree | 6c9c73945947ca1df966c96e94f3a04bc0dac0a7 /src | |
| parent | Merge pull request #638 from MerryMage/mp (diff) | |
| parent | gl_shader_decompiler: Remove redundant Subroutine construction in AddSubrouti... (diff) | |
| download | yuzu-3618a68f93d0f5a795fd9fda84aea530ace4a93c.tar.gz yuzu-3618a68f93d0f5a795fd9fda84aea530ace4a93c.tar.xz yuzu-3618a68f93d0f5a795fd9fda84aea530ace4a93c.zip | |
Merge pull request #770 from lioncash/construct
gl_shader_decompiler: Remove redundant Subroutine construction in AddSubroutine()
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index f47fd217d..ba827181b 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -78,14 +78,18 @@ private: | |||
| 78 | 78 | ||
| 79 | /// Adds and analyzes a new subroutine if it is not added yet. | 79 | /// Adds and analyzes a new subroutine if it is not added yet. |
| 80 | const Subroutine& AddSubroutine(u32 begin, u32 end, const std::string& suffix) { | 80 | const Subroutine& AddSubroutine(u32 begin, u32 end, const std::string& suffix) { |
| 81 | auto iter = subroutines.find(Subroutine{begin, end, suffix}); | 81 | Subroutine subroutine{begin, end, suffix, ExitMethod::Undetermined, {}}; |
| 82 | if (iter != subroutines.end()) | 82 | |
| 83 | const auto iter = subroutines.find(subroutine); | ||
| 84 | if (iter != subroutines.end()) { | ||
| 83 | return *iter; | 85 | return *iter; |
| 86 | } | ||
| 84 | 87 | ||
| 85 | Subroutine subroutine{begin, end, suffix}; | ||
| 86 | subroutine.exit_method = Scan(begin, end, subroutine.labels); | 88 | subroutine.exit_method = Scan(begin, end, subroutine.labels); |
| 87 | if (subroutine.exit_method == ExitMethod::Undetermined) | 89 | if (subroutine.exit_method == ExitMethod::Undetermined) { |
| 88 | throw DecompileFail("Recursive function detected"); | 90 | throw DecompileFail("Recursive function detected"); |
| 91 | } | ||
| 92 | |||
| 89 | return *subroutines.insert(std::move(subroutine)).first; | 93 | return *subroutines.insert(std::move(subroutine)).first; |
| 90 | } | 94 | } |
| 91 | 95 | ||