vkr: refactor to add vkr_physical_device_destroy

The same call cannot be reused in physical device enumeration error,
because apps can still normally destroy objects without mistake.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
macos/master
Yiwei Zhang 3 years ago
parent e2686dc422
commit aed086d399
  1. 14
      src/vkr_renderer.c

@ -1046,16 +1046,24 @@ vkr_dispatch_vkCreateInstance(struct vn_dispatch_context *dispatch,
ctx->instance = instance;
}
static void
vkr_physical_device_destroy(struct vkr_context *ctx,
struct vkr_physical_device *physical_dev)
{
free(physical_dev->extensions);
util_hash_table_remove_u64(ctx->object_table, physical_dev->base.id);
}
static void
vkr_instance_destroy(struct vkr_context *ctx, struct vkr_instance *instance)
{
/* TODO cleanup all objects instead? */
for (uint32_t i = 0; i < instance->physical_device_count; i++) {
struct vkr_physical_device *physical_dev = instance->physical_devices[i];
if (!physical_dev)
break;
free(physical_dev->extensions);
util_hash_table_remove_u64(ctx->object_table, physical_dev->base.id);
vkr_physical_device_destroy(ctx, physical_dev);
}
if (ctx->validate_level != VKR_CONTEXT_VALIDATE_NONE) {

Loading…
Cancel
Save