Commit 04c9a7d8 authored by Ryan Pavlik's avatar Ryan Pavlik Committed by Jakob Bornecrantz
Browse files

c/main: Normalize comp_layer_renderer_destroy convention.

parent ffe458fd
......@@ -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
......
......@@ -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.
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment