Commit dcc83cca authored by Marc-André Lureau's avatar Marc-André Lureau Committed by Dave Airlie
Browse files

renderer: unref resource when destroying hashtable element

Resources are reference-counted, if another object holds a reference to
a resource, it should not free it. Change the resource hashtable destroy
callback to unref.

Currently, this doesn't happen, since the resource hashtable is kept
until the renderer is reset. However, in the next commit, the destroy
callback will be used if a resource is replaced in the hashtable, and we
want to keep the original resource. Furthermore, even if replace
shouldn't happen, it avoids confusion and future errors if use only
reference-counting mechanism.
Signed-off-by: default avatarMarc-André Lureau <>
parent 3ff41ae3
...@@ -4236,7 +4236,9 @@ void vrend_renderer_resource_destroy(struct vrend_resource *res, bool remove) ...@@ -4236,7 +4236,9 @@ void vrend_renderer_resource_destroy(struct vrend_resource *res, bool remove)
static void vrend_destroy_resource_object(void *obj_ptr) static void vrend_destroy_resource_object(void *obj_ptr)
{ {
struct vrend_resource *res = obj_ptr; struct vrend_resource *res = obj_ptr;
vrend_renderer_resource_destroy(res, false);
if (pipe_reference(&res->base.reference, NULL))
vrend_renderer_resource_destroy(res, false);
} }
void vrend_renderer_resource_unref(uint32_t res_handle) void vrend_renderer_resource_unref(uint32_t res_handle)
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