mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 15:33:34 +00:00
moving compute pass to his own files
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -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_
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
73
Sources/Backends/Vulkan/VulkanComputePass.c
git.filemode.normal_file
73
Sources/Backends/Vulkan/VulkanComputePass.c
git.filemode.normal_file
@@ -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)
|
||||
{
|
||||
}
|
||||
@@ -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 <vulkan/vulkan_core.h>
|
||||
|
||||
#include <Pulse.h>
|
||||
#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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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_
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "VulkanQueue.h"
|
||||
#include "VulkanBuffer.h"
|
||||
#include "VulkanImage.h"
|
||||
#include "VulkanComputePass.h"
|
||||
#include "../../PulseInternal.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
98
Sources/PulseComputePass.c
git.filemode.normal_file
98
Sources/PulseComputePass.c
git.filemode.normal_file
@@ -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 <string.h>
|
||||
#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;
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user