From 4bbbf4e5dd42c3a269766eaeace2d572dd11a4f0 Mon Sep 17 00:00:00 2001 From: Kbz-8 Date: Sun, 26 Jan 2025 14:21:52 +0100 Subject: [PATCH] moving compute pass to his own files --- Sources/Backends/Metal/Metal.m | 2 +- Sources/Backends/Vulkan/VulkanCommandList.c | 30 +----- Sources/Backends/Vulkan/VulkanCommandList.h | 10 -- Sources/Backends/Vulkan/VulkanCommandPool.c | 4 + Sources/Backends/Vulkan/VulkanComputePass.c | 73 ++++++++++++++ Sources/Backends/Vulkan/VulkanComputePass.h | 39 ++++++++ .../Backends/Vulkan/VulkanComputePipeline.c | 29 ------ .../Backends/Vulkan/VulkanComputePipeline.h | 5 - Sources/Backends/Vulkan/VulkanDevice.c | 1 + Sources/PulseCommandList.c | 39 -------- Sources/PulseComputePass.c | 98 +++++++++++++++++++ Sources/PulseComputePipeline.c | 53 ---------- Xmake/Actions/CheckFiles.lua | 2 + 13 files changed, 219 insertions(+), 166 deletions(-) create mode 100644 Sources/Backends/Vulkan/VulkanComputePass.c create mode 100644 Sources/PulseComputePass.c diff --git a/Sources/Backends/Metal/Metal.m b/Sources/Backends/Metal/Metal.m index 0b201f9..fa7ec9a 100644 --- a/Sources/Backends/Metal/Metal.m +++ b/Sources/Backends/Metal/Metal.m @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanCommandList.c b/Sources/Backends/Vulkan/VulkanCommandList.c index eb28e74..dabd28a 100644 --- a/Sources/Backends/Vulkan/VulkanCommandList.c +++ b/Sources/Backends/Vulkan/VulkanCommandList.c @@ -8,6 +8,7 @@ #include "VulkanCommandPool.h" #include "VulkanDevice.h" #include "VulkanQueue.h" +#include "VulkanComputePass.h" static void VulkanInitCommandList(VulkanCommandPool* pool, PulseCommandList cmd) { @@ -31,26 +32,6 @@ static void VulkanInitCommandList(VulkanCommandPool* pool, PulseCommandList cmd) pool->available_command_lists_size++; } -PulseComputePass VulkanCreateComputePass(PulseDevice device, PulseCommandList cmd) -{ - PulseComputePass pass = (PulseComputePass)calloc(1, sizeof(PulseComputePassHandler)); - PULSE_CHECK_ALLOCATION_RETVAL(pass, PULSE_NULL_HANDLE); - - VulkanComputePass* vulkan_pass = (VulkanComputePass*)calloc(1, sizeof(VulkanComputePass)); - PULSE_CHECK_ALLOCATION_RETVAL(vulkan_pass, PULSE_NULL_HANDLE); - - VulkanDevice* vulkan_device = VULKAN_RETRIEVE_DRIVER_DATA_AS(device, VulkanDevice*); - -// vulkan_pass->read_only_descriptor_set = VulkanRequestDescriptorSetFromPool( -// VulkanGetAvailableDescriptorSetPool(&vulkan_device->descriptor_set_pool_manager), -// VulkanGetDescriptorSetLayout(&vulkan_device->descriptor_set_layout_manager, )); - - pass->cmd = cmd; - pass->driver_data = vulkan_pass; - - return pass; -} - PulseCommandList VulkanRequestCommandList(PulseDevice device, PulseCommandListUsage usage) { PULSE_CHECK_HANDLE_RETVAL(device, PULSE_NULL_HANDLE); @@ -184,12 +165,3 @@ void VulkanReleaseCommandList(PulseDevice device, PulseCommandList cmd) } } } - -PulseComputePass VulkanBeginComputePass(PulseCommandList cmd) -{ - return cmd->pass; -} - -void VulkanEndComputePass(PulseComputePass pass) -{ -} diff --git a/Sources/Backends/Vulkan/VulkanCommandList.h b/Sources/Backends/Vulkan/VulkanCommandList.h index d1cf5d5..e96300b 100644 --- a/Sources/Backends/Vulkan/VulkanCommandList.h +++ b/Sources/Backends/Vulkan/VulkanCommandList.h @@ -20,19 +20,9 @@ typedef struct VulkanCommandList VkCommandBuffer cmd; } VulkanCommandList; -typedef struct VulkanComputePass -{ - VulkanDescriptorSet* read_only_descriptor_set; - VulkanDescriptorSet* read_write_descriptor_set; - VulkanDescriptorSet* uniform_descriptor_set; - PulseBuffer uniform_buffer; -} VulkanComputePass; - PulseCommandList VulkanRequestCommandList(PulseDevice device, PulseCommandListUsage usage); bool VulkanSubmitCommandList(PulseDevice device, PulseCommandList cmd, PulseFence fence); void VulkanReleaseCommandList(PulseDevice device, PulseCommandList cmd); -PulseComputePass VulkanBeginComputePass(PulseCommandList cmd); -void VulkanEndComputePass(PulseComputePass pass); #endif // PULSE_VULKAN_COMMAND_LIST_H_ diff --git a/Sources/Backends/Vulkan/VulkanCommandPool.c b/Sources/Backends/Vulkan/VulkanCommandPool.c index 4358e41..bf36d01 100644 --- a/Sources/Backends/Vulkan/VulkanCommandPool.c +++ b/Sources/Backends/Vulkan/VulkanCommandPool.c @@ -6,6 +6,7 @@ #include "VulkanCommandPool.h" #include "VulkanDevice.h" #include "VulkanQueue.h" +#include "VulkanComputePass.h" bool VulkanInitCommandPool(PulseDevice device, VulkanCommandPool* pool, VulkanQueueType queue_type) { @@ -36,6 +37,9 @@ void VulkanUninitCommandPool(VulkanCommandPool* pool) { PULSE_CHECK_PTR(pool); + for(uint32_t i = 0; i < pool->available_command_lists_size; i++) + VulkanDestroyComputePass(pool->device, pool->available_command_lists[i]->pass); + VulkanDevice* vulkan_device = VULKAN_RETRIEVE_DRIVER_DATA_AS(pool->device, VulkanDevice*); vulkan_device->vkDestroyCommandPool(vulkan_device->device, pool->pool, PULSE_NULLPTR); if(pool->available_command_lists != PULSE_NULLPTR) diff --git a/Sources/Backends/Vulkan/VulkanComputePass.c b/Sources/Backends/Vulkan/VulkanComputePass.c new file mode 100644 index 0000000..7234f24 --- /dev/null +++ b/Sources/Backends/Vulkan/VulkanComputePass.c @@ -0,0 +1,73 @@ +// Copyright (C) 2025 kanel +// This file is part of "Pulse" +// For conditions of distribution and use, see copyright notice in LICENSE + +#include "Vulkan.h" +#include "VulkanDevice.h" +#include "VulkanComputePass.h" +#include "VulkanComputePipeline.h" + +PulseComputePass VulkanCreateComputePass(PulseDevice device, PulseCommandList cmd) +{ + PulseComputePass pass = (PulseComputePass)calloc(1, sizeof(PulseComputePassHandler)); + PULSE_CHECK_ALLOCATION_RETVAL(pass, PULSE_NULL_HANDLE); + + VulkanComputePass* vulkan_pass = (VulkanComputePass*)calloc(1, sizeof(VulkanComputePass)); + PULSE_CHECK_ALLOCATION_RETVAL(vulkan_pass, PULSE_NULL_HANDLE); + + VulkanDevice* vulkan_device = VULKAN_RETRIEVE_DRIVER_DATA_AS(device, VulkanDevice*); + +// vulkan_pass->read_only_descriptor_set = VulkanRequestDescriptorSetFromPool( +// VulkanGetAvailableDescriptorSetPool(&vulkan_device->descriptor_set_pool_manager), +// VulkanGetDescriptorSetLayout(&vulkan_device->descriptor_set_layout_manager, )); + + pass->cmd = cmd; + pass->driver_data = vulkan_pass; + + return pass; +} + +void VulkanDestroyComputePass(PulseDevice device, PulseComputePass pass) +{ + (void)device; // Maybe reserved for future use + free(pass->driver_data); + free(pass); +} + +void VulkanBindStorageBuffers(PulseComputePass pass, uint32_t starting_slot, PulseBuffer* const* buffers, uint32_t num_buffers) +{ +} + +void VulkanBindUniformData(PulseComputePass pass, uint32_t slot, const void* data, uint32_t data_size) +{ +} + +void VulkanBindStorageImages(PulseComputePass pass, uint32_t starting_slot, PulseImage* const* images, uint32_t num_images) +{ +} + +void VulkanBindComputePipeline(PulseComputePass pass, PulseComputePipeline pipeline) +{ + VulkanComputePipeline* vulkan_pipeline = VULKAN_RETRIEVE_DRIVER_DATA_AS(pipeline, VulkanComputePipeline*); + VulkanDevice* vulkan_device = VULKAN_RETRIEVE_DRIVER_DATA_AS(pass->cmd->device, VulkanDevice*); + VulkanCommandList* vulkan_cmd = VULKAN_RETRIEVE_DRIVER_DATA_AS(pass->cmd, VulkanCommandList*); + + vulkan_device->vkCmdBindPipeline(vulkan_cmd->cmd, VK_PIPELINE_BIND_POINT_COMPUTE, vulkan_pipeline->pipeline); +} + +void VulkanDispatchComputations(PulseComputePass pass, uint32_t groupcount_x, uint32_t groupcount_y, uint32_t groupcount_z) +{ + VulkanDevice* vulkan_device = VULKAN_RETRIEVE_DRIVER_DATA_AS(pass->cmd->device, VulkanDevice*); + VulkanCommandList* vulkan_cmd = VULKAN_RETRIEVE_DRIVER_DATA_AS(pass->cmd, VulkanCommandList*); + + vulkan_device->vkCmdDispatch(vulkan_cmd->cmd, groupcount_x, groupcount_y, groupcount_z); +} + +PulseComputePass VulkanBeginComputePass(PulseCommandList cmd) +{ + return cmd->pass; +} + +void VulkanEndComputePass(PulseComputePass pass) +{ +} diff --git a/Sources/Backends/Vulkan/VulkanComputePass.h b/Sources/Backends/Vulkan/VulkanComputePass.h index d252e15..36afc96 100644 --- a/Sources/Backends/Vulkan/VulkanComputePass.h +++ b/Sources/Backends/Vulkan/VulkanComputePass.h @@ -1,3 +1,42 @@ // Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE + +#ifdef PULSE_ENABLE_VULKAN_BACKEND + +#ifndef PULSE_VULKAN_COMPUTE_PASS_H_ +#define PULSE_VULKAN_COMPUTE_PASS_H_ + +#include + +#include +#include "VulkanBuffer.h" +#include "VulkanDescriptor.h" +#include "VulkanCommandList.h" + +typedef struct VulkanComputePass +{ + VulkanDescriptorSet* read_only_descriptor_set; + VulkanDescriptorSet* read_write_descriptor_set; + VulkanDescriptorSet* uniform_descriptor_set; + PulseBuffer uniform_buffer; + + bool should_recreate_read_only_descriptor_sets; + bool should_recreate_write_descriptor_sets; + bool should_recreate_uniform_descriptor_sets; +} VulkanComputePass; + +PulseComputePass VulkanCreateComputePass(PulseDevice device, PulseCommandList cmd); +void VulkanDestroyComputePass(PulseDevice device, PulseComputePass pass); + +PulseComputePass VulkanBeginComputePass(PulseCommandList cmd); +void VulkanEndComputePass(PulseComputePass pass); +void VulkanBindStorageBuffers(PulseComputePass pass, uint32_t starting_slot, PulseBuffer* const* buffers, uint32_t num_buffers); +void VulkanBindUniformData(PulseComputePass pass, uint32_t slot, const void* data, uint32_t data_size); +void VulkanBindStorageImages(PulseComputePass pass, uint32_t starting_slot, PulseImage* const* images, uint32_t num_images); +void VulkanBindComputePipeline(PulseComputePass pass, PulseComputePipeline pipeline); +void VulkanDispatchComputations(PulseComputePass pass, uint32_t groupcount_x, uint32_t groupcount_y, uint32_t groupcount_z); + +#endif // PULSE_VULKAN_COMMAND_LIST_H_ + +#endif // PULSE_ENABLE_VULKAN_BACKEND diff --git a/Sources/Backends/Vulkan/VulkanComputePipeline.c b/Sources/Backends/Vulkan/VulkanComputePipeline.c index 568ac96..41058b2 100644 --- a/Sources/Backends/Vulkan/VulkanComputePipeline.c +++ b/Sources/Backends/Vulkan/VulkanComputePipeline.c @@ -81,32 +81,3 @@ void VulkanDestroyComputePipeline(PulseDevice device, PulseComputePipeline pipel if(PULSE_IS_BACKEND_HIGH_LEVEL_DEBUG(device->backend)) PulseLogInfoFmt(device->backend, "(Vulkan) destroyed compute pipeline %p", pipeline); } - -void VulkanBindStorageBuffers(PulseComputePass pass, uint32_t starting_slot, PulseBuffer* const* buffers, uint32_t num_buffers) -{ -} - -void VulkanBindUniformData(PulseComputePass pass, uint32_t slot, const void* data, uint32_t data_size) -{ -} - -void VulkanBindStorageImages(PulseComputePass pass, uint32_t starting_slot, PulseImage* const* images, uint32_t num_images) -{ -} - -void VulkanBindComputePipeline(PulseComputePass pass, PulseComputePipeline pipeline) -{ - VulkanComputePipeline* vulkan_pipeline = VULKAN_RETRIEVE_DRIVER_DATA_AS(pipeline, VulkanComputePipeline*); - VulkanDevice* vulkan_device = VULKAN_RETRIEVE_DRIVER_DATA_AS(pass->cmd->device, VulkanDevice*); - VulkanCommandList* vulkan_cmd = VULKAN_RETRIEVE_DRIVER_DATA_AS(pass->cmd, VulkanCommandList*); - - vulkan_device->vkCmdBindPipeline(vulkan_cmd->cmd, VK_PIPELINE_BIND_POINT_COMPUTE, vulkan_pipeline->pipeline); -} - -void VulkanDispatchComputations(PulseComputePass pass, uint32_t groupcount_x, uint32_t groupcount_y, uint32_t groupcount_z) -{ - VulkanDevice* vulkan_device = VULKAN_RETRIEVE_DRIVER_DATA_AS(pass->cmd->device, VulkanDevice*); - VulkanCommandList* vulkan_cmd = VULKAN_RETRIEVE_DRIVER_DATA_AS(pass->cmd, VulkanCommandList*); - - vulkan_device->vkCmdDispatch(vulkan_cmd->cmd, groupcount_x, groupcount_y, groupcount_z); -} diff --git a/Sources/Backends/Vulkan/VulkanComputePipeline.h b/Sources/Backends/Vulkan/VulkanComputePipeline.h index 4e9cb79..31abdb1 100644 --- a/Sources/Backends/Vulkan/VulkanComputePipeline.h +++ b/Sources/Backends/Vulkan/VulkanComputePipeline.h @@ -20,11 +20,6 @@ typedef struct VulkanComputePipeline PulseComputePipeline VulkanCreateComputePipeline(PulseDevice device, const PulseComputePipelineCreateInfo* info); void VulkanDestroyComputePipeline(PulseDevice device, PulseComputePipeline pipeline); -void VulkanBindStorageBuffers(PulseComputePass pass, uint32_t starting_slot, PulseBuffer* const* buffers, uint32_t num_buffers); -void VulkanBindUniformData(PulseComputePass pass, uint32_t slot, const void* data, uint32_t data_size); -void VulkanBindStorageImages(PulseComputePass pass, uint32_t starting_slot, PulseImage* const* images, uint32_t num_images); -void VulkanBindComputePipeline(PulseComputePass pass, PulseComputePipeline pipeline); -void VulkanDispatchComputations(PulseComputePass pass, uint32_t groupcount_x, uint32_t groupcount_y, uint32_t groupcount_z); #endif // PULSE_VULKAN_COMPUTE_PIPELINE_H_ diff --git a/Sources/Backends/Vulkan/VulkanDevice.c b/Sources/Backends/Vulkan/VulkanDevice.c index 7fc45da..e64140c 100644 --- a/Sources/Backends/Vulkan/VulkanDevice.c +++ b/Sources/Backends/Vulkan/VulkanDevice.c @@ -13,6 +13,7 @@ #include "VulkanQueue.h" #include "VulkanBuffer.h" #include "VulkanImage.h" +#include "VulkanComputePass.h" #include "../../PulseInternal.h" #include diff --git a/Sources/PulseCommandList.c b/Sources/PulseCommandList.c index a48865d..58981bf 100644 --- a/Sources/PulseCommandList.c +++ b/Sources/PulseCommandList.c @@ -75,42 +75,3 @@ PULSE_API void PulseReleaseCommandList(PulseDevice device, PulseCommandList cmd) } return device->PFN_ReleaseCommandList(device, cmd); } - -PULSE_API PulseComputePass PulseBeginComputePass(PulseCommandList cmd) -{ - PULSE_CHECK_HANDLE_RETVAL(cmd, PULSE_NULL_HANDLE); - PULSE_CHECK_HANDLE_RETVAL(cmd->device, PULSE_NULL_HANDLE); - - PULSE_CHECK_COMMAND_LIST_STATE_RETVAL(cmd, PULSE_NULL_HANDLE); - PulseComputePass pass = cmd->device->PFN_BeginComputePass(cmd); - if(pass->is_recording == true) - { - if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(cmd->device->backend)) - PulseLogWarning(cmd->device->backend, "a compute pass is already recording in this command buffer, please call PulseEndComputePass before beginning a new one"); - return PULSE_NULL_HANDLE; - } - pass->is_recording = true; - return pass; -} - -PULSE_API void PulseEndComputePass(PulseComputePass pass) -{ - if(pass == PULSE_NULL_HANDLE) - { - PULSE_CHECK_HANDLE(pass->cmd); - PULSE_CHECK_HANDLE(pass->cmd->device); - if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(pass->cmd->device->backend)) - PulseLogWarning(pass->cmd->device->backend, "command list is NULL, this may be a bug in your application"); - return; - } - PULSE_CHECK_COMMAND_LIST_STATE(pass->cmd); - - memset(pass->readonly_images, 0, PULSE_MAX_READ_TEXTURES_BOUND * sizeof(PulseImage)); - memset(pass->readwrite_images, 0, PULSE_MAX_WRITE_TEXTURES_BOUND * sizeof(PulseImage)); - memset(pass->readonly_storage_buffers, 0, PULSE_MAX_READ_BUFFERS_BOUND * sizeof(PulseBuffer)); - memset(pass->readwrite_storage_buffers, 0, PULSE_MAX_WRITE_BUFFERS_BOUND * sizeof(PulseBuffer)); - - pass->current_pipeline = PULSE_NULL_HANDLE; - - pass->is_recording = false; -} diff --git a/Sources/PulseComputePass.c b/Sources/PulseComputePass.c new file mode 100644 index 0000000..efc2446 --- /dev/null +++ b/Sources/PulseComputePass.c @@ -0,0 +1,98 @@ +// Copyright (C) 2025 kanel +// This file is part of "Pulse" +// For conditions of distribution and use, see copyright notice in LICENSE + +#include +#include "PulseDefs.h" +#include "PulseInternal.h" + +PULSE_API void PulseBindStorageBuffers(PulseComputePass pass, uint32_t starting_slot, PulseBuffer* const* buffers, uint32_t num_buffers) +{ + PULSE_CHECK_HANDLE(pass); + + PULSE_CHECK_COMMAND_LIST_STATE(pass->cmd); + + pass->cmd->device->PFN_BindStorageBuffers(pass, starting_slot, buffers, num_buffers); +} + +PULSE_API void PulseBindUniformData(PulseComputePass pass, uint32_t slot, const void* data, uint32_t data_size) +{ + PULSE_CHECK_HANDLE(pass); + + PULSE_CHECK_COMMAND_LIST_STATE(pass->cmd); + + pass->cmd->device->PFN_BindUniformData(pass, slot, data, data_size); +} + +PULSE_API void PulseBindStorageImages(PulseComputePass pass, uint32_t starting_slot, PulseImage* const* images, uint32_t num_images) +{ + PULSE_CHECK_HANDLE(pass); + + PULSE_CHECK_COMMAND_LIST_STATE(pass->cmd); + + pass->cmd->device->PFN_BindStorageImages(pass, starting_slot, images, num_images); +} + +PULSE_API void PulseBindComputePipeline(PulseComputePass pass, PulseComputePipeline pipeline) +{ + PULSE_CHECK_HANDLE(pass); + PULSE_CHECK_HANDLE(pipeline); + + PULSE_CHECK_COMMAND_LIST_STATE(pass->cmd); + + pass->cmd->device->PFN_BindComputePipeline(pass, pipeline); + + pass->current_pipeline = pipeline; + + PULSE_EXPAND_ARRAY_IF_NEEDED(pass->compute_pipelines_bound, PulseComputePipeline, pass->compute_pipelines_bound_size, pass->compute_pipelines_bound_capacity, 2); + pass->compute_pipelines_bound[pass->compute_pipelines_bound_size] = pipeline; + pass->compute_pipelines_bound_size++; +} + +PULSE_API void PulseDispatchComputations(PulseComputePass pass, uint32_t groupcount_x, uint32_t groupcount_y, uint32_t groupcount_z) +{ + PULSE_CHECK_HANDLE(pass); + + PULSE_CHECK_COMMAND_LIST_STATE(pass->cmd); + + pass->cmd->device->PFN_DispatchComputations(pass, groupcount_x, groupcount_y, groupcount_z); +} + +PULSE_API PulseComputePass PulseBeginComputePass(PulseCommandList cmd) +{ + PULSE_CHECK_HANDLE_RETVAL(cmd, PULSE_NULL_HANDLE); + PULSE_CHECK_HANDLE_RETVAL(cmd->device, PULSE_NULL_HANDLE); + + PULSE_CHECK_COMMAND_LIST_STATE_RETVAL(cmd, PULSE_NULL_HANDLE); + PulseComputePass pass = cmd->device->PFN_BeginComputePass(cmd); + if(pass->is_recording == true) + { + if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(cmd->device->backend)) + PulseLogWarning(cmd->device->backend, "a compute pass is already recording in this command buffer, please call PulseEndComputePass before beginning a new one"); + return PULSE_NULL_HANDLE; + } + pass->is_recording = true; + return pass; +} + +PULSE_API void PulseEndComputePass(PulseComputePass pass) +{ + if(pass == PULSE_NULL_HANDLE) + { + PULSE_CHECK_HANDLE(pass->cmd); + PULSE_CHECK_HANDLE(pass->cmd->device); + if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(pass->cmd->device->backend)) + PulseLogWarning(pass->cmd->device->backend, "command list is NULL, this may be a bug in your application"); + return; + } + PULSE_CHECK_COMMAND_LIST_STATE(pass->cmd); + + memset(pass->readonly_images, 0, PULSE_MAX_READ_TEXTURES_BOUND * sizeof(PulseImage)); + memset(pass->readwrite_images, 0, PULSE_MAX_WRITE_TEXTURES_BOUND * sizeof(PulseImage)); + memset(pass->readonly_storage_buffers, 0, PULSE_MAX_READ_BUFFERS_BOUND * sizeof(PulseBuffer)); + memset(pass->readwrite_storage_buffers, 0, PULSE_MAX_WRITE_BUFFERS_BOUND * sizeof(PulseBuffer)); + + pass->current_pipeline = PULSE_NULL_HANDLE; + + pass->is_recording = false; +} diff --git a/Sources/PulseComputePipeline.c b/Sources/PulseComputePipeline.c index 1fa275e..f7cd0c5 100644 --- a/Sources/PulseComputePipeline.c +++ b/Sources/PulseComputePipeline.c @@ -5,7 +5,6 @@ #include "PulseDefs.h" #include "PulseInternal.h" - PULSE_API PulseComputePipeline PulseCreateComputePipeline(PulseDevice device, const PulseComputePipelineCreateInfo* info) { PULSE_CHECK_HANDLE_RETVAL(device, PULSE_NULL_HANDLE); @@ -23,58 +22,6 @@ PULSE_API PulseComputePipeline PulseCreateComputePipeline(PulseDevice device, co return pipeline; } -PULSE_API void PulseBindStorageBuffers(PulseComputePass pass, uint32_t starting_slot, PulseBuffer* const* buffers, uint32_t num_buffers) -{ - PULSE_CHECK_HANDLE(pass); - - PULSE_CHECK_COMMAND_LIST_STATE(pass->cmd); - - pass->cmd->device->PFN_BindStorageBuffers(pass, starting_slot, buffers, num_buffers); -} - -PULSE_API void PulseBindUniformData(PulseComputePass pass, uint32_t slot, const void* data, uint32_t data_size) -{ - PULSE_CHECK_HANDLE(pass); - - PULSE_CHECK_COMMAND_LIST_STATE(pass->cmd); - - pass->cmd->device->PFN_BindUniformData(pass, slot, data, data_size); -} - -PULSE_API void PulseBindStorageImages(PulseComputePass pass, uint32_t starting_slot, PulseImage* const* images, uint32_t num_images) -{ - PULSE_CHECK_HANDLE(pass); - - PULSE_CHECK_COMMAND_LIST_STATE(pass->cmd); - - pass->cmd->device->PFN_BindStorageImages(pass, starting_slot, images, num_images); -} - -PULSE_API void PulseBindComputePipeline(PulseComputePass pass, PulseComputePipeline pipeline) -{ - PULSE_CHECK_HANDLE(pass); - PULSE_CHECK_HANDLE(pipeline); - - PULSE_CHECK_COMMAND_LIST_STATE(pass->cmd); - - pass->cmd->device->PFN_BindComputePipeline(pass, pipeline); - - pass->current_pipeline = pipeline; - - PULSE_EXPAND_ARRAY_IF_NEEDED(pass->compute_pipelines_bound, PulseComputePipeline, pass->compute_pipelines_bound_size, pass->compute_pipelines_bound_capacity, 2); - pass->compute_pipelines_bound[pass->compute_pipelines_bound_size] = pipeline; - pass->compute_pipelines_bound_size++; -} - -PULSE_API void PulseDispatchComputations(PulseComputePass pass, uint32_t groupcount_x, uint32_t groupcount_y, uint32_t groupcount_z) -{ - PULSE_CHECK_HANDLE(pass); - - PULSE_CHECK_COMMAND_LIST_STATE(pass->cmd); - - pass->cmd->device->PFN_DispatchComputations(pass, groupcount_x, groupcount_y, groupcount_z); -} - PULSE_API void PulseDestroyComputePipeline(PulseDevice device, PulseComputePipeline pipeline) { PULSE_CHECK_HANDLE(device); diff --git a/Xmake/Actions/CheckFiles.lua b/Xmake/Actions/CheckFiles.lua index f0148c0..cfdeb42 100644 --- a/Xmake/Actions/CheckFiles.lua +++ b/Xmake/Actions/CheckFiles.lua @@ -48,6 +48,7 @@ on_run(function() os.files("Sources/**.h"), os.files("Sources/**.inl"), os.files("Sources/**.c"), + os.files("Sources/**.m"), os.files("Sources/**.cpp") ) @@ -90,6 +91,7 @@ on_run(function() os.files("Sources/**.h"), os.files("Sources/**.inl"), os.files("Sources/**.c"), + os.files("Sources/**.m"), os.files("Sources/**.cpp") )