diff options
Diffstat (limited to 'src/video_core/shader/track.cpp')
| -rw-r--r-- | src/video_core/shader/track.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/video_core/shader/track.cpp b/src/video_core/shader/track.cpp index d6d29ee9f..be4635342 100644 --- a/src/video_core/shader/track.cpp +++ b/src/video_core/shader/track.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | namespace VideoCommon::Shader { | 11 | namespace VideoCommon::Shader { |
| 12 | 12 | ||
| 13 | namespace { | 13 | namespace { |
| 14 | std::pair<Node, s64> FindOperation(const BasicBlock& code, s64 cursor, | 14 | std::pair<Node, s64> FindOperation(const NodeBlock& code, s64 cursor, |
| 15 | OperationCode operation_code) { | 15 | OperationCode operation_code) { |
| 16 | for (; cursor >= 0; --cursor) { | 16 | for (; cursor >= 0; --cursor) { |
| 17 | const Node node = code[cursor]; | 17 | const Node node = code[cursor]; |
| @@ -19,12 +19,19 @@ std::pair<Node, s64> FindOperation(const BasicBlock& code, s64 cursor, | |||
| 19 | if (operation->GetCode() == operation_code) | 19 | if (operation->GetCode() == operation_code) |
| 20 | return {node, cursor}; | 20 | return {node, cursor}; |
| 21 | } | 21 | } |
| 22 | if (const auto conditional = std::get_if<ConditionalNode>(node)) { | ||
| 23 | const auto& code = conditional->GetCode(); | ||
| 24 | const auto [found, internal_cursor] = | ||
| 25 | FindOperation(code, static_cast<s64>(code.size() - 1), operation_code); | ||
| 26 | if (found) | ||
| 27 | return {found, cursor}; | ||
| 28 | } | ||
| 22 | } | 29 | } |
| 23 | return {}; | 30 | return {}; |
| 24 | } | 31 | } |
| 25 | } // namespace | 32 | } // namespace |
| 26 | 33 | ||
| 27 | Node ShaderIR::TrackCbuf(Node tracked, const BasicBlock& code, s64 cursor) { | 34 | Node ShaderIR::TrackCbuf(Node tracked, const NodeBlock& code, s64 cursor) { |
| 28 | if (const auto cbuf = std::get_if<CbufNode>(tracked)) { | 35 | if (const auto cbuf = std::get_if<CbufNode>(tracked)) { |
| 29 | // Cbuf found, but it has to be immediate | 36 | // Cbuf found, but it has to be immediate |
| 30 | return std::holds_alternative<ImmediateNode>(*cbuf->GetOffset()) ? tracked : nullptr; | 37 | return std::holds_alternative<ImmediateNode>(*cbuf->GetOffset()) ? tracked : nullptr; |
| @@ -50,10 +57,14 @@ Node ShaderIR::TrackCbuf(Node tracked, const BasicBlock& code, s64 cursor) { | |||
| 50 | } | 57 | } |
| 51 | return nullptr; | 58 | return nullptr; |
| 52 | } | 59 | } |
| 60 | if (const auto conditional = std::get_if<ConditionalNode>(tracked)) { | ||
| 61 | const auto& code = conditional->GetCode(); | ||
| 62 | return TrackCbuf(tracked, code, static_cast<s64>(code.size())); | ||
| 63 | } | ||
| 53 | return nullptr; | 64 | return nullptr; |
| 54 | } | 65 | } |
| 55 | 66 | ||
| 56 | std::pair<Node, s64> ShaderIR::TrackRegister(const GprNode* tracked, const BasicBlock& code, | 67 | std::pair<Node, s64> ShaderIR::TrackRegister(const GprNode* tracked, const NodeBlock& code, |
| 57 | s64 cursor) { | 68 | s64 cursor) { |
| 58 | for (; cursor >= 0; --cursor) { | 69 | for (; cursor >= 0; --cursor) { |
| 59 | const auto [found_node, new_cursor] = FindOperation(code, cursor, OperationCode::Assign); | 70 | const auto [found_node, new_cursor] = FindOperation(code, cursor, OperationCode::Assign); |