mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 15:33:34 +00:00
fixing dangling pointer in vulkan's command pools
This commit is contained in:
@@ -250,7 +250,10 @@ void VulkanDestroyDevice(PulseDevice device)
|
|||||||
VulkanDestroyDescriptorSetPoolManager(&vulkan_device->descriptor_set_pool_manager);
|
VulkanDestroyDescriptorSetPoolManager(&vulkan_device->descriptor_set_pool_manager);
|
||||||
VulkanDestroyDescriptorSetLayoutManager(&vulkan_device->descriptor_set_layout_manager);
|
VulkanDestroyDescriptorSetLayoutManager(&vulkan_device->descriptor_set_layout_manager);
|
||||||
for(uint32_t i = 0; i < vulkan_device->cmd_pools_size; i++)
|
for(uint32_t i = 0; i < vulkan_device->cmd_pools_size; i++)
|
||||||
vulkan_device->vkDestroyCommandPool(vulkan_device->device, vulkan_device->cmd_pools[i].pool, PULSE_NULLPTR);
|
{
|
||||||
|
vulkan_device->vkDestroyCommandPool(vulkan_device->device, vulkan_device->cmd_pools[i]->pool, PULSE_NULLPTR);
|
||||||
|
free(vulkan_device->cmd_pools[i]);
|
||||||
|
}
|
||||||
vmaDestroyAllocator(vulkan_device->allocator);
|
vmaDestroyAllocator(vulkan_device->allocator);
|
||||||
vulkan_device->vkDestroyDevice(vulkan_device->device, PULSE_NULLPTR);
|
vulkan_device->vkDestroyDevice(vulkan_device->device, PULSE_NULLPTR);
|
||||||
if(PULSE_IS_BACKEND_HIGH_LEVEL_DEBUG(device->backend))
|
if(PULSE_IS_BACKEND_HIGH_LEVEL_DEBUG(device->backend))
|
||||||
@@ -271,13 +274,14 @@ VulkanCommandPool* VulkanRequestCmdPoolFromDevice(PulseDevice device, VulkanQueu
|
|||||||
|
|
||||||
for(uint32_t i = 0; i < vulkan_device->cmd_pools_size; i++)
|
for(uint32_t i = 0; i < vulkan_device->cmd_pools_size; i++)
|
||||||
{
|
{
|
||||||
if(thread_id == vulkan_device->cmd_pools[i].thread_id && queue_type == vulkan_device->cmd_pools[i].queue_type)
|
if(thread_id == vulkan_device->cmd_pools[i]->thread_id && queue_type == vulkan_device->cmd_pools[i]->queue_type)
|
||||||
return &vulkan_device->cmd_pools[i];
|
return vulkan_device->cmd_pools[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
vulkan_device->cmd_pools_size++;
|
vulkan_device->cmd_pools_size++;
|
||||||
vulkan_device->cmd_pools = (VulkanCommandPool*)realloc(vulkan_device->cmd_pools, vulkan_device->cmd_pools_size * sizeof(VulkanCommandPool));
|
vulkan_device->cmd_pools = (VulkanCommandPool**)realloc(vulkan_device->cmd_pools, vulkan_device->cmd_pools_size * sizeof(VulkanCommandPool*));
|
||||||
if(!VulkanInitCommandPool(device, &vulkan_device->cmd_pools[vulkan_device->cmd_pools_size - 1], queue_type))
|
vulkan_device->cmd_pools[vulkan_device->cmd_pools_size - 1] = (VulkanCommandPool*)calloc(1, sizeof(VulkanCommandPool));
|
||||||
|
if(!VulkanInitCommandPool(device, vulkan_device->cmd_pools[vulkan_device->cmd_pools_size - 1], queue_type))
|
||||||
return PULSE_NULLPTR;
|
return PULSE_NULLPTR;
|
||||||
return &vulkan_device->cmd_pools[vulkan_device->cmd_pools_size - 1];
|
return vulkan_device->cmd_pools[vulkan_device->cmd_pools_size - 1];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ typedef struct VulkanDevice
|
|||||||
VulkanDescriptorSetPoolManager descriptor_set_pool_manager;
|
VulkanDescriptorSetPoolManager descriptor_set_pool_manager;
|
||||||
VulkanDescriptorSetLayoutManager descriptor_set_layout_manager;
|
VulkanDescriptorSetLayoutManager descriptor_set_layout_manager;
|
||||||
|
|
||||||
VulkanCommandPool* cmd_pools;
|
VulkanCommandPool** cmd_pools;
|
||||||
uint32_t cmd_pools_size;
|
uint32_t cmd_pools_size;
|
||||||
|
|
||||||
struct VulkanQueue* queues[VULKAN_QUEUE_END_ENUM];
|
struct VulkanQueue* queues[VULKAN_QUEUE_END_ENUM];
|
||||||
|
|||||||
Reference in New Issue
Block a user