diff --git a/lvk/LVK.h b/lvk/LVK.h index 3dd8f7f95b..4127b0a577 100644 --- a/lvk/LVK.h +++ b/lvk/LVK.h @@ -818,6 +818,17 @@ class ICommandBuffer { size_t countBufferOffset, uint32_t maxDrawCount, uint32_t stride = 0) = 0; + virtual void cmdDrawMeshTasks(const Dimensions& threadgroupCount) = 0; + virtual void cmdDrawMeshTasksIndirect(BufferHandle indirectBuffer, + size_t indirectBufferOffset, + uint32_t drawCount, + uint32_t stride = 0) = 0; + virtual void cmdDrawMeshTasksIndirectCount(BufferHandle indirectBuffer, + size_t indirectBufferOffset, + BufferHandle countBuffer, + size_t countBufferOffset, + uint32_t maxDrawCount, + uint32_t stride = 0) = 0; virtual void cmdSetBlendColor(const float color[4]) = 0; virtual void cmdSetDepthBias(float depthBias, float slopeScale, float clamp) = 0; diff --git a/lvk/vulkan/VulkanClasses.cpp b/lvk/vulkan/VulkanClasses.cpp index 9b56c25776..1d718221c6 100644 --- a/lvk/vulkan/VulkanClasses.cpp +++ b/lvk/vulkan/VulkanClasses.cpp @@ -2325,6 +2325,52 @@ void lvk::CommandBuffer::cmdDrawIndexedIndirectCount(BufferHandle indirectBuffer stride ? stride : sizeof(VkDrawIndexedIndirectCommand)); } +void lvk::CommandBuffer::cmdDrawMeshTasks(const Dimensions& threadgroupCount) { + LVK_PROFILER_FUNCTION(); + + vkCmdDrawMeshTasksEXT(wrapper_->cmdBuf_, threadgroupCount.width, threadgroupCount.height, threadgroupCount.depth); +} + +void lvk::CommandBuffer::cmdDrawMeshTasksIndirect(BufferHandle indirectBuffer, + size_t indirectBufferOffset, + uint32_t drawCount, + uint32_t stride) { + LVK_PROFILER_FUNCTION(); + + lvk::VulkanBuffer* bufIndirect = ctx_->buffersPool_.get(indirectBuffer); + + LVK_ASSERT(bufIndirect); + + vkCmdDrawMeshTasksIndirectEXT(wrapper_->cmdBuf_, + bufIndirect->vkBuffer_, + indirectBufferOffset, + drawCount, + stride ? stride : sizeof(VkDrawMeshTasksIndirectCommandEXT)); +} + +void lvk::CommandBuffer::cmdDrawMeshTasksIndirectCount(BufferHandle indirectBuffer, + size_t indirectBufferOffset, + BufferHandle countBuffer, + size_t countBufferOffset, + uint32_t maxDrawCount, + uint32_t stride) { + LVK_PROFILER_FUNCTION(); + + lvk::VulkanBuffer* bufIndirect = ctx_->buffersPool_.get(indirectBuffer); + lvk::VulkanBuffer* bufCount = ctx_->buffersPool_.get(countBuffer); + + LVK_ASSERT(bufIndirect); + LVK_ASSERT(bufCount); + + vkCmdDrawMeshTasksIndirectCountEXT(wrapper_->cmdBuf_, + bufIndirect->vkBuffer_, + indirectBufferOffset, + bufCount->vkBuffer_, + countBufferOffset, + maxDrawCount, + stride ? stride : sizeof(VkDrawMeshTasksIndirectCommandEXT)); +} + void lvk::CommandBuffer::cmdSetBlendColor(const float color[4]) { vkCmdSetBlendConstants(wrapper_->cmdBuf_, color); } diff --git a/lvk/vulkan/VulkanClasses.h b/lvk/vulkan/VulkanClasses.h index 3886662b2d..33cab59ec0 100644 --- a/lvk/vulkan/VulkanClasses.h +++ b/lvk/vulkan/VulkanClasses.h @@ -338,6 +338,14 @@ class CommandBuffer final : public ICommandBuffer { size_t countBufferOffset, uint32_t maxDrawCount, uint32_t stride = 0) override; + void cmdDrawMeshTasks(const Dimensions& threadgroupCount) override; + void cmdDrawMeshTasksIndirect(BufferHandle indirectBuffer, size_t indirectBufferOffset, uint32_t drawCount, uint32_t stride = 0) override; + void cmdDrawMeshTasksIndirectCount(BufferHandle indirectBuffer, + size_t indirectBufferOffset, + BufferHandle countBuffer, + size_t countBufferOffset, + uint32_t maxDrawCount, + uint32_t stride = 0) override; void cmdSetBlendColor(const float color[4]) override; void cmdSetDepthBias(float depthBias, float slopeScale, float clamp) override;