From e8b4029d0eba2b49c0b663f59043f16dfca92ce1 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 9 Aug 2021 14:52:50 -0700 Subject: [PATCH] vkr: remove manual object type validation It is covered by vkr_cs_decoder_lookup_object. Signed-off-by: Chia-I Wu Reviewed-by: Yiwei Zhang Reviewed-by: Ryan Neph --- src/venus/vkr_common.h | 11 ++--------- src/venus/vkr_descriptor_set.c | 2 +- src/venus/vkr_device_memory.c | 5 +---- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/venus/vkr_common.h b/src/venus/vkr_common.h index 7793481..9137245 100644 --- a/src/venus/vkr_common.h +++ b/src/venus/vkr_common.h @@ -74,11 +74,8 @@ #define DESTROY_OBJECT(obj, vkr_type, vk_obj, vk_cmd, vk_arg) \ struct vkr_##vkr_type *obj = (struct vkr_##vkr_type *)(uintptr_t)args->vk_arg; \ - if (!obj || obj->base.type != VK_OBJECT_TYPE_##vk_obj) { \ - if (obj) \ - vkr_cs_decoder_set_fatal(&ctx->decoder); \ + if (!obj) \ return; \ - } \ \ vn_replace_##vk_cmd##_args_handle(args); \ vk_cmd(args->device, args->vk_arg, NULL); \ @@ -92,7 +89,7 @@ \ struct vkr_##vkr_pool_type *pool = \ (struct vkr_##vkr_pool_type *)(uintptr_t)args->pAllocateInfo->arg_pool; \ - if (!pool || pool->base.type != VK_OBJECT_TYPE_##vk_pool_type) { \ + if (!pool) { \ vkr_cs_decoder_set_fatal(&ctx->decoder); \ return; \ } \ @@ -137,10 +134,6 @@ struct vkr_##vkr_type *obj = (struct vkr_##vkr_type *)args->arg_obj[i]; \ if (!obj) \ continue; \ - if (obj->base.type != VK_OBJECT_TYPE_##vk_type) { \ - vkr_cs_decoder_set_fatal(&ctx->decoder); \ - return; \ - } \ \ list_del(&obj->base.track_head); \ list_addtail(&obj->base.track_head, &free_list); \ diff --git a/src/venus/vkr_descriptor_set.c b/src/venus/vkr_descriptor_set.c index f660538..3790a90 100644 --- a/src/venus/vkr_descriptor_set.c +++ b/src/venus/vkr_descriptor_set.c @@ -83,7 +83,7 @@ vkr_dispatch_vkResetDescriptorPool(struct vn_dispatch_context *dispatch, struct vkr_descriptor_pool *pool = (struct vkr_descriptor_pool *)(uintptr_t)args->descriptorPool; - if (!pool || pool->base.type != VK_OBJECT_TYPE_DESCRIPTOR_POOL) { + if (!pool) { vkr_cs_decoder_set_fatal(&ctx->decoder); return; } diff --git a/src/venus/vkr_device_memory.c b/src/venus/vkr_device_memory.c index 3707695..fe0c67e 100644 --- a/src/venus/vkr_device_memory.c +++ b/src/venus/vkr_device_memory.c @@ -160,11 +160,8 @@ vkr_dispatch_vkFreeMemory(struct vn_dispatch_context *dispatch, struct vkr_context *ctx = dispatch->data; struct vkr_device_memory *mem = (struct vkr_device_memory *)(uintptr_t)args->memory; - if (!mem || mem->base.type != VK_OBJECT_TYPE_DEVICE_MEMORY) { - if (mem) - vkr_cs_decoder_set_fatal(&ctx->decoder); + if (!mem) return; - } vn_replace_vkFreeMemory_args_handle(args); vkFreeMemory(args->device, args->memory, NULL);