From 03fe8686e34d81d4b68c0fa0f8744a22215b4f97 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 9 Aug 2021 14:47:50 -0700 Subject: [PATCH] vkr: remove manual physical device validation The decoder makes sure the physical device pointer is non-NULL since 0f12c460 ("vkr: make sure the first dispatchable handle is non-NULL"). And vkr_cs_decoder_lookup_object is just fixed to validate the object type. Signed-off-by: Chia-I Wu Reviewed-by: Yiwei Zhang Reviewed-by: Ryan Neph --- src/venus/vkr_device.c | 4 ---- src/venus/vkr_physical_device.c | 18 ++---------------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/venus/vkr_device.c b/src/venus/vkr_device.c index 223b70d..118efad 100644 --- a/src/venus/vkr_device.c +++ b/src/venus/vkr_device.c @@ -151,10 +151,6 @@ vkr_dispatch_vkCreateDevice(struct vn_dispatch_context *dispatch, struct vkr_physical_device *physical_dev = (struct vkr_physical_device *)args->physicalDevice; - if (!physical_dev || physical_dev->base.type != VK_OBJECT_TYPE_PHYSICAL_DEVICE) { - vkr_cs_decoder_set_fatal(&ctx->decoder); - return; - } /* append extensions for our own use */ const char **exts = NULL; diff --git a/src/venus/vkr_physical_device.c b/src/venus/vkr_physical_device.c index 82299e6..a9afb3a 100644 --- a/src/venus/vkr_physical_device.c +++ b/src/venus/vkr_physical_device.c @@ -299,10 +299,6 @@ vkr_dispatch_vkEnumerateDeviceExtensionProperties( struct vkr_physical_device *physical_dev = (struct vkr_physical_device *)args->physicalDevice; - if (!physical_dev || physical_dev->base.type != VK_OBJECT_TYPE_PHYSICAL_DEVICE) { - vkr_cs_decoder_set_fatal(&ctx->decoder); - return; - } if (args->pLayerName) { vkr_cs_decoder_set_fatal(&ctx->decoder); return; @@ -338,16 +334,11 @@ vkr_dispatch_vkGetPhysicalDeviceFeatures( static void vkr_dispatch_vkGetPhysicalDeviceProperties( - struct vn_dispatch_context *dispatch, + UNUSED struct vn_dispatch_context *dispatch, struct vn_command_vkGetPhysicalDeviceProperties *args) { - struct vkr_context *ctx = dispatch->data; struct vkr_physical_device *physical_dev = (struct vkr_physical_device *)args->physicalDevice; - if (!physical_dev || physical_dev->base.type != VK_OBJECT_TYPE_PHYSICAL_DEVICE) { - vkr_cs_decoder_set_fatal(&ctx->decoder); - return; - } *args->pProperties = physical_dev->properties; } @@ -416,16 +407,11 @@ vkr_dispatch_vkGetPhysicalDeviceFeatures2( static void vkr_dispatch_vkGetPhysicalDeviceProperties2( - struct vn_dispatch_context *dispatch, + UNUSED struct vn_dispatch_context *dispatch, struct vn_command_vkGetPhysicalDeviceProperties2 *args) { - struct vkr_context *ctx = dispatch->data; struct vkr_physical_device *physical_dev = (struct vkr_physical_device *)args->physicalDevice; - if (!physical_dev || physical_dev->base.type != VK_OBJECT_TYPE_PHYSICAL_DEVICE) { - vkr_cs_decoder_set_fatal(&ctx->decoder); - return; - } vn_replace_vkGetPhysicalDeviceProperties2_args_handle(args); vkGetPhysicalDeviceProperties2(args->physicalDevice, args->pProperties);