mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
tests: Only destroy the device if the context has one in vulkan_test_context_destroy().
If vulkan_test_context_init_device() was never called, or failed to create a device, the context won't have a device.
This commit is contained in:
parent
ccc48291b3
commit
3285d1ad8c
Notes:
Henri Verbeet
2024-10-10 20:09:13 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1166
@ -342,6 +342,16 @@ static inline bool get_vulkan_queue_index(const struct vulkan_test_context *cont
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void vulkan_test_context_destroy_device(const struct vulkan_test_context *context)
|
||||
{
|
||||
VkDevice device = context->device;
|
||||
|
||||
VK_CALL(vkDestroyDescriptorPool(device, context->descriptor_pool, NULL));
|
||||
VK_CALL(vkFreeCommandBuffers(device, context->command_pool, 1, &context->cmd_buffer));
|
||||
VK_CALL(vkDestroyCommandPool(device, context->command_pool, NULL));
|
||||
VK_CALL(vkDestroyDevice(device, NULL));
|
||||
}
|
||||
|
||||
static inline bool vulkan_test_context_init_device(struct vulkan_test_context *context,
|
||||
const VkDeviceCreateInfo *device_desc, uint32_t queue_index,
|
||||
uint32_t max_resource_count, uint32_t max_sampler_count)
|
||||
@ -402,12 +412,8 @@ static inline bool vulkan_test_context_init_device(struct vulkan_test_context *c
|
||||
|
||||
static inline void vulkan_test_context_destroy(const struct vulkan_test_context *context)
|
||||
{
|
||||
VkDevice device = context->device;
|
||||
|
||||
VK_CALL(vkDestroyDescriptorPool(device, context->descriptor_pool, NULL));
|
||||
VK_CALL(vkFreeCommandBuffers(device, context->command_pool, 1, &context->cmd_buffer));
|
||||
VK_CALL(vkDestroyCommandPool(device, context->command_pool, NULL));
|
||||
VK_CALL(vkDestroyDevice(device, NULL));
|
||||
if (context->device)
|
||||
vulkan_test_context_destroy_device(context);
|
||||
VK_CALL(vkDestroyInstance(context->instance, NULL));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user