shader: Fix VertexA Shaders.
This commit is contained in:
parent
ec9a78885e
commit
562af30181
4 changed files with 51 additions and 19 deletions
|
@ -171,20 +171,29 @@ IR::Program MergeDualVertexPrograms(IR::Program& vertex_a, IR::Program& vertex_b
|
|||
IR::Program result{};
|
||||
Optimization::VertexATransformPass(vertex_a);
|
||||
Optimization::VertexBTransformPass(vertex_b);
|
||||
std::swap(result.blocks, vertex_a.blocks);
|
||||
result.blocks.insert(result.blocks.end(), vertex_b.blocks.begin(), vertex_b.blocks.end());
|
||||
for (const auto& term : vertex_a.syntax_list) {
|
||||
if (term.type == IR::AbstractSyntaxNode::Type::Return) {
|
||||
continue;
|
||||
}
|
||||
result.syntax_list.push_back(term);
|
||||
}
|
||||
for (const auto& term : vertex_b.syntax_list) {
|
||||
result.syntax_list.push_back(term);
|
||||
}
|
||||
result.blocks = GenerateBlocks(result.syntax_list);
|
||||
result.post_order_blocks = vertex_b.post_order_blocks;
|
||||
for (const auto& block : vertex_a.post_order_blocks) {
|
||||
result.post_order_blocks.push_back(block);
|
||||
}
|
||||
result.stage = Stage::VertexB;
|
||||
result.info = vertex_a.info;
|
||||
result.local_memory_size = std::max(vertex_a.local_memory_size, vertex_b.local_memory_size);
|
||||
|
||||
for (size_t index = 0; index < 32; ++index) {
|
||||
result.info.input_generics[index].used |= vertex_b.info.input_generics[index].used;
|
||||
result.info.stores_generics[index] |= vertex_b.info.stores_generics[index];
|
||||
}
|
||||
Optimization::JoinTextureInfo(result.info, vertex_b.info);
|
||||
Optimization::JoinStorageInfo(result.info, vertex_b.info);
|
||||
Optimization::DualVertexJoinPass(result);
|
||||
result.post_order_blocks = PostOrder(result.syntax_list.front());
|
||||
Optimization::DeadCodeEliminationPass(result);
|
||||
Optimization::VerificationPass(result);
|
||||
Optimization::CollectShaderInfoPass(env_vertex_b, result);
|
||||
|
|
|
@ -13,16 +13,24 @@
|
|||
|
||||
namespace Shader::Optimization {
|
||||
|
||||
void VertexATransformPass(IR::Program&) {
|
||||
throw NotImplementedException("VertexA pass");
|
||||
void VertexATransformPass(IR::Program& program) {
|
||||
for (IR::Block* const block : program.blocks) {
|
||||
for (IR::Inst& inst : block->Instructions()) {
|
||||
if (inst.GetOpcode() == IR::Opcode::Epilogue) {
|
||||
return inst.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VertexBTransformPass(IR::Program&) {
|
||||
throw NotImplementedException("VertexA pass");
|
||||
}
|
||||
|
||||
void DualVertexJoinPass(IR::Program&) {
|
||||
throw NotImplementedException("VertexA pass");
|
||||
void VertexBTransformPass(IR::Program& program) {
|
||||
for (IR::Block* const block : program.blocks) {
|
||||
for (IR::Inst& inst : block->Instructions()) {
|
||||
if (inst.GetOpcode() == IR::Opcode::Prologue) {
|
||||
return inst.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Shader::Optimization
|
||||
|
|
|
@ -25,7 +25,6 @@ void VerificationPass(const IR::Program& program);
|
|||
// Dual Vertex
|
||||
void VertexATransformPass(IR::Program& program);
|
||||
void VertexBTransformPass(IR::Program& program);
|
||||
void DualVertexJoinPass(IR::Program& program);
|
||||
void JoinTextureInfo(Info& base, Info& source);
|
||||
void JoinStorageInfo(Info& base, Info& source);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue