From 77f796ea5682de12b704e3d139da53c6ad004fd9 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 9 Aug 2021 11:54:57 -0700 Subject: [PATCH] vkr: use vkr_device_{add,remove}_object Use them for objects that are tracked as device objects. This excludes VkQueue, VkDescriptorSet, and VkCommandBuffer. Signed-off-by: Chia-I Wu Reviewed-by: Ryan Neph Reviewed-by: Yiwei Zhang --- src/venus/vkr_buffer.c | 8 ++++---- src/venus/vkr_command_buffer.c | 4 ++-- src/venus/vkr_common.h | 2 +- src/venus/vkr_descriptor_set.c | 12 ++++++------ src/venus/vkr_device.c | 2 +- src/venus/vkr_device_memory.c | 4 ++-- src/venus/vkr_image.c | 16 ++++++++-------- src/venus/vkr_pipeline.c | 14 +++++++------- src/venus/vkr_query_pool.c | 4 ++-- src/venus/vkr_queue.c | 12 ++++++------ src/venus/vkr_render_pass.c | 10 +++++----- 11 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/venus/vkr_buffer.c b/src/venus/vkr_buffer.c index 37847b2..050b3b7 100644 --- a/src/venus/vkr_buffer.c +++ b/src/venus/vkr_buffer.c @@ -44,7 +44,7 @@ vkr_dispatch_vkCreateBuffer(struct vn_dispatch_context *dispatch, CREATE_OBJECT(buf, buffer, BUFFER, vkCreateBuffer, pBuffer); - util_hash_table_set_u64(ctx->object_table, buf->base.id, buf); + vkr_device_add_object(ctx, &buf->base); } static void @@ -55,7 +55,7 @@ vkr_dispatch_vkDestroyBuffer(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(buf, buffer, BUFFER, vkDestroyBuffer, buffer); - util_hash_table_remove_u64(ctx->object_table, buf->base.id); + vkr_device_remove_object(ctx, &buf->base); } static void @@ -132,7 +132,7 @@ vkr_dispatch_vkCreateBufferView(struct vn_dispatch_context *dispatch, CREATE_OBJECT(view, buffer_view, BUFFER_VIEW, vkCreateBufferView, pView); - util_hash_table_set_u64(ctx->object_table, view->base.id, view); + vkr_device_add_object(ctx, &view->base); } static void @@ -143,7 +143,7 @@ vkr_dispatch_vkDestroyBufferView(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(view, buffer_view, BUFFER_VIEW, vkDestroyBufferView, bufferView); - util_hash_table_remove_u64(ctx->object_table, view->base.id); + vkr_device_remove_object(ctx, &view->base); } void diff --git a/src/venus/vkr_command_buffer.c b/src/venus/vkr_command_buffer.c index f740b2f..1bea7ff 100644 --- a/src/venus/vkr_command_buffer.c +++ b/src/venus/vkr_command_buffer.c @@ -21,7 +21,7 @@ vkr_dispatch_vkCreateCommandPool(struct vn_dispatch_context *dispatch, list_inithead(&pool->command_buffers); - util_hash_table_set_u64(ctx->object_table, pool->base.id, pool); + vkr_device_add_object(ctx, &pool->base); } static void @@ -33,7 +33,7 @@ vkr_dispatch_vkDestroyCommandPool(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(pool, command_pool, COMMAND_POOL, vkDestroyCommandPool, commandPool); vkr_context_remove_objects(ctx, &pool->command_buffers); - util_hash_table_remove_u64(ctx->object_table, pool->base.id); + vkr_device_remove_object(ctx, &pool->base); } static void diff --git a/src/venus/vkr_common.h b/src/venus/vkr_common.h index 6430137..84f0dec 100644 --- a/src/venus/vkr_common.h +++ b/src/venus/vkr_common.h @@ -191,7 +191,7 @@ \ list_add(&pipeline->base.track_head, &dev->objects); \ \ - util_hash_table_set_u64(ctx->object_table, pipeline->base.id, pipeline); \ + vkr_device_add_object(ctx, &pipeline->base); \ } \ \ arr.objects_stolen = true; \ diff --git a/src/venus/vkr_descriptor_set.c b/src/venus/vkr_descriptor_set.c index cad372b..f660538 100644 --- a/src/venus/vkr_descriptor_set.c +++ b/src/venus/vkr_descriptor_set.c @@ -32,7 +32,7 @@ vkr_dispatch_vkCreateDescriptorSetLayout( CREATE_OBJECT(layout, descriptor_set_layout, DESCRIPTOR_SET_LAYOUT, vkCreateDescriptorSetLayout, pSetLayout); - util_hash_table_set_u64(ctx->object_table, layout->base.id, layout); + vkr_device_add_object(ctx, &layout->base); } static void @@ -45,7 +45,7 @@ vkr_dispatch_vkDestroyDescriptorSetLayout( DESTROY_OBJECT(layout, descriptor_set_layout, DESCRIPTOR_SET_LAYOUT, vkDestroyDescriptorSetLayout, descriptorSetLayout); - util_hash_table_remove_u64(ctx->object_table, layout->base.id); + vkr_device_remove_object(ctx, &layout->base); } static void @@ -59,7 +59,7 @@ vkr_dispatch_vkCreateDescriptorPool(struct vn_dispatch_context *dispatch, list_inithead(&pool->descriptor_sets); - util_hash_table_set_u64(ctx->object_table, pool->base.id, pool); + vkr_device_add_object(ctx, &pool->base); } static void @@ -72,7 +72,7 @@ vkr_dispatch_vkDestroyDescriptorPool(struct vn_dispatch_context *dispatch, descriptorPool); vkr_context_remove_objects(ctx, &pool->descriptor_sets); - util_hash_table_remove_u64(ctx->object_table, pool->base.id); + vkr_device_remove_object(ctx, &pool->base); } static void @@ -138,7 +138,7 @@ vkr_dispatch_vkCreateDescriptorUpdateTemplate( CREATE_OBJECT(templ, descriptor_update_template, DESCRIPTOR_UPDATE_TEMPLATE, vkCreateDescriptorUpdateTemplate, pDescriptorUpdateTemplate); - util_hash_table_set_u64(ctx->object_table, templ->base.id, templ); + vkr_device_add_object(ctx, &templ->base); } static void @@ -151,7 +151,7 @@ vkr_dispatch_vkDestroyDescriptorUpdateTemplate( DESTROY_OBJECT(templ, descriptor_update_template, DESCRIPTOR_UPDATE_TEMPLATE, vkDestroyDescriptorUpdateTemplate, descriptorUpdateTemplate); - util_hash_table_remove_u64(ctx->object_table, templ->base.id); + vkr_device_remove_object(ctx, &templ->base); } void diff --git a/src/venus/vkr_device.c b/src/venus/vkr_device.c index 487ac26..3d63408 100644 --- a/src/venus/vkr_device.c +++ b/src/venus/vkr_device.c @@ -325,7 +325,7 @@ vkr_device_object_destroy(struct vkr_context *ctx, list_del(&obj->track_head); - util_hash_table_remove_u64(ctx->object_table, obj->id); + vkr_device_remove_object(ctx, obj); } void diff --git a/src/venus/vkr_device_memory.c b/src/venus/vkr_device_memory.c index 39f177e..28c24a9 100644 --- a/src/venus/vkr_device_memory.c +++ b/src/venus/vkr_device_memory.c @@ -154,7 +154,7 @@ vkr_dispatch_vkAllocateMemory(struct vn_dispatch_context *dispatch, list_add(&mem->base.track_head, &dev->objects); - util_hash_table_set_u64(ctx->object_table, mem->base.id, mem); + vkr_device_add_object(ctx, &mem->base); } static void @@ -176,7 +176,7 @@ vkr_dispatch_vkFreeMemory(struct vn_dispatch_context *dispatch, list_del(&mem->exported_head); list_del(&mem->base.track_head); - util_hash_table_remove_u64(ctx->object_table, mem->base.id); + vkr_device_remove_object(ctx, &mem->base); } static void diff --git a/src/venus/vkr_image.c b/src/venus/vkr_image.c index 4579a96..d01801f 100644 --- a/src/venus/vkr_image.c +++ b/src/venus/vkr_image.c @@ -50,7 +50,7 @@ vkr_dispatch_vkCreateImage(struct vn_dispatch_context *dispatch, CREATE_OBJECT(img, image, IMAGE, vkCreateImage, pImage); - util_hash_table_set_u64(ctx->object_table, img->base.id, img); + vkr_device_add_object(ctx, &img->base); } static void @@ -61,7 +61,7 @@ vkr_dispatch_vkDestroyImage(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(img, image, IMAGE, vkDestroyImage, image); - util_hash_table_remove_u64(ctx->object_table, img->base.id); + vkr_device_remove_object(ctx, &img->base); } static void @@ -156,7 +156,7 @@ vkr_dispatch_vkCreateImageView(struct vn_dispatch_context *dispatch, CREATE_OBJECT(view, image_view, IMAGE_VIEW, vkCreateImageView, pView); - util_hash_table_set_u64(ctx->object_table, view->base.id, view); + vkr_device_add_object(ctx, &view->base); } static void @@ -167,7 +167,7 @@ vkr_dispatch_vkDestroyImageView(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(view, image_view, IMAGE_VIEW, vkDestroyImageView, imageView); - util_hash_table_remove_u64(ctx->object_table, view->base.id); + vkr_device_remove_object(ctx, &view->base); } static void @@ -178,7 +178,7 @@ vkr_dispatch_vkCreateSampler(struct vn_dispatch_context *dispatch, CREATE_OBJECT(sampler, sampler, SAMPLER, vkCreateSampler, pSampler); - util_hash_table_set_u64(ctx->object_table, sampler->base.id, sampler); + vkr_device_add_object(ctx, &sampler->base); } static void @@ -189,7 +189,7 @@ vkr_dispatch_vkDestroySampler(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(sampler, sampler, SAMPLER, vkDestroySampler, sampler); - util_hash_table_remove_u64(ctx->object_table, sampler->base.id); + vkr_device_remove_object(ctx, &sampler->base); } static void @@ -202,7 +202,7 @@ vkr_dispatch_vkCreateSamplerYcbcrConversion( CREATE_OBJECT(conv, sampler_ycbcr_conversion, SAMPLER_YCBCR_CONVERSION, vkCreateSamplerYcbcrConversion, pYcbcrConversion); - util_hash_table_set_u64(ctx->object_table, conv->base.id, conv); + vkr_device_add_object(ctx, &conv->base); } static void @@ -215,7 +215,7 @@ vkr_dispatch_vkDestroySamplerYcbcrConversion( DESTROY_OBJECT(conv, sampler_ycbcr_conversion, SAMPLER_YCBCR_CONVERSION, vkDestroySamplerYcbcrConversion, ycbcrConversion); - util_hash_table_remove_u64(ctx->object_table, conv->base.id); + vkr_device_remove_object(ctx, &conv->base); } void diff --git a/src/venus/vkr_pipeline.c b/src/venus/vkr_pipeline.c index 0cce313..df50c55 100644 --- a/src/venus/vkr_pipeline.c +++ b/src/venus/vkr_pipeline.c @@ -21,7 +21,7 @@ vkr_dispatch_vkCreateShaderModule(struct vn_dispatch_context *dispatch, CREATE_OBJECT(mod, shader_module, SHADER_MODULE, vkCreateShaderModule, pShaderModule); - util_hash_table_set_u64(ctx->object_table, mod->base.id, mod); + vkr_device_add_object(ctx, &mod->base); } static void @@ -32,7 +32,7 @@ vkr_dispatch_vkDestroyShaderModule(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(mod, shader_module, SHADER_MODULE, vkDestroyShaderModule, shaderModule); - util_hash_table_remove_u64(ctx->object_table, mod->base.id); + vkr_device_remove_object(ctx, &mod->base); } static void @@ -44,7 +44,7 @@ vkr_dispatch_vkCreatePipelineLayout(struct vn_dispatch_context *dispatch, CREATE_OBJECT(layout, pipeline_layout, PIPELINE_LAYOUT, vkCreatePipelineLayout, pPipelineLayout); - util_hash_table_set_u64(ctx->object_table, layout->base.id, layout); + vkr_device_add_object(ctx, &layout->base); } static void @@ -56,7 +56,7 @@ vkr_dispatch_vkDestroyPipelineLayout(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(layout, pipeline_layout, PIPELINE_LAYOUT, vkDestroyPipelineLayout, pipelineLayout); - util_hash_table_remove_u64(ctx->object_table, layout->base.id); + vkr_device_remove_object(ctx, &layout->base); } static void @@ -68,7 +68,7 @@ vkr_dispatch_vkCreatePipelineCache(struct vn_dispatch_context *dispatch, CREATE_OBJECT(cache, pipeline_cache, PIPELINE_CACHE, vkCreatePipelineCache, pPipelineCache); - util_hash_table_set_u64(ctx->object_table, cache->base.id, cache); + vkr_device_add_object(ctx, &cache->base); } static void @@ -80,7 +80,7 @@ vkr_dispatch_vkDestroyPipelineCache(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(cache, pipeline_cache, PIPELINE_CACHE, vkDestroyPipelineCache, pipelineCache); - util_hash_table_remove_u64(ctx->object_table, cache->base.id); + vkr_device_remove_object(ctx, &cache->base); } static void @@ -127,7 +127,7 @@ vkr_dispatch_vkDestroyPipeline(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(pipeline, pipeline, PIPELINE, vkDestroyPipeline, pipeline); - util_hash_table_remove_u64(ctx->object_table, pipeline->base.id); + vkr_device_remove_object(ctx, &pipeline->base); } void diff --git a/src/venus/vkr_query_pool.c b/src/venus/vkr_query_pool.c index a91d99f..2c3f6bd 100644 --- a/src/venus/vkr_query_pool.c +++ b/src/venus/vkr_query_pool.c @@ -18,7 +18,7 @@ vkr_dispatch_vkCreateQueryPool(struct vn_dispatch_context *dispatch, CREATE_OBJECT(pool, query_pool, QUERY_POOL, vkCreateQueryPool, pQueryPool); - util_hash_table_set_u64(ctx->object_table, pool->base.id, pool); + vkr_device_add_object(ctx, &pool->base); } static void @@ -29,7 +29,7 @@ vkr_dispatch_vkDestroyQueryPool(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(pool, query_pool, QUERY_POOL, vkDestroyQueryPool, queryPool); - util_hash_table_remove_u64(ctx->object_table, pool->base.id); + vkr_device_remove_object(ctx, &pool->base); } static void diff --git a/src/venus/vkr_queue.c b/src/venus/vkr_queue.c index 7be5c12..5ecd9c6 100644 --- a/src/venus/vkr_queue.c +++ b/src/venus/vkr_queue.c @@ -375,7 +375,7 @@ vkr_dispatch_vkCreateFence(struct vn_dispatch_context *dispatch, CREATE_OBJECT(fence, fence, FENCE, vkCreateFence, pFence); - util_hash_table_set_u64(ctx->object_table, fence->base.id, fence); + vkr_device_add_object(ctx, &fence->base); } static void @@ -386,7 +386,7 @@ vkr_dispatch_vkDestroyFence(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(fence, fence, FENCE, vkDestroyFence, fence); - util_hash_table_remove_u64(ctx->object_table, fence->base.id); + vkr_device_remove_object(ctx, &fence->base); } static void @@ -434,7 +434,7 @@ vkr_dispatch_vkCreateSemaphore(struct vn_dispatch_context *dispatch, CREATE_OBJECT(sem, semaphore, SEMAPHORE, vkCreateSemaphore, pSemaphore); - util_hash_table_set_u64(ctx->object_table, sem->base.id, sem); + vkr_device_add_object(ctx, &sem->base); } static void @@ -445,7 +445,7 @@ vkr_dispatch_vkDestroySemaphore(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(sem, semaphore, SEMAPHORE, vkDestroySemaphore, semaphore); - util_hash_table_remove_u64(ctx->object_table, sem->base.id); + vkr_device_remove_object(ctx, &sem->base); } static void @@ -508,7 +508,7 @@ vkr_dispatch_vkCreateEvent(struct vn_dispatch_context *dispatch, CREATE_OBJECT(ev, event, EVENT, vkCreateEvent, pEvent); - util_hash_table_set_u64(ctx->object_table, ev->base.id, ev); + vkr_device_add_object(ctx, &ev->base); } static void @@ -519,7 +519,7 @@ vkr_dispatch_vkDestroyEvent(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(ev, event, EVENT, vkDestroyEvent, event); - util_hash_table_remove_u64(ctx->object_table, ev->base.id); + vkr_device_remove_object(ctx, &ev->base); } static void diff --git a/src/venus/vkr_render_pass.c b/src/venus/vkr_render_pass.c index e25d6ac..b0b410c 100644 --- a/src/venus/vkr_render_pass.c +++ b/src/venus/vkr_render_pass.c @@ -19,7 +19,7 @@ vkr_dispatch_vkCreateRenderPass(struct vn_dispatch_context *dispatch, CREATE_OBJECT(pass, render_pass, RENDER_PASS, vkCreateRenderPass, pRenderPass); - util_hash_table_set_u64(ctx->object_table, pass->base.id, pass); + vkr_device_add_object(ctx, &pass->base); } static void @@ -52,7 +52,7 @@ vkr_dispatch_vkCreateRenderPass2(struct vn_dispatch_context *dispatch, list_add(&pass->base.track_head, &dev->objects); - util_hash_table_set_u64(ctx->object_table, pass->base.id, pass); + vkr_device_add_object(ctx, &pass->base); } static void @@ -63,7 +63,7 @@ vkr_dispatch_vkDestroyRenderPass(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(pass, render_pass, RENDER_PASS, vkDestroyRenderPass, renderPass); - util_hash_table_remove_u64(ctx->object_table, pass->base.id); + vkr_device_remove_object(ctx, &pass->base); } static void @@ -82,7 +82,7 @@ vkr_dispatch_vkCreateFramebuffer(struct vn_dispatch_context *dispatch, CREATE_OBJECT(fb, framebuffer, FRAMEBUFFER, vkCreateFramebuffer, pFramebuffer); - util_hash_table_set_u64(ctx->object_table, fb->base.id, fb); + vkr_device_add_object(ctx, &fb->base); } static void @@ -93,7 +93,7 @@ vkr_dispatch_vkDestroyFramebuffer(struct vn_dispatch_context *dispatch, DESTROY_OBJECT(fb, framebuffer, FRAMEBUFFER, vkDestroyFramebuffer, framebuffer); - util_hash_table_remove_u64(ctx->object_table, fb->base.id); + vkr_device_remove_object(ctx, &fb->base); } void