diff options
| author | 2020-04-19 01:22:47 -0400 | |
|---|---|---|
| committer | 2020-04-19 01:22:47 -0400 | |
| commit | 73db83c0ab783821167233622a4e64bad0a5e807 (patch) | |
| tree | 8eef2b0fcb6a35a111018c45e87a28c44e46946b /src | |
| parent | Merge pull request #3720 from jbeich/freebsd (diff) | |
| parent | track: Eliminate redundant copies (diff) | |
| download | yuzu-73db83c0ab783821167233622a4e64bad0a5e807.tar.gz yuzu-73db83c0ab783821167233622a4e64bad0a5e807.tar.xz yuzu-73db83c0ab783821167233622a4e64bad0a5e807.zip | |
Merge pull request #3679 from lioncash/track
track: Eliminate redundant copies
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/shader/track.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/video_core/shader/track.cpp b/src/video_core/shader/track.cpp index 224943ad9..513e9bf49 100644 --- a/src/video_core/shader/track.cpp +++ b/src/video_core/shader/track.cpp | |||
| @@ -76,12 +76,13 @@ std::tuple<Node, TrackSampler> ShaderIR::TrackBindlessSampler(Node tracked, cons | |||
| 76 | s64 cursor) { | 76 | s64 cursor) { |
| 77 | if (const auto cbuf = std::get_if<CbufNode>(&*tracked)) { | 77 | if (const auto cbuf = std::get_if<CbufNode>(&*tracked)) { |
| 78 | // Constant buffer found, test if it's an immediate | 78 | // Constant buffer found, test if it's an immediate |
| 79 | const auto offset = cbuf->GetOffset(); | 79 | const auto& offset = cbuf->GetOffset(); |
| 80 | if (const auto immediate = std::get_if<ImmediateNode>(&*offset)) { | 80 | if (const auto immediate = std::get_if<ImmediateNode>(&*offset)) { |
| 81 | auto track = | 81 | auto track = |
| 82 | MakeTrackSampler<BindlessSamplerNode>(cbuf->GetIndex(), immediate->GetValue()); | 82 | MakeTrackSampler<BindlessSamplerNode>(cbuf->GetIndex(), immediate->GetValue()); |
| 83 | return {tracked, track}; | 83 | return {tracked, track}; |
| 84 | } else if (const auto operation = std::get_if<OperationNode>(&*offset)) { | 84 | } |
| 85 | if (const auto operation = std::get_if<OperationNode>(&*offset)) { | ||
| 85 | const u32 bound_buffer = registry.GetBoundBuffer(); | 86 | const u32 bound_buffer = registry.GetBoundBuffer(); |
| 86 | if (bound_buffer != cbuf->GetIndex()) { | 87 | if (bound_buffer != cbuf->GetIndex()) { |
| 87 | return {}; | 88 | return {}; |
| @@ -94,12 +95,12 @@ std::tuple<Node, TrackSampler> ShaderIR::TrackBindlessSampler(Node tracked, cons | |||
| 94 | const auto offset_inm = std::get_if<ImmediateNode>(&*base_offset); | 95 | const auto offset_inm = std::get_if<ImmediateNode>(&*base_offset); |
| 95 | const auto& gpu_driver = registry.AccessGuestDriverProfile(); | 96 | const auto& gpu_driver = registry.AccessGuestDriverProfile(); |
| 96 | const u32 bindless_cv = NewCustomVariable(); | 97 | const u32 bindless_cv = NewCustomVariable(); |
| 97 | const Node op = | 98 | Node op = |
| 98 | Operation(OperationCode::UDiv, gpr, Immediate(gpu_driver.GetTextureHandlerSize())); | 99 | Operation(OperationCode::UDiv, gpr, Immediate(gpu_driver.GetTextureHandlerSize())); |
| 99 | 100 | ||
| 100 | const Node cv_node = GetCustomVariable(bindless_cv); | 101 | const Node cv_node = GetCustomVariable(bindless_cv); |
| 101 | Node amend_op = Operation(OperationCode::Assign, cv_node, std::move(op)); | 102 | Node amend_op = Operation(OperationCode::Assign, cv_node, std::move(op)); |
| 102 | const std::size_t amend_index = DeclareAmend(amend_op); | 103 | const std::size_t amend_index = DeclareAmend(std::move(amend_op)); |
| 103 | AmendNodeCv(amend_index, code[cursor]); | 104 | AmendNodeCv(amend_index, code[cursor]); |
| 104 | // TODO Implement Bindless Index custom variable | 105 | // TODO Implement Bindless Index custom variable |
| 105 | auto track = MakeTrackSampler<ArraySamplerNode>(cbuf->GetIndex(), | 106 | auto track = MakeTrackSampler<ArraySamplerNode>(cbuf->GetIndex(), |
| @@ -142,7 +143,7 @@ std::tuple<Node, u32, u32> ShaderIR::TrackCbuf(Node tracked, const NodeBlock& co | |||
| 142 | s64 cursor) const { | 143 | s64 cursor) const { |
| 143 | if (const auto cbuf = std::get_if<CbufNode>(&*tracked)) { | 144 | if (const auto cbuf = std::get_if<CbufNode>(&*tracked)) { |
| 144 | // Constant buffer found, test if it's an immediate | 145 | // Constant buffer found, test if it's an immediate |
| 145 | const auto offset = cbuf->GetOffset(); | 146 | const auto& offset = cbuf->GetOffset(); |
| 146 | if (const auto immediate = std::get_if<ImmediateNode>(&*offset)) { | 147 | if (const auto immediate = std::get_if<ImmediateNode>(&*offset)) { |
| 147 | return {tracked, cbuf->GetIndex(), immediate->GetValue()}; | 148 | return {tracked, cbuf->GetIndex(), immediate->GetValue()}; |
| 148 | } | 149 | } |