vkr: remove {CREATE,DESTROY}_OBJECT

Define two more helper functions and call the helper functions directly.

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 6099cfc0f8
commit 3cef4f1243
  1. 22
      src/venus/vkr_buffer.c
  2. 15
      src/venus/vkr_command_buffer.c
  3. 24
      src/venus/vkr_common.h
  4. 47
      src/venus/vkr_descriptor_set.c
  5. 46
      src/venus/vkr_device_object.py
  6. 48
      src/venus/vkr_image.c
  7. 46
      src/venus/vkr_pipeline.c
  8. 12
      src/venus/vkr_query_pool.c
  9. 36
      src/venus/vkr_queue.c
  10. 24
      src/venus/vkr_render_pass.c

@ -34,20 +34,14 @@ vkr_dispatch_vkCreateBuffer(struct vn_dispatch_context *dispatch,
} }
#endif #endif
CREATE_OBJECT(buf, buffer, BUFFER, vkCreateBuffer, pBuffer); vkr_buffer_create_and_add(ctx, args);
vkr_device_add_object(ctx, &buf->base);
} }
static void static void
vkr_dispatch_vkDestroyBuffer(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroyBuffer(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyBuffer *args) struct vn_command_vkDestroyBuffer *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_buffer_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(buf, buffer, BUFFER, vkDestroyBuffer, buffer);
vkr_device_remove_object(ctx, &buf->base);
} }
static void static void
@ -110,22 +104,14 @@ static void
vkr_dispatch_vkCreateBufferView(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreateBufferView(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateBufferView *args) struct vn_command_vkCreateBufferView *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_buffer_view_create_and_add(dispatch->data, args);
CREATE_OBJECT(view, buffer_view, BUFFER_VIEW, vkCreateBufferView, pView);
vkr_device_add_object(ctx, &view->base);
} }
static void static void
vkr_dispatch_vkDestroyBufferView(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroyBufferView(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyBufferView *args) struct vn_command_vkDestroyBufferView *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_buffer_view_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(view, buffer_view, BUFFER_VIEW, vkDestroyBufferView, bufferView);
vkr_device_remove_object(ctx, &view->base);
} }
void void

@ -11,13 +11,11 @@ static void
vkr_dispatch_vkCreateCommandPool(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreateCommandPool(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateCommandPool *args) struct vn_command_vkCreateCommandPool *args)
{ {
struct vkr_context *ctx = dispatch->data; struct vkr_command_pool *pool = vkr_command_pool_create_and_add(dispatch->data, args);
if (!pool)
CREATE_OBJECT(pool, command_pool, COMMAND_POOL, vkCreateCommandPool, pCommandPool); return;
list_inithead(&pool->command_buffers); list_inithead(&pool->command_buffers);
vkr_device_add_object(ctx, &pool->base);
} }
static void static void
@ -25,11 +23,14 @@ vkr_dispatch_vkDestroyCommandPool(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyCommandPool *args) struct vn_command_vkDestroyCommandPool *args)
{ {
struct vkr_context *ctx = dispatch->data; struct vkr_context *ctx = dispatch->data;
struct vkr_command_pool *pool = vkr_command_pool_from_handle(args->commandPool);
DESTROY_OBJECT(pool, command_pool, COMMAND_POOL, vkDestroyCommandPool, commandPool); if (!pool)
return;
vkr_context_remove_objects(ctx, &pool->command_buffers); vkr_context_remove_objects(ctx, &pool->command_buffers);
vkr_device_remove_object(ctx, &pool->base);
vkr_command_pool_destroy_and_remove(ctx, args);
} }
static void static void

@ -59,30 +59,6 @@
return obj; \ return obj; \
} }
/*
* TODO Most of the functions are generated. Some of them are then
* hand-edited. Find a better/cleaner way to reduce manual works.
*
* These macros may shadow your variables. Use with care.
*/
#define CREATE_OBJECT(obj, vkr_type, vk_obj, vk_cmd, vk_arg) \
struct vkr_device *_dev = vkr_device_from_handle(args->device); \
\
struct vkr_##vkr_type *obj = vkr_##vkr_type##_create(ctx, args); \
if (!obj) \
return; \
\
list_add(&obj->base.track_head, &_dev->objects)
#define DESTROY_OBJECT(obj, vkr_type, vk_obj, vk_cmd, vk_arg) \
struct vkr_##vkr_type *obj = vkr_##vkr_type##_from_handle(args->vk_arg); \
if (!obj) \
return; \
\
vkr_##vkr_type##_destroy_driver_handle(ctx, args); \
\
list_del(&obj->base.track_head)
struct vkr_context; struct vkr_context;
struct vkr_instance; struct vkr_instance;
struct vkr_physical_device; struct vkr_physical_device;

