diff options
| -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 | ||