vkr: destroy vkr_device at vkr_physical_device_destroy

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 bd28750890
commit c8255cd46c
  1. 35
      src/vkr_renderer.c

@ -1048,10 +1048,17 @@ vkr_dispatch_vkCreateInstance(struct vn_dispatch_context *dispatch,
ctx->instance = instance;
}
static void
vkr_device_destroy(struct vkr_context *ctx, struct vkr_device *dev);
static void
vkr_physical_device_destroy(struct vkr_context *ctx,
struct vkr_physical_device *physical_dev)
{
struct vkr_device *dev, *tmp;
LIST_FOR_EACH_ENTRY_SAFE (dev, tmp, &physical_dev->devices, base.track_head)
vkr_device_destroy(ctx, dev);
free(physical_dev->extensions);
util_hash_table_remove_u64(ctx->object_table, physical_dev->base.id);
@ -2042,18 +2049,8 @@ vkr_dispatch_vkCreateDevice(struct vn_dispatch_context *dispatch,
}
static void
vkr_dispatch_vkDestroyDevice(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyDevice *args)
vkr_device_destroy(struct vkr_context *ctx, struct vkr_device *dev)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_device *dev = (struct vkr_device *)args->device;
if (!dev || dev->base.type != VK_OBJECT_TYPE_DEVICE) {
if (dev)
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
VkDevice device = dev->base.handle.device;
VkResult ret = vkDeviceWaitIdle(device);
if (ret != VK_SUCCESS)
@ -2079,6 +2076,22 @@ vkr_dispatch_vkDestroyDevice(struct vn_dispatch_context *dispatch,
util_hash_table_remove_u64(ctx->object_table, dev->base.id);
}
static void
vkr_dispatch_vkDestroyDevice(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyDevice *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_device *dev = (struct vkr_device *)args->device;
if (!dev || dev->base.type != VK_OBJECT_TYPE_DEVICE) {
if (dev)
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
vkr_device_destroy(ctx, dev);
}
static void
vkr_dispatch_vkGetDeviceGroupPeerMemoryFeatures(
UNUSED struct vn_dispatch_context *dispatch,

Loading…
Cancel
Save