@ -21,12 +21,7 @@ vkr_dispatch_vkCreateDescriptorSetLayout(
struct vn_dispatch_context *dispatch, struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateDescriptorSetLayout *args) struct vn_command_vkCreateDescriptorSetLayout *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_descriptor_set_layout_create_and_add(dispatch->data, args);
CREATE_OBJECT(layout, descriptor_set_layout, DESCRIPTOR_SET_LAYOUT,
vkCreateDescriptorSetLayout, pSetLayout);
vkr_device_add_object(ctx, &layout->base);
} }
static void static void
@ -34,26 +29,19 @@ vkr_dispatch_vkDestroyDescriptorSetLayout(
struct vn_dispatch_context *dispatch, struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyDescriptorSetLayout *args) struct vn_command_vkDestroyDescriptorSetLayout *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_descriptor_set_layout_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(layout, descriptor_set_layout, DESCRIPTOR_SET_LAYOUT,
vkDestroyDescriptorSetLayout, descriptorSetLayout);
vkr_device_remove_object(ctx, &layout->base);
} }
static void static void
vkr_dispatch_vkCreateDescriptorPool(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreateDescriptorPool(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateDescriptorPool *args) struct vn_command_vkCreateDescriptorPool *args)
{ {
struct vkr_context *ctx = dispatch->data; struct vkr_descriptor_pool *pool =
vkr_descriptor_pool_create_and_add(dispatch->data, args);
CREATE_OBJECT(pool, descriptor_pool, DESCRIPTOR_POOL, vkCreateDescriptorPool, if (!pool)
pDescriptorPool); return;
list_inithead(&pool->descriptor_sets); list_inithead(&pool->descriptor_sets);
vkr_device_add_object(ctx, &pool->base);
} }
static void static void
@ -61,12 +49,15 @@ vkr_dispatch_vkDestroyDescriptorPool(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyDescriptorPool *args) struct vn_command_vkDestroyDescriptorPool *args)
{ {
struct vkr_context *ctx = dispatch->data; struct vkr_context *ctx = dispatch->data;
struct vkr_descriptor_pool *pool =
vkr_descriptor_pool_from_handle(args->descriptorPool);
DESTROY_OBJECT(pool, descriptor_pool, DESCRIPTOR_POOL, vkDestroyDescriptorPool, if (!pool)
descriptorPool); return;
vkr_context_remove_objects(ctx, &pool->descriptor_sets); vkr_context_remove_objects(ctx, &pool->descriptor_sets);
vkr_device_remove_object(ctx, &pool->base);
vkr_descriptor_pool_destroy_and_remove(ctx, args);
} }
static void static void
@ -138,12 +129,7 @@ vkr_dispatch_vkCreateDescriptorUpdateTemplate(
struct vn_dispatch_context *dispatch, struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateDescriptorUpdateTemplate *args) struct vn_command_vkCreateDescriptorUpdateTemplate *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_descriptor_update_template_create_and_add(dispatch->data, args);
CREATE_OBJECT(templ, descriptor_update_template, DESCRIPTOR_UPDATE_TEMPLATE,
vkCreateDescriptorUpdateTemplate, pDescriptorUpdateTemplate);
vkr_device_add_object(ctx, &templ->base);
} }
static void static void
@ -151,12 +137,7 @@ vkr_dispatch_vkDestroyDescriptorUpdateTemplate(
struct vn_dispatch_context *dispatch, struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyDescriptorUpdateTemplate *args) struct vn_command_vkDestroyDescriptorUpdateTemplate *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_descriptor_update_template_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(templ, descriptor_update_template, DESCRIPTOR_UPDATE_TEMPLATE,
vkDestroyDescriptorUpdateTemplate, descriptorUpdateTemplate);
vkr_device_remove_object(ctx, &templ->base);
} }
void void

