summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2018-07-22 03:28:08 -0400
committerGravatar Lioncash2018-07-22 03:30:35 -0400
commit0797657bc02ca8f29d38206e56e3de80689c6350 (patch)
tree9c61a1ffea8a03b5a0ef0287672dee4d924d44e3 /src
parentMerge pull request #765 from lioncash/file (diff)
downloadyuzu-0797657bc02ca8f29d38206e56e3de80689c6350.tar.gz
yuzu-0797657bc02ca8f29d38206e56e3de80689c6350.tar.xz
yuzu-0797657bc02ca8f29d38206e56e3de80689c6350.zip
gl_shader_decompiler: Remove redundant Subroutine construction in AddSubroutine()
We don't need to toss away the Subroutine instance after the find() call and reconstruct another instance with the same data right after it. Particularly give Subroutine contains a std::set.
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:
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