summaryrefslogtreecommitdiff
path: root/src/video_core/shader/track.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/shader/track.cpp')
-rw-r--r--src/video_core/shader/track.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/video_core/shader/track.cpp b/src/video_core/shader/track.cpp
index 19ede1eb9..fc957d980 100644
--- a/src/video_core/shader/track.cpp
+++ b/src/video_core/shader/track.cpp
@@ -16,12 +16,12 @@ std::pair<Node, s64> FindOperation(const NodeBlock& code, s64 cursor,
16 OperationCode operation_code) { 16 OperationCode operation_code) {
17 for (; cursor >= 0; --cursor) { 17 for (; cursor >= 0; --cursor) {
18 const Node node = code.at(cursor); 18 const Node node = code.at(cursor);
19 if (const auto operation = std::get_if<OperationNode>(node)) { 19 if (const auto operation = std::get_if<OperationNode>(&*node)) {
20 if (operation->GetCode() == operation_code) { 20 if (operation->GetCode() == operation_code) {
21 return {node, cursor}; 21 return {node, cursor};
22 } 22 }
23 } 23 }
24 if (const auto conditional = std::get_if<ConditionalNode>(node)) { 24 if (const auto conditional = std::get_if<ConditionalNode>(&*node)) {
25 const auto& conditional_code = conditional->GetCode(); 25 const auto& conditional_code = conditional->GetCode();
26 const auto [found, internal_cursor] = FindOperation( 26 const auto [found, internal_cursor] = FindOperation(
27 conditional_code, static_cast<s64>(conditional_code.size() - 1), operation_code); 27 conditional_code, static_cast<s64>(conditional_code.size() - 1), operation_code);
@@ -35,11 +35,11 @@ std::pair<Node, s64> FindOperation(const NodeBlock& code, s64 cursor,
35} // namespace 35} // namespace
36 36
37Node ShaderIR::TrackCbuf(Node tracked, const NodeBlock& code, s64 cursor) const { 37Node ShaderIR::TrackCbuf(Node tracked, const NodeBlock& code, s64 cursor) const {
38 if (const auto cbuf = std::get_if<CbufNode>(tracked)) { 38 if (const auto cbuf = std::get_if<CbufNode>(&*tracked)) {
39 // Cbuf found, but it has to be immediate 39 // Cbuf found, but it has to be immediate
40 return std::holds_alternative<ImmediateNode>(*cbuf->GetOffset()) ? tracked : nullptr; 40 return std::holds_alternative<ImmediateNode>(*cbuf->GetOffset()) ? tracked : nullptr;
41 } 41 }
42 if (const auto gpr = std::get_if<GprNode>(tracked)) { 42 if (const auto gpr = std::get_if<GprNode>(&*tracked)) {
43 if (gpr->GetIndex() == Tegra::Shader::Register::ZeroIndex) { 43 if (gpr->GetIndex() == Tegra::Shader::Register::ZeroIndex) {
44 return nullptr; 44 return nullptr;
45 } 45 }
@@ -51,7 +51,7 @@ Node ShaderIR::TrackCbuf(Node tracked, const NodeBlock& code, s64 cursor) const
51 } 51 }
52 return TrackCbuf(source, code, new_cursor); 52 return TrackCbuf(source, code, new_cursor);
53 } 53 }
54 if (const auto operation = std::get_if<OperationNode>(tracked)) { 54 if (const auto operation = std::get_if<OperationNode>(&*tracked)) {
55 for (std::size_t i = 0; i < operation->GetOperandsCount(); ++i) { 55 for (std::size_t i = 0; i < operation->GetOperandsCount(); ++i) {
56 if (const auto found = TrackCbuf((*operation)[i], code, cursor)) { 56 if (const auto found = TrackCbuf((*operation)[i], code, cursor)) {
57 // Cbuf found in operand 57 // Cbuf found in operand
@@ -60,7 +60,7 @@ Node ShaderIR::TrackCbuf(Node tracked, const NodeBlock& code, s64 cursor) const
60 } 60 }
61 return nullptr; 61 return nullptr;
62 } 62 }
63 if (const auto conditional = std::get_if<ConditionalNode>(tracked)) { 63 if (const auto conditional = std::get_if<ConditionalNode>(&*tracked)) {
64 const auto& conditional_code = conditional->GetCode(); 64 const auto& conditional_code = conditional->GetCode();
65 return TrackCbuf(tracked, conditional_code, static_cast<s64>(conditional_code.size())); 65 return TrackCbuf(tracked, conditional_code, static_cast<s64>(conditional_code.size()));
66 } 66 }
@@ -75,7 +75,7 @@ std::optional<u32> ShaderIR::TrackImmediate(Node tracked, const NodeBlock& code,
75 if (!found) { 75 if (!found) {
76 return {}; 76 return {};
77 } 77 }
78 if (const auto immediate = std::get_if<ImmediateNode>(found)) { 78 if (const auto immediate = std::get_if<ImmediateNode>(&*found)) {
79 return immediate->GetValue(); 79 return immediate->GetValue();
80 } 80 }
81 return {}; 81 return {};
@@ -88,11 +88,11 @@ std::pair<Node, s64> ShaderIR::TrackRegister(const GprNode* tracked, const NodeB
88 if (!found_node) { 88 if (!found_node) {
89 return {}; 89 return {};
90 } 90 }
91 const auto operation = std::get_if<OperationNode>(found_node); 91 const auto operation = std::get_if<OperationNode>(&*found_node);
92 ASSERT(operation); 92 ASSERT(operation);
93 93
94 const auto& target = (*operation)[0]; 94 const auto& target = (*operation)[0];
95 if (const auto gpr_target = std::get_if<GprNode>(target)) { 95 if (const auto gpr_target = std::get_if<GprNode>(&*target)) {
96 if (gpr_target->GetIndex() == tracked->GetIndex()) { 96 if (gpr_target->GetIndex() == tracked->GetIndex()) {
97 return {(*operation)[1], new_cursor}; 97 return {(*operation)[1], new_cursor};
98 } 98 }