diff options
| author | 2021-05-01 14:56:25 +0200 | |
|---|---|---|
| committer | 2021-07-22 21:51:29 -0400 | |
| commit | c49d56c931471f21d475a31272164fbfae5ea64a (patch) | |
| tree | 71642406f4df7963ea78c55acf622bdf5b85a595 /src/shader_recompiler/frontend | |
| parent | shader: Implement VertexA stage (diff) | |
| download | yuzu-c49d56c931471f21d475a31272164fbfae5ea64a.tar.gz yuzu-c49d56c931471f21d475a31272164fbfae5ea64a.tar.xz yuzu-c49d56c931471f21d475a31272164fbfae5ea64a.zip | |
shader: Address feedback
Diffstat (limited to 'src/shader_recompiler/frontend')
| -rw-r--r-- | src/shader_recompiler/frontend/maxwell/control_flow.cpp | 10 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/maxwell/program.cpp | 37 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/maxwell/program.h | 1 |
3 files changed, 24 insertions, 24 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/control_flow.cpp b/src/shader_recompiler/frontend/maxwell/control_flow.cpp index 298faa03e..e7abea82f 100644 --- a/src/shader_recompiler/frontend/maxwell/control_flow.cpp +++ b/src/shader_recompiler/frontend/maxwell/control_flow.cpp | |||
| @@ -209,9 +209,9 @@ CFG::CFG(Environment& env_, ObjectPool<Block>& block_pool_, Location start_addre | |||
| 209 | } | 209 | } |
| 210 | } | 210 | } |
| 211 | if (exits_to_dispatcher) { | 211 | if (exits_to_dispatcher) { |
| 212 | const auto it = functions[0].blocks.rbegin(); | 212 | const auto last_block{functions[0].blocks.rbegin()}; |
| 213 | dispatch_block->begin = it->end + 1; | 213 | dispatch_block->begin = last_block->end + 1; |
| 214 | dispatch_block->end = it->end + 1; | 214 | dispatch_block->end = last_block->end + 1; |
| 215 | functions[0].blocks.insert(*dispatch_block); | 215 | functions[0].blocks.insert(*dispatch_block); |
| 216 | } | 216 | } |
| 217 | } | 217 | } |
| @@ -481,7 +481,7 @@ CFG::AnalysisState CFG::AnalyzeEXIT(Block* block, FunctionId function_id, Locati | |||
| 481 | return AnalysisState::Continue; | 481 | return AnalysisState::Continue; |
| 482 | } | 482 | } |
| 483 | if (exits_to_dispatcher && function_id != 0) { | 483 | if (exits_to_dispatcher && function_id != 0) { |
| 484 | throw NotImplementedException("Dispatch EXIT on external function."); | 484 | throw NotImplementedException("Dispatch EXIT on external function"); |
| 485 | } | 485 | } |
| 486 | if (pred != Predicate{true} || flow_test != IR::FlowTest::T) { | 486 | if (pred != Predicate{true} || flow_test != IR::FlowTest::T) { |
| 487 | if (block->stack.Peek(Token::PEXIT).has_value()) { | 487 | if (block->stack.Peek(Token::PEXIT).has_value()) { |
| @@ -490,9 +490,9 @@ CFG::AnalysisState CFG::AnalyzeEXIT(Block* block, FunctionId function_id, Locati | |||
| 490 | const IR::Condition cond{flow_test, static_cast<IR::Pred>(pred.index), pred.negated}; | 490 | const IR::Condition cond{flow_test, static_cast<IR::Pred>(pred.index), pred.negated}; |
| 491 | if (exits_to_dispatcher) { | 491 | if (exits_to_dispatcher) { |
| 492 | block->end = pc; | 492 | block->end = pc; |
| 493 | block->branch_true = dispatch_block; | ||
| 494 | block->end_class = EndClass::Branch; | 493 | block->end_class = EndClass::Branch; |
| 495 | block->cond = cond; | 494 | block->cond = cond; |
| 495 | block->branch_true = dispatch_block; | ||
| 496 | block->branch_false = AddLabel(block, block->stack, pc + 1, function_id); | 496 | block->branch_false = AddLabel(block, block->stack, pc + 1, function_id); |
| 497 | return AnalysisState::Branch; | 497 | return AnalysisState::Branch; |
| 498 | } | 498 | } |
diff --git a/src/shader_recompiler/frontend/maxwell/program.cpp b/src/shader_recompiler/frontend/maxwell/program.cpp index 59897cb3e..a4fa4319d 100644 --- a/src/shader_recompiler/frontend/maxwell/program.cpp +++ b/src/shader_recompiler/frontend/maxwell/program.cpp | |||
| @@ -151,31 +151,30 @@ IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Blo | |||
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | IR::Program MergeDualVertexPrograms(IR::Program& vertex_a, IR::Program& vertex_b, | 153 | IR::Program MergeDualVertexPrograms(IR::Program& vertex_a, IR::Program& vertex_b, |
| 154 | Environment& env2) { | 154 | Environment& env_vertex_b) { |
| 155 | IR::Program program{}; | 155 | IR::Program result{}; |
| 156 | Optimization::VertexATransformPass(vertex_a); | 156 | Optimization::VertexATransformPass(vertex_a); |
| 157 | Optimization::VertexBTransformPass(vertex_b); | 157 | Optimization::VertexBTransformPass(vertex_b); |
| 158 | program.blocks.swap(vertex_a.blocks); | 158 | std::swap(result.blocks, vertex_a.blocks); |
| 159 | for (IR::Block* block : vertex_b.blocks) { | 159 | for (IR::Block* block : vertex_b.blocks) { |
| 160 | program.blocks.push_back(block); | 160 | result.blocks.push_back(block); |
| 161 | } | 161 | } |
| 162 | program.stage = Stage::VertexB; | 162 | result.stage = Stage::VertexB; |
| 163 | program.info = vertex_a.info; | 163 | result.info = vertex_a.info; |
| 164 | program.local_memory_size = std::max(vertex_a.local_memory_size, vertex_b.local_memory_size); | 164 | result.local_memory_size = std::max(vertex_a.local_memory_size, vertex_b.local_memory_size); |
| 165 | 165 | ||
| 166 | for (size_t index = 0; index < 32; index++) { | 166 | for (size_t index = 0; index < 32; ++index) { |
| 167 | program.info.input_generics[index].used |= vertex_b.info.input_generics[index].used; | 167 | result.info.input_generics[index].used |= vertex_b.info.input_generics[index].used; |
| 168 | program.info.stores_generics[index] |= vertex_b.info.stores_generics[index]; | 168 | result.info.stores_generics[index] |= vertex_b.info.stores_generics[index]; |
| 169 | } | 169 | } |
| 170 | Optimization::JoinTextureInfo(program.info, vertex_b.info); | 170 | Optimization::JoinTextureInfo(result.info, vertex_b.info); |
| 171 | Optimization::JoinStorageInfo(program.info, vertex_b.info); | 171 | Optimization::JoinStorageInfo(result.info, vertex_b.info); |
| 172 | Optimization::DualVertexJoinPass(program); | 172 | Optimization::DualVertexJoinPass(result); |
| 173 | program.post_order_blocks = PostOrder(program.blocks); | 173 | result.post_order_blocks = PostOrder(result.blocks); |
| 174 | Optimization::DeadCodeEliminationPass(program); | 174 | Optimization::DeadCodeEliminationPass(result); |
| 175 | Optimization::IdentityRemovalPass(program); | 175 | Optimization::VerificationPass(result); |
| 176 | Optimization::VerificationPass(program); | 176 | Optimization::CollectShaderInfoPass(env_vertex_b, result); |
| 177 | Optimization::CollectShaderInfoPass(env2, program); | 177 | return result; |
| 178 | return program; | ||
| 179 | } | 178 | } |
| 180 | 179 | ||
| 181 | } // namespace Shader::Maxwell | 180 | } // namespace Shader::Maxwell |
diff --git a/src/shader_recompiler/frontend/maxwell/program.h b/src/shader_recompiler/frontend/maxwell/program.h index 6e5d5ddd0..f7f5930e4 100644 --- a/src/shader_recompiler/frontend/maxwell/program.h +++ b/src/shader_recompiler/frontend/maxwell/program.h | |||
| @@ -23,4 +23,5 @@ namespace Shader::Maxwell { | |||
| 23 | 23 | ||
| 24 | [[nodiscard]] IR::Program MergeDualVertexPrograms(IR::Program& vertex_a, IR::Program& vertex_b, | 24 | [[nodiscard]] IR::Program MergeDualVertexPrograms(IR::Program& vertex_a, IR::Program& vertex_b, |
| 25 | Environment& env_vertex_b); | 25 | Environment& env_vertex_b); |
| 26 | |||
| 26 | } // namespace Shader::Maxwell | 27 | } // namespace Shader::Maxwell |