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 <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 47bc13d2b1
commit 03fe8686e3
  1. 4
      src/venus/vkr_device.c
  2. 18
      src/venus/vkr_physical_device.c

@ -151,10 +151,6 @@ vkr_dispatch_vkCreateDevice(struct vn_dispatch_context *dispatch,
struct vkr_physical_device *physical_dev = struct vkr_physical_device *physical_dev =
(struct vkr_physical_device *)args->physicalDevice; (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 */ /* append extensions for our own use */
const char **exts = NULL; const char **exts = NULL;

@ -299,10 +299,6 @@ vkr_dispatch_vkEnumerateDeviceExtensionProperties(
struct vkr_physical_device *physical_dev = struct vkr_physical_device *physical_dev =
(struct vkr_physical_device *)args->physicalDevice; (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) { if (args->pLayerName) {
vkr_cs_decoder_set_fatal(&ctx->decoder); vkr_cs_decoder_set_fatal(&ctx->decoder);
return; return;
@ -338,16 +334,11 @@ vkr_dispatch_vkGetPhysicalDeviceFeatures(
static void static void
vkr_dispatch_vkGetPhysicalDeviceProperties( vkr_dispatch_vkGetPhysicalDeviceProperties(
struct vn_dispatch_context *dispatch, UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkGetPhysicalDeviceProperties *args) struct vn_command_vkGetPhysicalDeviceProperties *args)
{ {
struct vkr_context *ctx = dispatch->data;
struct vkr_physical_device *physical_dev = struct vkr_physical_device *physical_dev =
(struct vkr_physical_device *)args->physicalDevice; (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; *args->pProperties = physical_dev->properties;
} }
@ -416,16 +407,11 @@ vkr_dispatch_vkGetPhysicalDeviceFeatures2(
static void static void
vkr_dispatch_vkGetPhysicalDeviceProperties2( vkr_dispatch_vkGetPhysicalDeviceProperties2(
struct vn_dispatch_context *dispatch, UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkGetPhysicalDeviceProperties2 *args) struct vn_command_vkGetPhysicalDeviceProperties2 *args)
{ {
struct vkr_context *ctx = dispatch->data;
struct vkr_physical_device *physical_dev = struct vkr_physical_device *physical_dev =
(struct vkr_physical_device *)args->physicalDevice; (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); vn_replace_vkGetPhysicalDeviceProperties2_args_handle(args);
vkGetPhysicalDeviceProperties2(args->physicalDevice, args->pProperties); vkGetPhysicalDeviceProperties2(args->physicalDevice, args->pProperties);

Loading…
Cancel
Save