diff options
Diffstat (limited to 'src/video_core/shader/track.cpp')
| -rw-r--r-- | src/video_core/shader/track.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/video_core/shader/track.cpp b/src/video_core/shader/track.cpp index 435f4facb..d5ed81442 100644 --- a/src/video_core/shader/track.cpp +++ b/src/video_core/shader/track.cpp | |||
| @@ -64,7 +64,8 @@ bool AmendNodeCv(std::size_t amend_index, Node node) { | |||
| 64 | if (const auto operation = std::get_if<OperationNode>(&*node)) { | 64 | if (const auto operation = std::get_if<OperationNode>(&*node)) { |
| 65 | operation->SetAmendIndex(amend_index); | 65 | operation->SetAmendIndex(amend_index); |
| 66 | return true; | 66 | return true; |
| 67 | } else if (const auto conditional = std::get_if<ConditionalNode>(&*node)) { | 67 | } |
| 68 | if (const auto conditional = std::get_if<ConditionalNode>(&*node)) { | ||
| 68 | conditional->SetAmendIndex(amend_index); | 69 | conditional->SetAmendIndex(amend_index); |
| 69 | return true; | 70 | return true; |
| 70 | } | 71 | } |
| @@ -110,10 +111,23 @@ std::pair<Node, TrackSampler> ShaderIR::TrackBindlessSampler(Node tracked, const | |||
| 110 | return TrackBindlessSampler(source, code, new_cursor); | 111 | return TrackBindlessSampler(source, code, new_cursor); |
| 111 | } | 112 | } |
| 112 | if (const auto operation = std::get_if<OperationNode>(&*tracked)) { | 113 | if (const auto operation = std::get_if<OperationNode>(&*tracked)) { |
| 113 | for (std::size_t i = operation->GetOperandsCount(); i > 0; --i) { | 114 | const OperationNode& op = *operation; |
| 114 | if (auto found = TrackBindlessSampler((*operation)[i - 1], code, cursor); | 115 | |
| 115 | std::get<0>(found)) { | 116 | const OperationCode opcode = operation->GetCode(); |
| 116 | // Cbuf found in operand. | 117 | if (opcode == OperationCode::IBitwiseOr || opcode == OperationCode::UBitwiseOr) { |
| 118 | ASSERT(op.GetOperandsCount() == 2); | ||
| 119 | auto [node_a, index_a, offset_a] = TrackCbuf(op[0], code, cursor); | ||
| 120 | auto [node_b, index_b, offset_b] = TrackCbuf(op[1], code, cursor); | ||
| 121 | if (node_a && node_b) { | ||
| 122 | auto track = MakeTrackSampler<SeparateSamplerNode>(std::pair{index_a, index_b}, | ||
| 123 | std::pair{offset_a, offset_b}); | ||
| 124 | return {tracked, std::move(track)}; | ||
| 125 | } | ||
| 126 | } | ||
| 127 | std::size_t i = op.GetOperandsCount(); | ||
| 128 | while (i--) { | ||
| 129 | if (auto found = TrackBindlessSampler(op[i - 1], code, cursor); std::get<0>(found)) { | ||
| 130 | // Constant buffer found in operand. | ||
| 117 | return found; | 131 | return found; |
| 118 | } | 132 | } |
| 119 | } | 133 | } |