summaryrefslogtreecommitdiff
path: root/src/video_core/shader/decode.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2019-07-16 10:37:11 -0400
committerGravatar Lioncash2019-07-16 19:49:23 -0400
commitbebbdc20677c900aec5a6fa9481b1861f202ca02 (patch)
treeb11ca2c6d687f276ed53318c0aa7e4ab4080c8a6 /src/video_core/shader/decode.cpp
parentshader_ir: Rename Get/SetTemporal to Get/SetTemporary (diff)
downloadyuzu-bebbdc20677c900aec5a6fa9481b1861f202ca02.tar.gz
yuzu-bebbdc20677c900aec5a6fa9481b1861f202ca02.tar.xz
yuzu-bebbdc20677c900aec5a6fa9481b1861f202ca02.zip
shader_ir: std::move Node instance where applicable
These are std::shared_ptr instances underneath the hood, which means copying them isn't as cheap as a regular pointer. Particularly so on weakly-ordered systems. This avoids atomic reference count increments and decrements where they aren't necessary for the core set of operations.
Diffstat (limited to 'src/video_core/shader/decode.cpp')
-rw-r--r--src/video_core/shader/decode.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/video_core/shader/decode.cpp b/src/video_core/shader/decode.cpp
index 29c8895c5..afffd157f 100644
--- a/src/video_core/shader/decode.cpp
+++ b/src/video_core/shader/decode.cpp
@@ -46,12 +46,12 @@ void ShaderIR::Decode() {
46 coverage_end = shader_info.end; 46 coverage_end = shader_info.end;
47 if (shader_info.decompilable) { 47 if (shader_info.decompilable) {
48 disable_flow_stack = true; 48 disable_flow_stack = true;
49 const auto insert_block = ([this](NodeBlock& nodes, u32 label) { 49 const auto insert_block = [this](NodeBlock& nodes, u32 label) {
50 if (label == exit_branch) { 50 if (label == exit_branch) {
51 return; 51 return;
52 } 52 }
53 basic_blocks.insert({label, nodes}); 53 basic_blocks.insert({label, nodes});
54 }); 54 };
55 const auto& blocks = shader_info.blocks; 55 const auto& blocks = shader_info.blocks;
56 NodeBlock current_block; 56 NodeBlock current_block;
57 u32 current_label = exit_branch; 57 u32 current_label = exit_branch;
@@ -103,7 +103,7 @@ void ShaderIR::DecodeRangeInner(NodeBlock& bb, u32 begin, u32 end) {
103} 103}
104 104
105void ShaderIR::InsertControlFlow(NodeBlock& bb, const ShaderBlock& block) { 105void ShaderIR::InsertControlFlow(NodeBlock& bb, const ShaderBlock& block) {
106 const auto apply_conditions = ([&](const Condition& cond, Node n) -> Node { 106 const auto apply_conditions = [&](const Condition& cond, Node n) -> Node {
107 Node result = n; 107 Node result = n;
108 if (cond.cc != ConditionCode::T) { 108 if (cond.cc != ConditionCode::T) {
109 result = Conditional(GetConditionCode(cond.cc), {result}); 109 result = Conditional(GetConditionCode(cond.cc), {result});
@@ -117,7 +117,7 @@ void ShaderIR::InsertControlFlow(NodeBlock& bb, const ShaderBlock& block) {
117 result = Conditional(GetPredicate(pred, is_neg), {result}); 117 result = Conditional(GetPredicate(pred, is_neg), {result});
118 } 118 }
119 return result; 119 return result;
120 }); 120 };
121 if (block.branch.address < 0) { 121 if (block.branch.address < 0) {
122 if (block.branch.kills) { 122 if (block.branch.kills) {
123 Node n = Operation(OperationCode::Discard); 123 Node n = Operation(OperationCode::Discard);