summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-22 19:24:20 +0200
committerGitHub <noreply@github.com>2018-07-22 19:24:20 +0200
commit3618a68f93d0f5a795fd9fda84aea530ace4a93c (patch)
tree6c9c73945947ca1df966c96e94f3a04bc0dac0a7 /src
parentMerge pull request #638 from MerryMage/mp (diff)
parentgl_shader_decompiler: Remove redundant Subroutine construction in AddSubroutine() (diff)
downloadyuzu-3618a68f93d0f5a795fd9fda84aea530ace4a93c.tar
yuzu-3618a68f93d0f5a795fd9fda84aea530ace4a93c.tar.gz
yuzu-3618a68f93d0f5a795fd9fda84aea530ace4a93c.tar.bz2
yuzu-3618a68f93d0f5a795fd9fda84aea530ace4a93c.tar.lz
yuzu-3618a68f93d0f5a795fd9fda84aea530ace4a93c.tar.xz
yuzu-3618a68f93d0f5a795fd9fda84aea530ace4a93c.tar.zst
yuzu-3618a68f93d0f5a795fd9fda84aea530ace4a93c.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp12
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:
/// Adds and analyzes a new subroutine if it is not added yet.
const Subroutine& AddSubroutine(u32 begin, u32 end, const std::string& suffix) {
- auto iter = subroutines.find(Subroutine{begin, end, suffix});
- if (iter != subroutines.end())
+ Subroutine subroutine{begin, end, suffix, ExitMethod::Undetermined, {}};
+
+ const auto iter = subroutines.find(subroutine);
+ if (iter != subroutines.end()) {
return *iter;
+ }
- Subroutine subroutine{begin, end, suffix};
subroutine.exit_method = Scan(begin, end, subroutine.labels);
- if (subroutine.exit_method == ExitMethod::Undetermined)
+ if (subroutine.exit_method == ExitMethod::Undetermined) {
throw DecompileFail("Recursive function detected");
+ }
+
return *subroutines.insert(std::move(subroutine)).first;
}