@ -167,6 +167,25 @@ vkr_{create_func_name}_create_array(
POOL_OBJECT_CREATE_ARRAY_TEMPL = COMMON_OBJECT_CREATE_ARRAY_TEMPL POOL_OBJECT_CREATE_ARRAY_TEMPL = COMMON_OBJECT_CREATE_ARRAY_TEMPL
PIPELINE_OBJECT_CREATE_ARRAY_TEMPL = COMMON_OBJECT_CREATE_ARRAY_TEMPL PIPELINE_OBJECT_CREATE_ARRAY_TEMPL = COMMON_OBJECT_CREATE_ARRAY_TEMPL
SIMPLE_OBJECT_CREATE_AND_ADD_TEMPL = '''
/* create a vkr_{vkr_type} and add it to the vkr_device */
static inline struct vkr_{vkr_type} *
vkr_{create_func_name}_create_and_add(
struct vkr_context *ctx,
struct vn_command_{create_cmd} *args)
{{
struct vkr_device *dev = vkr_device_from_handle(args->device);
struct vkr_{vkr_type} *obj = vkr_{create_func_name}_create(ctx, args);
if (!obj)
return NULL;
list_add(&obj->base.track_head, &dev->objects);
vkr_device_add_object(ctx, &obj->base);
return obj;
}}
'''
POOL_OBJECT_ADD_ARRAY_TEMPL = ''' POOL_OBJECT_ADD_ARRAY_TEMPL = '''
/* steal vkr_{vkr_type}s from an object_array and add them to the /* steal vkr_{vkr_type}s from an object_array and add them to the
* vkr_{pool_type} and the context * vkr_{pool_type} and the context
@ -218,6 +237,26 @@ vkr_{create_func_name}_add_array(
}} }}
''' '''
SIMPLE_OBJECT_DESTROY_AND_REMOVE_TEMPL = '''
/* remove a vkr_{vkr_type} from the device and destroy it */
static inline void
vkr_{destroy_func_name}_destroy_and_remove(
struct vkr_context *ctx,
struct vn_command_{destroy_cmd} *args)
{{
struct vkr_{vkr_type} *obj = vkr_{vkr_type}_from_handle(args->{destroy_obj});
if (!obj)
return;
vkr_{destroy_func_name}_destroy_driver_handle(ctx, args);
list_del(&obj->base.track_head);
vkr_device_remove_object(ctx, &obj->base);
}}
'''
PIPELINE_OBJECT_DESTROY_AND_REMOVE_TEMPL = SIMPLE_OBJECT_DESTROY_AND_REMOVE_TEMPL
def apply_variant(json_obj, json_variant): def apply_variant(json_obj, json_variant):
tmp_obj = json_obj.copy() tmp_obj = json_obj.copy()
for key, val in json_variant.items(): for key, val in json_variant.items():
@ -235,6 +274,7 @@ def simple_object_generator(json_obj):
SIMPLE_OBJECT_CREATE_DRIVER_HANDLE_TEMPL defines a function for (2). SIMPLE_OBJECT_CREATE_DRIVER_HANDLE_TEMPL defines a function for (2).
SIMPLE_OBJECT_CREATE_TEMPL defines a function for (1) and (2). SIMPLE_OBJECT_CREATE_TEMPL defines a function for (1) and (2).
SIMPLE_OBJECT_CREATE_AND_ADD_TEMPL defines a function for all steps.
Object destruction can be broken down into 2 steps Object destruction can be broken down into 2 steps
@ -242,18 +282,22 @@ def simple_object_generator(json_obj):
(2) remove the object from the device and the object table (2) remove the object from the device and the object table
SIMPLE_OBJECT_DESTROY_DRIVER_HANDLE_TEMPL defines a function for (1). SIMPLE_OBJECT_DESTROY_DRIVER_HANDLE_TEMPL defines a function for (1).
SIMPLE_OBJECT_DESTROY_AND_REMOVE_TEMPL defines a function for both steps.
''' '''
contents = '' contents = ''
contents += SIMPLE_OBJECT_CREATE_DRIVER_HANDLE_TEMPL.format(**json_obj) contents += SIMPLE_OBJECT_CREATE_DRIVER_HANDLE_TEMPL.format(**json_obj)
contents += SIMPLE_OBJECT_CREATE_TEMPL.format(**json_obj) contents += SIMPLE_OBJECT_CREATE_TEMPL.format(**json_obj)
contents += SIMPLE_OBJECT_CREATE_AND_ADD_TEMPL.format(**json_obj)
contents += SIMPLE_OBJECT_DESTROY_DRIVER_HANDLE_TEMPL.format(**json_obj) contents += SIMPLE_OBJECT_DESTROY_DRIVER_HANDLE_TEMPL.format(**json_obj)
contents += SIMPLE_OBJECT_DESTROY_AND_REMOVE_TEMPL.format(**json_obj)
for json_variant in json_obj['variants']: for json_variant in json_obj['variants']:
tmp_obj = apply_variant(json_obj, json_variant) tmp_obj = apply_variant(json_obj, json_variant)
contents += SIMPLE_OBJECT_CREATE_DRIVER_HANDLE_TEMPL.format(**tmp_obj) contents += SIMPLE_OBJECT_CREATE_DRIVER_HANDLE_TEMPL.format(**tmp_obj)
contents += SIMPLE_OBJECT_CREATE_TEMPL.format(**tmp_obj) contents += SIMPLE_OBJECT_CREATE_TEMPL.format(**tmp_obj)
contents += SIMPLE_OBJECT_CREATE_AND_ADD_TEMPL.format(**tmp_obj)
return contents return contents
@ -313,6 +357,7 @@ def pipeline_object_generator(json_obj):
(2) remove the object from the device and the object table (2) remove the object from the device and the object table
PIPELINE_OBJECT_DESTROY_DRIVER_HANDLE_TEMPL defines a function for (1). PIPELINE_OBJECT_DESTROY_DRIVER_HANDLE_TEMPL defines a function for (1).
PIPELINE_OBJECT_DESTROY_AND_REMOVE_TEMPL defines a function for both steps.
''' '''
contents = '' contents = ''
@ -326,6 +371,7 @@ def pipeline_object_generator(json_obj):
contents += PIPELINE_OBJECT_ADD_ARRAY_TEMPL.format(**tmp_obj) contents += PIPELINE_OBJECT_ADD_ARRAY_TEMPL.format(**tmp_obj)
contents += PIPELINE_OBJECT_DESTROY_DRIVER_HANDLE_TEMPL.format(**json_obj) contents += PIPELINE_OBJECT_DESTROY_DRIVER_HANDLE_TEMPL.format(**json_obj)
contents += PIPELINE_OBJECT_DESTROY_AND_REMOVE_TEMPL.format(**json_obj)
for json_variant in json_obj['variants']: for json_variant in json_obj['variants']:
tmp_obj = apply_variant(json_obj, json_variant) tmp_obj = apply_variant(json_obj, json_variant)

@ -38,20 +38,14 @@ vkr_dispatch_vkCreateImage(struct vn_dispatch_context *dispatch,
} }
#endif #endif
CREATE_OBJECT(img, image, IMAGE, vkCreateImage, pImage); vkr_image_create_and_add(ctx, args);
vkr_device_add_object(ctx, &img->base);
} }
static void static void
vkr_dispatch_vkDestroyImage(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroyImage(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyImage *args) struct vn_command_vkDestroyImage *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_image_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(img, image, IMAGE, vkDestroyImage, image);
vkr_device_remove_object(ctx, &img->base);
} }
static void static void
@ -137,44 +131,28 @@ static void
vkr_dispatch_vkCreateImageView(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreateImageView(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateImageView *args) struct vn_command_vkCreateImageView *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_image_view_create_and_add(dispatch->data, args);
CREATE_OBJECT(view, image_view, IMAGE_VIEW, vkCreateImageView, pView);
vkr_device_add_object(ctx, &view->base);
} }
static void static void
vkr_dispatch_vkDestroyImageView(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroyImageView(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyImageView *args) struct vn_command_vkDestroyImageView *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_image_view_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(view, image_view, IMAGE_VIEW, vkDestroyImageView, imageView);
vkr_device_remove_object(ctx, &view->base);
} }
static void static void
vkr_dispatch_vkCreateSampler(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreateSampler(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateSampler *args) struct vn_command_vkCreateSampler *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_sampler_create_and_add(dispatch->data, args);
CREATE_OBJECT(sampler, sampler, SAMPLER, vkCreateSampler, pSampler);
vkr_device_add_object(ctx, &sampler->base);
} }
static void static void
vkr_dispatch_vkDestroySampler(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroySampler(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroySampler *args) struct vn_command_vkDestroySampler *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_sampler_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(sampler, sampler, SAMPLER, vkDestroySampler, sampler);
vkr_device_remove_object(ctx, &sampler->base);
} }
static void static void
@ -182,12 +160,7 @@ vkr_dispatch_vkCreateSamplerYcbcrConversion(
struct vn_dispatch_context *dispatch, struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateSamplerYcbcrConversion *args) struct vn_command_vkCreateSamplerYcbcrConversion *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_sampler_ycbcr_conversion_create_and_add(dispatch->data, args);
CREATE_OBJECT(conv, sampler_ycbcr_conversion, SAMPLER_YCBCR_CONVERSION,
vkCreateSamplerYcbcrConversion, pYcbcrConversion);
vkr_device_add_object(ctx, &conv->base);
} }
static void static void
@ -195,12 +168,7 @@ vkr_dispatch_vkDestroySamplerYcbcrConversion(
struct vn_dispatch_context *dispatch, struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroySamplerYcbcrConversion *args) struct vn_command_vkDestroySamplerYcbcrConversion *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_sampler_ycbcr_conversion_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(conv, sampler_ycbcr_conversion, SAMPLER_YCBCR_CONVERSION,
vkDestroySamplerYcbcrConversion, ycbcrConversion);
vkr_device_remove_object(ctx, &conv->base);
} }
void void

@ -11,70 +11,42 @@ static void
vkr_dispatch_vkCreateShaderModule(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreateShaderModule(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateShaderModule *args) struct vn_command_vkCreateShaderModule *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_shader_module_create_and_add(dispatch->data, args);
CREATE_OBJECT(mod, shader_module, SHADER_MODULE, vkCreateShaderModule, pShaderModule);
vkr_device_add_object(ctx, &mod->base);
} }
static void static void
vkr_dispatch_vkDestroyShaderModule(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroyShaderModule(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyShaderModule *args) struct vn_command_vkDestroyShaderModule *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_shader_module_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(mod, shader_module, SHADER_MODULE, vkDestroyShaderModule, shaderModule);
vkr_device_remove_object(ctx, &mod->base);
} }
static void static void
vkr_dispatch_vkCreatePipelineLayout(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreatePipelineLayout(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreatePipelineLayout *args) struct vn_command_vkCreatePipelineLayout *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_pipeline_layout_create_and_add(dispatch->data, args);
CREATE_OBJECT(layout, pipeline_layout, PIPELINE_LAYOUT, vkCreatePipelineLayout,
pPipelineLayout);
vkr_device_add_object(ctx, &layout->base);
} }
static void static void
vkr_dispatch_vkDestroyPipelineLayout(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroyPipelineLayout(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyPipelineLayout *args) struct vn_command_vkDestroyPipelineLayout *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_pipeline_layout_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(layout, pipeline_layout, PIPELINE_LAYOUT, vkDestroyPipelineLayout,
pipelineLayout);
vkr_device_remove_object(ctx, &layout->base);
} }
static void static void
vkr_dispatch_vkCreatePipelineCache(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreatePipelineCache(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreatePipelineCache *args) struct vn_command_vkCreatePipelineCache *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_pipeline_cache_create_and_add(dispatch->data, args);
CREATE_OBJECT(cache, pipeline_cache, PIPELINE_CACHE, vkCreatePipelineCache,
pPipelineCache);
vkr_device_add_object(ctx, &cache->base);
} }
static void static void
vkr_dispatch_vkDestroyPipelineCache(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroyPipelineCache(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyPipelineCache *args) struct vn_command_vkDestroyPipelineCache *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_pipeline_cache_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(cache, pipeline_cache, PIPELINE_CACHE, vkDestroyPipelineCache,
pipelineCache);
vkr_device_remove_object(ctx, &cache->base);
} }
static void static void
@ -127,11 +99,7 @@ static void
vkr_dispatch_vkDestroyPipeline(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroyPipeline(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyPipeline *args) struct vn_command_vkDestroyPipeline *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_pipeline_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(pipeline, pipeline, PIPELINE, vkDestroyPipeline, pipeline);
vkr_device_remove_object(ctx, &pipeline->base);
} }
void void

@ -11,22 +11,14 @@ static void
vkr_dispatch_vkCreateQueryPool(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreateQueryPool(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateQueryPool *args) struct vn_command_vkCreateQueryPool *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_query_pool_create_and_add(dispatch->data, args);
CREATE_OBJECT(pool, query_pool, QUERY_POOL, vkCreateQueryPool, pQueryPool);
vkr_device_add_object(ctx, &pool->base);
} }
static void static void
vkr_dispatch_vkDestroyQueryPool(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroyQueryPool(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyQueryPool *args) struct vn_command_vkDestroyQueryPool *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_query_pool_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(pool, query_pool, QUERY_POOL, vkDestroyQueryPool, queryPool);
vkr_device_remove_object(ctx, &pool->base);
} }
static void static void

@ -383,22 +383,14 @@ static void
vkr_dispatch_vkCreateFence(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreateFence(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateFence *args) struct vn_command_vkCreateFence *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_fence_create_and_add(dispatch->data, args);
CREATE_OBJECT(fence, fence, FENCE, vkCreateFence, pFence);
vkr_device_add_object(ctx, &fence->base);
} }
static void static void
vkr_dispatch_vkDestroyFence(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroyFence(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyFence *args) struct vn_command_vkDestroyFence *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_fence_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(fence, fence, FENCE, vkDestroyFence, fence);
vkr_device_remove_object(ctx, &fence->base);
} }
static void static void
@ -442,22 +434,14 @@ static void
vkr_dispatch_vkCreateSemaphore(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreateSemaphore(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateSemaphore *args) struct vn_command_vkCreateSemaphore *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_semaphore_create_and_add(dispatch->data, args);
CREATE_OBJECT(sem, semaphore, SEMAPHORE, vkCreateSemaphore, pSemaphore);
vkr_device_add_object(ctx, &sem->base);
} }
static void static void
vkr_dispatch_vkDestroySemaphore(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroySemaphore(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroySemaphore *args) struct vn_command_vkDestroySemaphore *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_semaphore_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(sem, semaphore, SEMAPHORE, vkDestroySemaphore, semaphore);
vkr_device_remove_object(ctx, &sem->base);
} }
static void static void
@ -501,22 +485,14 @@ static void
vkr_dispatch_vkCreateEvent(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreateEvent(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateEvent *args) struct vn_command_vkCreateEvent *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_event_create_and_add(dispatch->data, args);
CREATE_OBJECT(ev, event, EVENT, vkCreateEvent, pEvent);
vkr_device_add_object(ctx, &ev->base);
} }
static void static void
vkr_dispatch_vkDestroyEvent(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroyEvent(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyEvent *args) struct vn_command_vkDestroyEvent *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_event_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(ev, event, EVENT, vkDestroyEvent, event);
vkr_device_remove_object(ctx, &ev->base);
} }
static void static void

@ -11,11 +11,7 @@ static void
vkr_dispatch_vkCreateRenderPass(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreateRenderPass(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateRenderPass *args) struct vn_command_vkCreateRenderPass *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_render_pass_create_and_add(dispatch->data, args);
CREATE_OBJECT(pass, render_pass, RENDER_PASS, vkCreateRenderPass, pRenderPass);
vkr_device_add_object(ctx, &pass->base);
} }
static void static void
@ -49,11 +45,7 @@ static void
vkr_dispatch_vkDestroyRenderPass(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroyRenderPass(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyRenderPass *args) struct vn_command_vkDestroyRenderPass *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_render_pass_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(pass, render_pass, RENDER_PASS, vkDestroyRenderPass, renderPass);
vkr_device_remove_object(ctx, &pass->base);
} }
static void static void
@ -68,22 +60,14 @@ static void
vkr_dispatch_vkCreateFramebuffer(struct vn_dispatch_context *dispatch, vkr_dispatch_vkCreateFramebuffer(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateFramebuffer *args) struct vn_command_vkCreateFramebuffer *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_framebuffer_create_and_add(dispatch->data, args);
CREATE_OBJECT(fb, framebuffer, FRAMEBUFFER, vkCreateFramebuffer, pFramebuffer);
vkr_device_add_object(ctx, &fb->base);
} }
static void static void
vkr_dispatch_vkDestroyFramebuffer(struct vn_dispatch_context *dispatch, vkr_dispatch_vkDestroyFramebuffer(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyFramebuffer *args) struct vn_command_vkDestroyFramebuffer *args)
{ {
struct vkr_context *ctx = dispatch->data; vkr_framebuffer_destroy_and_remove(dispatch->data, args);
DESTROY_OBJECT(fb, framebuffer, FRAMEBUFFER, vkDestroyFramebuffer, framebuffer);
vkr_device_remove_object(ctx, &fb->base);
} }
void void

Loading…
Cancel
Save