summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/maxwell
diff options
context:
space:
mode:
authorGravatar FernandoS272021-06-04 00:11:16 +0200
committerGravatar ameerj2021-07-22 21:51:34 -0400
commit562af301819227d65a251a2c29c997bf798da7ba (patch)
tree00199eb2c9c34d78430d88e40bd5b27f585daeec /src/shader_recompiler/frontend/maxwell
parentshader: Add 2D and 3D variants to SUATOM and SURED (diff)
downloadyuzu-562af301819227d65a251a2c29c997bf798da7ba.tar.gz
yuzu-562af301819227d65a251a2c29c997bf798da7ba.tar.xz
yuzu-562af301819227d65a251a2c29c997bf798da7ba.zip
shader: Fix VertexA Shaders.
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell')
-rw-r--r--src/shader_recompiler/frontend/maxwell/program.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/program.cpp b/src/shader_recompiler/frontend/maxwell/program.cpp
index 900fc7ab1..8489f9a5f 100644
--- a/src/shader_recompiler/frontend/maxwell/program.cpp
+++ b/src/shader_recompiler/frontend/maxwell/program.cpp
@@ -171,20 +171,29 @@ IR::Program MergeDualVertexPrograms(IR::Program& vertex_a, IR::Program& vertex_b
171 IR::Program result{}; 171 IR::Program result{};
172 Optimization::VertexATransformPass(vertex_a); 172 Optimization::VertexATransformPass(vertex_a);
173 Optimization::VertexBTransformPass(vertex_b); 173 Optimization::VertexBTransformPass(vertex_b);
174 std::swap(result.blocks, vertex_a.blocks); 174 for (const auto& term : vertex_a.syntax_list) {
175 result.blocks.insert(result.blocks.end(), vertex_b.blocks.begin(), vertex_b.blocks.end()); 175 if (term.type == IR::AbstractSyntaxNode::Type::Return) {
176 continue;
177 }
178 result.syntax_list.push_back(term);
179 }
180 for (const auto& term : vertex_b.syntax_list) {
181 result.syntax_list.push_back(term);
182 }
183 result.blocks = GenerateBlocks(result.syntax_list);
184 result.post_order_blocks = vertex_b.post_order_blocks;
185 for (const auto& block : vertex_a.post_order_blocks) {
186 result.post_order_blocks.push_back(block);
187 }
176 result.stage = Stage::VertexB; 188 result.stage = Stage::VertexB;
177 result.info = vertex_a.info; 189 result.info = vertex_a.info;
178 result.local_memory_size = std::max(vertex_a.local_memory_size, vertex_b.local_memory_size); 190 result.local_memory_size = std::max(vertex_a.local_memory_size, vertex_b.local_memory_size);
179
180 for (size_t index = 0; index < 32; ++index) { 191 for (size_t index = 0; index < 32; ++index) {
181 result.info.input_generics[index].used |= vertex_b.info.input_generics[index].used; 192 result.info.input_generics[index].used |= vertex_b.info.input_generics[index].used;
182 result.info.stores_generics[index] |= vertex_b.info.stores_generics[index]; 193 result.info.stores_generics[index] |= vertex_b.info.stores_generics[index];
183 } 194 }
184 Optimization::JoinTextureInfo(result.info, vertex_b.info); 195 Optimization::JoinTextureInfo(result.info, vertex_b.info);
185 Optimization::JoinStorageInfo(result.info, vertex_b.info); 196 Optimization::JoinStorageInfo(result.info, vertex_b.info);
186 Optimization::DualVertexJoinPass(result);
187 result.post_order_blocks = PostOrder(result.syntax_list.front());
188 Optimization::DeadCodeEliminationPass(result); 197 Optimization::DeadCodeEliminationPass(result);
189 Optimization::VerificationPass(result); 198 Optimization::VerificationPass(result);
190 Optimization::CollectShaderInfoPass(env_vertex_b, result); 199 Optimization::CollectShaderInfoPass(env_vertex_b, result);