mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[vulkan] Plug some leaking sprite descriptors
I'd forgotten to free them when unloading a model, thus the segfault after about 31 timedemo runs.
This commit is contained in:
parent
1e65ec22f9
commit
86faeba31a
3 changed files with 15 additions and 0 deletions
|
@ -81,6 +81,8 @@ struct qfv_renderframe_s;
|
|||
struct entity_s;
|
||||
struct mod_sprite_ctx_s;
|
||||
|
||||
void Vulkan_Sprint_FreeDescriptors (struct vulkan_ctx_s *ctx,
|
||||
qfv_sprite_t *sprite);
|
||||
void Vulkan_Sprite_DescriptorSet (struct vulkan_ctx_s *ctx,
|
||||
qfv_sprite_t *sprite);
|
||||
void Vulkan_Mod_SpriteLoadFrames (struct mod_sprite_ctx_s *sprite_ctx,
|
||||
|
|
|
@ -67,6 +67,8 @@ vulkan_sprite_clear (model_t *m, void *data)
|
|||
msprite_t *msprite = m->cache.data;
|
||||
__auto_type sprite = (qfv_sprite_t *) ((byte *) msprite + msprite->data);
|
||||
|
||||
Vulkan_Sprint_FreeDescriptors (ctx, sprite);
|
||||
|
||||
dfunc->vkDestroyBuffer (device->dev, sprite->verts, 0);
|
||||
dfunc->vkDestroyImageView (device->dev, sprite->view, 0);
|
||||
dfunc->vkDestroyImage (device->dev, sprite->image, 0);
|
||||
|
|
|
@ -271,6 +271,17 @@ Vulkan_Sprite_DescriptorSet (vulkan_ctx_t *ctx, qfv_sprite_t *sprite)
|
|||
dfunc->vkUpdateDescriptorSets (device->dev, 2, write, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_Sprint_FreeDescriptors (vulkan_ctx_t *ctx, qfv_sprite_t *sprite)
|
||||
{
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
spritectx_t *sctx = ctx->sprite_context;
|
||||
|
||||
dfunc->vkFreeDescriptorSets (device->dev, sctx->pool, 1,
|
||||
&sprite->descriptors);
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_Sprite_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue