c/main: Normalize comp_layer_renderer_destroy convention.

This commit is contained in:
Ryan Pavlik 2021-04-13 16:31:39 -05:00 committed by Jakob Bornecrantz
parent ffe458fdba
commit 04c9a7d892
3 changed files with 17 additions and 5 deletions

View file

@ -638,8 +638,15 @@ _destroy_framebuffer(struct comp_layer_renderer *self, uint32_t i)
}
void
comp_layer_renderer_destroy(struct comp_layer_renderer *self)
comp_layer_renderer_destroy(struct comp_layer_renderer **ptr_clr)
{
if (ptr_clr == NULL) {
return;
}
struct comp_layer_renderer *self = *ptr_clr;
if (self == NULL) {
return;
}
struct vk_bundle *vk = self->vk;
if (vk->device == VK_NULL_HANDLE)
@ -670,6 +677,8 @@ comp_layer_renderer_destroy(struct comp_layer_renderer *self)
vk_buffer_destroy(&self->vertex_buffer, vk);
vk->vkDestroyPipelineCache(vk->device, self->pipeline_cache, NULL);
free(self);
*ptr_clr = NULL;
}
void

View file

@ -70,8 +70,13 @@ struct comp_layer_renderer
struct comp_layer_renderer *
comp_layer_renderer_create(struct vk_bundle *vk, struct comp_shaders *s, VkExtent2D extent, VkFormat format);
/*!
* Destroy the layer renderer and set the pointer to NULL.
*
* @public @memberof comp_layer_renderer
*/
void
comp_layer_renderer_destroy(struct comp_layer_renderer *self);
comp_layer_renderer_destroy(struct comp_layer_renderer **ptr_clr);
/*!
* Perform draw calls for the layers.

View file

@ -850,9 +850,7 @@ renderer_destroy(struct comp_renderer *r)
r->semaphores.render_complete = VK_NULL_HANDLE;
}
comp_layer_renderer_destroy(r->lr);
free(r->lr);
comp_layer_renderer_destroy(&(r->lr));
}
void