vkr: remove ALLOCATE_POOL_OBJECTS

Expand the macro at the call sites because it is short enough.

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 a8a130d453
commit 6099cfc0f8
  1. 16
      src/venus/vkr_command_buffer.c
  2. 19
      src/venus/vkr_common.h
  3. 16
      src/venus/vkr_descriptor_set.c

@ -53,10 +53,20 @@ vkr_dispatch_vkAllocateCommandBuffers(struct vn_dispatch_context *dispatch,
struct vn_command_vkAllocateCommandBuffers *args) struct vn_command_vkAllocateCommandBuffers *args)
{ {
struct vkr_context *ctx = dispatch->data; struct vkr_context *ctx = dispatch->data;
struct vkr_device *dev = vkr_device_from_handle(args->device);
struct vkr_command_pool *pool =
vkr_command_pool_from_handle(args->pAllocateInfo->commandPool);
struct object_array arr;
ALLOCATE_POOL_OBJECTS(command_buffer, COMMAND_BUFFER, CommandBuffer, if (!pool) {
vkAllocateCommandBuffers, commandBufferCount, commandPool, vkr_cs_decoder_set_fatal(&ctx->decoder);
command_pool, COMMAND_POOL); return;
}
if (vkr_command_buffer_create_array(ctx, args, &arr) != VK_SUCCESS)
return;
vkr_command_buffer_add_array(ctx, dev, pool, &arr);
} }
static void static void

@ -83,25 +83,6 @@
\ \
list_del(&obj->base.track_head) list_del(&obj->base.track_head)
#define ALLOCATE_POOL_OBJECTS(vkr_type, vk_type, vk_obj, vk_cmd, arg_count, arg_pool, \
vkr_pool_type, vk_pool_type) \
do { \
struct vkr_device *dev = vkr_device_from_handle(args->device); \
\
struct vkr_##vkr_pool_type *pool = \
vkr_##vkr_pool_type##_from_handle(args->pAllocateInfo->arg_pool); \
if (!pool) { \
vkr_cs_decoder_set_fatal(&ctx->decoder); \
return; \
} \
\
struct object_array arr; \
if (vkr_##vkr_type##_create_array(ctx, args, &arr) != VK_SUCCESS) \
return; \
\
vkr_##vkr_type##_add_array(ctx, dev, pool, &arr); \
} while (0)
struct vkr_context; struct vkr_context;
struct vkr_instance; struct vkr_instance;
struct vkr_physical_device; struct vkr_physical_device;

@ -94,10 +94,20 @@ vkr_dispatch_vkAllocateDescriptorSets(struct vn_dispatch_context *dispatch,
struct vn_command_vkAllocateDescriptorSets *args) struct vn_command_vkAllocateDescriptorSets *args)
{ {
struct vkr_context *ctx = dispatch->data; struct vkr_context *ctx = dispatch->data;
struct vkr_device *dev = vkr_device_from_handle(args->device);
struct vkr_descriptor_pool *pool =
vkr_descriptor_pool_from_handle(args->pAllocateInfo->descriptorPool);
struct object_array arr;
if (!pool) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
if (vkr_descriptor_set_create_array(ctx, args, &arr) != VK_SUCCESS)
return;
ALLOCATE_POOL_OBJECTS(descriptor_set, DESCRIPTOR_SET, DescriptorSet, vkr_descriptor_set_add_array(ctx, dev, pool, &arr);
vkAllocateDescriptorSets, descriptorSetCount, descriptorPool,
descriptor_pool, DESCRIPTOR_POOL);
} }
static void static void

Loading…
Cancel
Save