diff --git a/include/vkcv/Context.hpp b/include/vkcv/Context.hpp index be6933996cbd1c352d9c45e60a9971444e686ffb..15e06316f048a2d25936db1656d18c6d26e6e515 100644 --- a/include/vkcv/Context.hpp +++ b/include/vkcv/Context.hpp @@ -3,6 +3,7 @@ #include <vulkan/vulkan.hpp> #include "QueueManager.hpp" +#include "DrawcallRecording.hpp" namespace vkcv { diff --git a/include/vkcv/DrawcallRecording.hpp b/include/vkcv/DrawcallRecording.hpp index e1526689706cf190eb448cd8729172d23501b1a6..50fb08460047fe69469d58e145730d5f70dfdcca 100644 --- a/include/vkcv/DrawcallRecording.hpp +++ b/include/vkcv/DrawcallRecording.hpp @@ -51,8 +51,10 @@ namespace vkcv { const PushConstantData &pushConstantData, const size_t drawcallIndex); + void InitMeshShaderDrawFunctions(vk::Device device); + struct MeshShaderDrawcall { - inline MeshShaderDrawcall(const std::vector<DescriptorSetUsage> descriptorSets, uint32_t taskCout) + inline MeshShaderDrawcall(const std::vector<DescriptorSetUsage> descriptorSets, uint32_t taskCount) : descriptorSets(descriptorSets), taskCount(taskCount) {} std::vector<DescriptorSetUsage> descriptorSets; diff --git a/src/vkcv/Context.cpp b/src/vkcv/Context.cpp index 49aea650cd2d5a9528145cadc2fda5fc72a0222b..8f6efea22f56adfe9c2b9dcce3ef3bdc65cecee2 100644 --- a/src/vkcv/Context.cpp +++ b/src/vkcv/Context.cpp @@ -307,6 +307,11 @@ namespace vkcv // jetzt koennen wir mit dem device die queues erstellen vk::Device device = physicalDevice.createDevice(deviceCreateInfo); + + if (usingMeshShaders) + { + InitMeshShaderDrawFunctions(device); + } QueueManager queueManager = QueueManager::create(device, queuePairsGraphics, queuePairsCompute, queuePairsTransfer); diff --git a/src/vkcv/DrawcallRecording.cpp b/src/vkcv/DrawcallRecording.cpp index 18eb896b16a4bfc221cc106ee9986c9d7f8add06..6ff3209b0cfb834c20cdb72be925981f51862d84 100644 --- a/src/vkcv/DrawcallRecording.cpp +++ b/src/vkcv/DrawcallRecording.cpp @@ -43,6 +43,22 @@ namespace vkcv { } } + + + struct MeshShaderFunctions + { + PFN_vkCmdDrawMeshTasksNV cmdDrawMeshTasks = nullptr; + PFN_vkCmdDrawMeshTasksIndirectNV cmdDrawMeshTasksIndirect = nullptr; + PFN_vkCmdDrawMeshTasksIndirectCountNV cmdDrawMeshTasksIndirectCount = nullptr; + } MeshShaderFunctions; + + void InitMeshShaderDrawFunctions(vk::Device device) + { + MeshShaderFunctions.cmdDrawMeshTasks = reinterpret_cast<PFN_vkCmdDrawMeshTasksNV>(vkGetDeviceProcAddr(VkDevice(device), "vkCmdDrawMeshTasksNV")); + MeshShaderFunctions.cmdDrawMeshTasksIndirect = reinterpret_cast<PFN_vkCmdDrawMeshTasksIndirectNV>(vkGetDeviceProcAddr(VkDevice(device), "vkCmdDrawMeshTasksIndirectNV")); + MeshShaderFunctions.cmdDrawMeshTasksIndirectCount = reinterpret_cast<PFN_vkCmdDrawMeshTasksIndirectCountNV>(vkGetDeviceProcAddr(VkDevice(device), "vkCmdDrawMeshTasksIndirectCountNV")); + } + void recordMeshShaderDrawcall( vk::CommandBuffer cmdBuffer, vk::PipelineLayout pipelineLayout, @@ -71,6 +87,6 @@ namespace vkcv { pushConstantData.sizePerDrawcall, drawcallPushConstantData); - cmdBuffer.drawMeshTasksNV(drawcall.taskCount, firstTask); + MeshShaderFunctions.cmdDrawMeshTasks(cmdBuffer, drawcall.taskCount, firstTask); } } \ No newline at end of file