shader: Implement VertexA stage
This commit is contained in:
parent
da936d6ad8
commit
b541f5e5e3
12 changed files with 180 additions and 3 deletions
|
@ -61,6 +61,7 @@ bool Inst::MayHaveSideEffects() const noexcept {
|
|||
case Opcode::LoopMerge:
|
||||
case Opcode::SelectionMerge:
|
||||
case Opcode::Return:
|
||||
case Opcode::Join:
|
||||
case Opcode::Unreachable:
|
||||
case Opcode::DemoteToHelperInvocation:
|
||||
case Opcode::Barrier:
|
||||
|
|
|
@ -13,6 +13,7 @@ OPCODE(BranchConditional, Void, U1,
|
|||
OPCODE(LoopMerge, Void, Label, Label, )
|
||||
OPCODE(SelectionMerge, Void, Label, )
|
||||
OPCODE(Return, Void, )
|
||||
OPCODE(Join, Void, )
|
||||
OPCODE(Unreachable, Void, )
|
||||
OPCODE(DemoteToHelperInvocation, Void, Label, )
|
||||
|
||||
|
|
|
@ -150,4 +150,32 @@ IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Blo
|
|||
return program;
|
||||
}
|
||||
|
||||
IR::Program MergeDualVertexPrograms(IR::Program& vertex_a, IR::Program& vertex_b,
|
||||
Environment& env2) {
|
||||
IR::Program program{};
|
||||
Optimization::VertexATransformPass(vertex_a);
|
||||
Optimization::VertexBTransformPass(vertex_b);
|
||||
program.blocks.swap(vertex_a.blocks);
|
||||
for (IR::Block* block : vertex_b.blocks) {
|
||||
program.blocks.push_back(block);
|
||||
}
|
||||
program.stage = Stage::VertexB;
|
||||
program.info = vertex_a.info;
|
||||
program.local_memory_size = std::max(vertex_a.local_memory_size, vertex_b.local_memory_size);
|
||||
|
||||
for (size_t index = 0; index < 32; index++) {
|
||||
program.info.input_generics[index].used |= vertex_b.info.input_generics[index].used;
|
||||
program.info.stores_generics[index] |= vertex_b.info.stores_generics[index];
|
||||
}
|
||||
Optimization::JoinTextureInfo(program.info, vertex_b.info);
|
||||
Optimization::JoinStorageInfo(program.info, vertex_b.info);
|
||||
Optimization::DualVertexJoinPass(program);
|
||||
program.post_order_blocks = PostOrder(program.blocks);
|
||||
Optimization::DeadCodeEliminationPass(program);
|
||||
Optimization::IdentityRemovalPass(program);
|
||||
Optimization::VerificationPass(program);
|
||||
Optimization::CollectShaderInfoPass(env2, program);
|
||||
return program;
|
||||
}
|
||||
|
||||
} // namespace Shader::Maxwell
|
||||
|
|
|
@ -21,4 +21,6 @@ namespace Shader::Maxwell {
|
|||
ObjectPool<IR::Block>& block_pool, Environment& env,
|
||||
Flow::CFG& cfg);
|
||||
|
||||
[[nodiscard]] IR::Program MergeDualVertexPrograms(IR::Program& vertex_a, IR::Program& vertex_b,
|
||||
Environment& env_vertex_b);
|
||||
} // namespace Shader::Maxwell
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue