diff options
author | Philip Rebohle <philip.rebohle@tu-dortmund.de> | 2022-02-23 20:53:07 +0300 |
---|---|---|
committer | Philip Rebohle <philip.rebohle@tu-dortmund.de> | 2022-09-02 12:42:43 +0300 |
commit | 4aec8d9e653f7970e726d95be98dfa64934479e3 (patch) | |
tree | 62ade1f6c0b8d8eb602a7c07fc6e2bdb912302cc | |
parent | 010b05f650346a759eeb47b91d98d0d5e11f0515 (diff) |
Implement GetMeshPayload opcode.
-rw-r--r-- | opcodes/dxil/dxil_mesh.cpp | 10 | ||||
-rw-r--r-- | opcodes/dxil/dxil_mesh.hpp | 1 | ||||
-rw-r--r-- | opcodes/opcodes_dxil_builtins.cpp | 1 |
3 files changed, 12 insertions, 0 deletions
diff --git a/opcodes/dxil/dxil_mesh.cpp b/opcodes/dxil/dxil_mesh.cpp index b73ae68..f925cdf 100644 --- a/opcodes/dxil/dxil_mesh.cpp +++ b/opcodes/dxil/dxil_mesh.cpp @@ -176,4 +176,14 @@ bool emit_dispatch_mesh_instruction(Converter::Impl &impl, const llvm::CallInst return true; } +bool emit_get_mesh_payload_instruction(Converter::Impl &impl, const llvm::CallInst *instruction) +{ + // GetMeshPayload can only be called once per shader + spv::Id type_id = impl.get_type_id(instruction->getType()->getPointerElementType()); + spv::Id var_id = impl.create_variable(spv::StorageClassTaskPayloadWorkgroupEXT, type_id); + + impl.rewrite_value(instruction, var_id); + return true; +} + } // namespace dxil_spv diff --git a/opcodes/dxil/dxil_mesh.hpp b/opcodes/dxil/dxil_mesh.hpp index 7708e4a..3638647 100644 --- a/opcodes/dxil/dxil_mesh.hpp +++ b/opcodes/dxil/dxil_mesh.hpp @@ -33,4 +33,5 @@ bool emit_emit_indices_instruction(Converter::Impl &impl, const llvm::CallInst * bool emit_store_vertex_output_instruction(Converter::Impl &impl, const llvm::CallInst *instruction); bool emit_store_primitive_output_instruction(Converter::Impl &impl, const llvm::CallInst *instruction); bool emit_dispatch_mesh_instruction(Converter::Impl &impl, const llvm::CallInst *instruction); +bool emit_get_mesh_payload_instruction(Converter::Impl &impl, const llvm::CallInst *instruction); } // namespace dxil_spv diff --git a/opcodes/opcodes_dxil_builtins.cpp b/opcodes/opcodes_dxil_builtins.cpp index 488abfb..c180775 100644 --- a/opcodes/opcodes_dxil_builtins.cpp +++ b/opcodes/opcodes_dxil_builtins.cpp @@ -339,6 +339,7 @@ struct DXILDispatcher // dxil_mesh.cpp OP(SetMeshOutputCounts) = emit_set_mesh_output_counts_instruction; OP(EmitIndices) = emit_emit_indices_instruction; + OP(GetMeshPayload) = emit_get_mesh_payload_instruction; OP(StoreVertexOutput) = emit_store_vertex_output_instruction; OP(StorePrimitiveOutput) = emit_store_primitive_output_instruction; OP(DispatchMesh) = emit_dispatch_mesh_instruction; |