diff --git a/libs/video/renderer/vulkan/vkparse.c b/libs/video/renderer/vulkan/vkparse.c index 08ab9acfb..55192ad36 100644 --- a/libs/video/renderer/vulkan/vkparse.c +++ b/libs/video/renderer/vulkan/vkparse.c @@ -405,7 +405,9 @@ setLayout_free (void *hr, void *_ctx) qfv_device_t *device = ctx->device; qfv_devfuncs_t *dfunc = device->funcs; - dfunc->vkDestroyDescriptorSetLayout (device->dev, layout, 0); + if (layout) { + dfunc->vkDestroyDescriptorSetLayout (device->dev, layout, 0); + } handleref_free (handleref, ctx); } @@ -418,7 +420,9 @@ shaderModule_free (void *hr, void *_ctx) qfv_device_t *device = ctx->device; qfv_devfuncs_t *dfunc = device->funcs; - dfunc->vkDestroyShaderModule (device->dev, module, 0); + if (module) { + dfunc->vkDestroyShaderModule (device->dev, module, 0); + } handleref_free (handleref, ctx); } @@ -431,7 +435,9 @@ pipelineLayout_free (void *hr, void *_ctx) qfv_device_t *device = ctx->device; qfv_devfuncs_t *dfunc = device->funcs; - dfunc->vkDestroyPipelineLayout (device->dev, layout, 0); + if (layout) { + dfunc->vkDestroyPipelineLayout (device->dev, layout, 0); + }; handleref_free (handleref, ctx); } diff --git a/libs/video/renderer/vulkan/vulkan_vid_common.c b/libs/video/renderer/vulkan/vulkan_vid_common.c index 23d5ca4cc..fc0a97edf 100644 --- a/libs/video/renderer/vulkan/vulkan_vid_common.c +++ b/libs/video/renderer/vulkan/vulkan_vid_common.c @@ -43,6 +43,7 @@ #include "QF/cmem.h" #include "QF/cvar.h" #include "QF/dstring.h" +#include "QF/hash.h" #include "QF/input.h" #include "QF/mathlib.h" #include "QF/qargs.h" @@ -144,6 +145,15 @@ Vulkan_Init_Common (vulkan_ctx_t *ctx) ctx->instance = QFV_CreateInstance (ctx, PACKAGE_STRING, 0x000702ff, 0, instance_extensions);//FIXME version } +static void +clear_table (hashtab_t **table) +{ + if (*table) { + Hash_DelTable (*table); + *table = 0; + } +} + void Vulkan_Shutdown_Common (vulkan_ctx_t *ctx) { @@ -156,6 +166,9 @@ Vulkan_Shutdown_Common (vulkan_ctx_t *ctx) if (ctx->swapchain) { QFV_DestroySwapchain (ctx->swapchain); } + clear_table (&ctx->pipelineLayouts); + clear_table (&ctx->setLayouts); + clear_table (&ctx->shaderModules); ctx->instance->funcs->vkDestroySurfaceKHR (ctx->instance->instance, ctx->surface, 0); if (ctx->device) {