mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 23:43:34 +00:00
fixing descriptor sets, adding buffer compute write test
This commit is contained in:
@@ -29,25 +29,35 @@ PulseComputePipeline VulkanCreateComputePipeline(PulseDevice device, const Pulse
|
||||
PulseLogError(device->backend, "invalid shader format passed to PulseComputePipelineCreateInfo");
|
||||
}
|
||||
|
||||
VkShaderModuleCreateInfo shader_module_create_info = {};
|
||||
VkShaderModuleCreateInfo shader_module_create_info = { 0 };
|
||||
shader_module_create_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
||||
shader_module_create_info.codeSize = info->code_size;
|
||||
shader_module_create_info.pCode = (const uint32_t*)info->code;
|
||||
CHECK_VK_RETVAL(device->backend, vulkan_device->vkCreateShaderModule(vulkan_device->device, &shader_module_create_info, PULSE_NULLPTR, &vulkan_pipeline->module), PULSE_ERROR_INITIALIZATION_FAILED, PULSE_NULL_HANDLE);
|
||||
|
||||
VkPipelineShaderStageCreateInfo shader_stage_info = {};
|
||||
VkPipelineShaderStageCreateInfo shader_stage_info = { 0 };
|
||||
shader_stage_info.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||
shader_stage_info.stage = VK_SHADER_STAGE_COMPUTE_BIT;
|
||||
shader_stage_info.module = vulkan_pipeline->module;
|
||||
shader_stage_info.pName = info->entrypoint;
|
||||
|
||||
VkPipelineLayoutCreateInfo pipeline_layout_info = {};
|
||||
vulkan_pipeline->read_only_descriptor_set_layout = VulkanGetDescriptorSetLayout(&vulkan_device->descriptor_set_layout_manager, info->num_readonly_storage_images, info->num_readonly_storage_buffers, 0, 0, 0);
|
||||
vulkan_pipeline->read_write_descriptor_set_layout = VulkanGetDescriptorSetLayout(&vulkan_device->descriptor_set_layout_manager, 0, 0, info->num_readwrite_storage_images, info->num_readwrite_storage_buffers, 0);
|
||||
vulkan_pipeline->uniform_descriptor_set_layout = VulkanGetDescriptorSetLayout(&vulkan_device->descriptor_set_layout_manager, 0, 0, 0, 0, info->num_uniform_buffers);
|
||||
|
||||
VkDescriptorSetLayout descriptor_set_layouts[3] = {
|
||||
vulkan_pipeline->read_only_descriptor_set_layout->layout,
|
||||
vulkan_pipeline->read_write_descriptor_set_layout->layout,
|
||||
vulkan_pipeline->uniform_descriptor_set_layout->layout,
|
||||
};
|
||||
|
||||
VkPipelineLayoutCreateInfo pipeline_layout_info = { 0 };
|
||||
pipeline_layout_info.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
||||
pipeline_layout_info.setLayoutCount = 0;
|
||||
pipeline_layout_info.pSetLayouts = PULSE_NULLPTR; // will change
|
||||
pipeline_layout_info.setLayoutCount = 3;
|
||||
pipeline_layout_info.pSetLayouts = descriptor_set_layouts;
|
||||
CHECK_VK_RETVAL(device->backend, vulkan_device->vkCreatePipelineLayout(vulkan_device->device, &pipeline_layout_info, PULSE_NULLPTR, &vulkan_pipeline->layout), PULSE_ERROR_INITIALIZATION_FAILED, PULSE_NULL_HANDLE);
|
||||
|
||||
VkComputePipelineCreateInfo pipeline_info = {};
|
||||
VkComputePipelineCreateInfo pipeline_info = { 0 };
|
||||
pipeline_info.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
|
||||
pipeline_info.layout = vulkan_pipeline->layout;
|
||||
pipeline_info.stage = shader_stage_info;
|
||||
@@ -71,6 +81,9 @@ void VulkanDestroyComputePipeline(PulseDevice device, PulseComputePipeline pipel
|
||||
|
||||
VulkanComputePipeline* vulkan_pipeline = VULKAN_RETRIEVE_DRIVER_DATA_AS(pipeline, VulkanComputePipeline*);
|
||||
VulkanDevice* vulkan_device = VULKAN_RETRIEVE_DRIVER_DATA_AS(device, VulkanDevice*);
|
||||
vulkan_pipeline->read_only_descriptor_set_layout->is_used = false;
|
||||
vulkan_pipeline->read_write_descriptor_set_layout->is_used = false;
|
||||
vulkan_pipeline->uniform_descriptor_set_layout->is_used = false;
|
||||
vulkan_device->vkDeviceWaitIdle(vulkan_device->device);
|
||||
vulkan_device->vkDestroyShaderModule(vulkan_device->device, vulkan_pipeline->module, PULSE_NULLPTR);
|
||||
vulkan_device->vkDestroyPipelineLayout(vulkan_device->device, vulkan_pipeline->layout, PULSE_NULLPTR);
|
||||
|
||||
Reference in New Issue
Block a user