vkr: let vkr_device_add_object track objects

We finally have dev readily available to be passed to
vkr_device_add_object.

Let vkr_device_remove_object call list_del as well.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
macos/master
Chia-I Wu 3 years ago
parent 21cac2bfc0
commit a77af35cd4
  1. 4
      src/venus/vkr_device.c
  2. 19
      src/venus/vkr_device.h
  3. 11
      src/venus/vkr_device_object.py
  4. 4
      src/venus/vkr_render_pass.c

@ -317,9 +317,7 @@ vkr_device_object_destroy(struct vkr_context *ctx,
break;
};
list_del(&obj->track_head);
vkr_device_remove_object(ctx, obj);
vkr_device_remove_object(ctx, dev, obj);
}
void

@ -75,18 +75,25 @@ vkr_device_should_track_object(const struct vkr_object *obj)
}
static inline void
vkr_device_add_object(struct vkr_context *ctx, struct vkr_object *obj)
vkr_device_add_object(struct vkr_context *ctx,
struct vkr_device *dev,
struct vkr_object *obj)
{
assert(vkr_device_should_track_object(obj));
/* TODO add to dev->objects */
vkr_context_add_object(ctx, obj);
assert(vkr_device_should_track_object(obj));
list_add(&obj->track_head, &dev->objects);
}
static inline void
vkr_device_remove_object(struct vkr_context *ctx, struct vkr_object *obj)
vkr_device_remove_object(struct vkr_context *ctx,
UNUSED struct vkr_device *dev,
struct vkr_object *obj)
{
/* TODO remove from dev->objects */
assert(vkr_device_should_track_object(obj));
list_del(&obj->track_head);
/* this frees obj */
vkr_context_remove_object(ctx, obj);
}

@ -180,8 +180,7 @@ vkr_{create_func_name}_create_and_add(
if (!obj)
return NULL;
list_add(&obj->base.track_head, &dev->objects);
vkr_device_add_object(ctx, &obj->base);
vkr_device_add_object(ctx, dev, &obj->base);
return obj;
}}
'''
@ -227,9 +226,7 @@ vkr_{create_func_name}_add_array(
obj->base.handle.{vkr_type} = (({vk_type} *)arr->handle_storage)[i];
list_add(&obj->base.track_head, &dev->objects);
vkr_device_add_object(ctx, &obj->base);
vkr_device_add_object(ctx, dev, &obj->base);
}}
arr->objects_stolen = true;
@ -244,14 +241,14 @@ vkr_{destroy_func_name}_destroy_and_remove(
struct vkr_context *ctx,
struct vn_command_{destroy_cmd} *args)
{{
struct vkr_device *dev = vkr_device_from_handle(args->device);
struct vkr_{vkr_type} *obj = vkr_{vkr_type}_from_handle(args->{destroy_obj});
if (!obj)
return;
vkr_{destroy_func_name}_destroy_driver_handle(ctx, args);
list_del(&obj->base.track_head);
vkr_device_remove_object(ctx, &obj->base);
vkr_device_remove_object(ctx, dev, &obj->base);
}}
'''

@ -36,9 +36,7 @@ vkr_dispatch_vkCreateRenderPass2(struct vn_dispatch_context *dispatch,
return;
}
list_add(&pass->base.track_head, &dev->objects);
vkr_device_add_object(ctx, &pass->base);
vkr_device_add_object(ctx, dev, &pass->base);
}
static void

Loading…
Cancel
Save