mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 10:21:21 +00:00
[vulkan] Clear out the resource tables on shutdown
This would take care of undestroyed resources if there wasn't a problem with invalid memory use. Not sure what's going on just yet.
This commit is contained in:
parent
dc704a9384
commit
3cf8a336a8
2 changed files with 22 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue