From 94e473c99399f45a556c62e9d8bbe979e018d9c6 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Wed, 15 Jul 2015 11:26:31 -0700 Subject: [PATCH] vk: Remove struct anv_object Trivial removal because vkDestroyObject() no longer uses it. --- src/vulkan/device.c | 60 ------------------------------------------- src/vulkan/pipeline.c | 23 ++--------------- src/vulkan/private.h | 17 ------------ src/vulkan/query.c | 17 ------------ 4 files changed, 2 insertions(+), 115 deletions(-) diff --git a/src/vulkan/device.c b/src/vulkan/device.c index fd96457033e..fd0b80d272b 100644 --- a/src/vulkan/device.c +++ b/src/vulkan/device.c @@ -1418,19 +1418,6 @@ VkResult anv_QueueBindSparseImageMemory( stub_return(VK_UNSUPPORTED); } -static void -anv_fence_destroy(struct anv_device *device, - struct anv_object *object, - VkObjectType obj_type) -{ - struct anv_fence *fence = (struct anv_fence *) object; - - assert(obj_type == VK_OBJECT_TYPE_FENCE); - - anv_DestroyFence(anv_device_to_handle(device), - anv_fence_to_handle(fence)); -} - VkResult anv_CreateFence( VkDevice _device, const VkFenceCreateInfo* pCreateInfo, @@ -1454,8 +1441,6 @@ VkResult anv_CreateFence( if (result != VK_SUCCESS) goto fail; - fence->base.destructor = anv_fence_destroy; - fence->bo.map = anv_gem_mmap(device, fence->bo.gem_handle, 0, fence->bo.size); batch.next = batch.start = fence->bo.map; @@ -2200,19 +2185,6 @@ clamp_int64(int64_t x, int64_t min, int64_t max) return max; } -static void -anv_dynamic_vp_state_destroy(struct anv_device *device, - struct anv_object *object, - VkObjectType obj_type) -{ - struct anv_dynamic_vp_state *vp_state = (void *) object; - - assert(obj_type == VK_OBJECT_TYPE_DYNAMIC_VP_STATE); - - anv_DestroyDynamicViewportState(anv_device_to_handle(device), - anv_dynamic_vp_state_to_handle(vp_state)); -} - VkResult anv_CreateDynamicViewportState( VkDevice _device, const VkDynamicViewportStateCreateInfo* pCreateInfo, @@ -2228,8 +2200,6 @@ VkResult anv_CreateDynamicViewportState( if (state == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - state->base.destructor = anv_dynamic_vp_state_destroy; - unsigned count = pCreateInfo->viewportAndScissorCount; state->sf_clip_vp = anv_state_pool_alloc(&device->dynamic_state_pool, count * 64, 64); @@ -2466,19 +2436,6 @@ VkResult anv_DestroyDynamicDepthStencilState( // Command buffer functions -static void -anv_cmd_buffer_destroy(struct anv_device *device, - struct anv_object *object, - VkObjectType obj_type) -{ - struct anv_cmd_buffer *cmd_buffer = (struct anv_cmd_buffer *) object; - - assert(obj_type == VK_OBJECT_TYPE_COMMAND_BUFFER); - - anv_DestroyCommandBuffer(anv_device_to_handle(device), - anv_cmd_buffer_to_handle(cmd_buffer)); -} - static VkResult anv_cmd_buffer_chain_batch(struct anv_batch *batch, void *_data) { @@ -2561,8 +2518,6 @@ VkResult anv_CreateCommandBuffer( if (cmd_buffer == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - cmd_buffer->base.destructor = anv_cmd_buffer_destroy; - cmd_buffer->device = device; cmd_buffer->rs_state = NULL; cmd_buffer->vp_state = NULL; @@ -3972,19 +3927,6 @@ void anv_CmdPipelineBarrier( GEN8_PIPE_CONTROL_pack(&cmd_buffer->batch, dw, &cmd); } -static void -anv_framebuffer_destroy(struct anv_device *device, - struct anv_object *object, - VkObjectType obj_type) -{ - struct anv_framebuffer *fb = (struct anv_framebuffer *)object; - - assert(obj_type == VK_OBJECT_TYPE_FRAMEBUFFER); - - anv_DestroyFramebuffer(anv_device_to_handle(device), - anv_framebuffer_to_handle(fb)); -} - VkResult anv_CreateFramebuffer( VkDevice _device, const VkFramebufferCreateInfo* pCreateInfo, @@ -4002,8 +3944,6 @@ VkResult anv_CreateFramebuffer( if (framebuffer == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - framebuffer->base.destructor = anv_framebuffer_destroy; - framebuffer->attachment_count = pCreateInfo->attachmentCount; for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) { ANV_FROM_HANDLE(anv_attachment_view, view, diff --git a/src/vulkan/pipeline.c b/src/vulkan/pipeline.c index c6dc499e52c..afe4f5b767b 100644 --- a/src/vulkan/pipeline.c +++ b/src/vulkan/pipeline.c @@ -467,19 +467,6 @@ emit_ds_state(struct anv_pipeline *pipeline, GEN8_3DSTATE_WM_DEPTH_STENCIL_pack(NULL, pipeline->state_wm_depth_stencil, &wm_depth_stencil); } -static void -anv_pipeline_destroy(struct anv_device *device, - struct anv_object *object, - VkObjectType obj_type) -{ - struct anv_pipeline *pipeline = (struct anv_pipeline*) object; - - assert(obj_type == VK_OBJECT_TYPE_PIPELINE); - - anv_DestroyPipeline(anv_device_to_handle(device), - anv_pipeline_to_handle(pipeline)); -} - VkResult anv_pipeline_create( VkDevice _device, @@ -499,7 +486,6 @@ anv_pipeline_create( if (pipeline == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - pipeline->base.destructor = anv_pipeline_destroy; pipeline->device = device; pipeline->layout = anv_pipeline_layout_from_handle(pCreateInfo->layout); memset(pipeline->shaders, 0, sizeof(pipeline->shaders)); @@ -789,7 +775,6 @@ VkResult anv_CreateGraphicsPipelines( const VkGraphicsPipelineCreateInfo* pCreateInfos, VkPipeline* pPipelines) { - ANV_FROM_HANDLE(anv_device, device, _device); VkResult result = VK_SUCCESS; unsigned i = 0; @@ -798,8 +783,7 @@ VkResult anv_CreateGraphicsPipelines( NULL, &pPipelines[i]); if (result != VK_SUCCESS) { for (unsigned j = 0; j < i; j++) { - anv_pipeline_destroy(device, (struct anv_object *)pPipelines[j], - VK_OBJECT_TYPE_PIPELINE); + anv_DestroyPipeline(_device, pPipelines[j]); } return result; @@ -825,7 +809,6 @@ static VkResult anv_compute_pipeline_create( if (pipeline == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - pipeline->base.destructor = anv_pipeline_destroy; pipeline->device = device; pipeline->layout = anv_pipeline_layout_from_handle(pCreateInfo->layout); @@ -888,7 +871,6 @@ VkResult anv_CreateComputePipelines( const VkComputePipelineCreateInfo* pCreateInfos, VkPipeline* pPipelines) { - ANV_FROM_HANDLE(anv_device, device, _device); VkResult result = VK_SUCCESS; unsigned i = 0; @@ -897,8 +879,7 @@ VkResult anv_CreateComputePipelines( &pPipelines[i]); if (result != VK_SUCCESS) { for (unsigned j = 0; j < i; j++) { - anv_pipeline_destroy(device, (struct anv_object *)pPipelines[j], - VK_OBJECT_TYPE_PIPELINE); + anv_DestroyPipeline(_device, pPipelines[j]); } return result; diff --git a/src/vulkan/private.h b/src/vulkan/private.h index b7d313d2933..c1f04dfbc19 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -325,17 +325,6 @@ void anv_bo_pool_finish(struct anv_bo_pool *pool); VkResult anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo); void anv_bo_pool_free(struct anv_bo_pool *pool, const struct anv_bo *bo); -struct anv_object; -struct anv_device; - -typedef void (*anv_object_destructor_cb)(struct anv_device *, - struct anv_object *, - VkObjectType); - -struct anv_object { - anv_object_destructor_cb destructor; -}; - struct anv_physical_device { struct anv_instance * instance; uint32_t chipset_id; @@ -571,7 +560,6 @@ struct anv_device_memory { }; struct anv_dynamic_vp_state { - struct anv_object base; struct anv_state sf_clip_vp; struct anv_state cc_vp; struct anv_state scissor; @@ -666,7 +654,6 @@ struct anv_descriptor_set_binding { }; struct anv_cmd_buffer { - struct anv_object base; struct anv_device * device; struct drm_i915_gem_execbuffer2 execbuf; @@ -710,7 +697,6 @@ void anv_cmd_buffer_dump(struct anv_cmd_buffer *cmd_buffer); void anv_aub_writer_destroy(struct anv_aub_writer *writer); struct anv_fence { - struct anv_object base; struct anv_bo bo; struct drm_i915_gem_execbuffer2 execbuf; struct drm_i915_gem_exec_object2 exec2_objects[1]; @@ -728,7 +714,6 @@ struct anv_shader { }; struct anv_pipeline { - struct anv_object base; struct anv_device * device; struct anv_batch batch; uint32_t batch_data[256]; @@ -927,8 +912,6 @@ struct anv_sampler { }; struct anv_framebuffer { - struct anv_object base; - uint32_t width; uint32_t height; uint32_t layers; diff --git a/src/vulkan/query.c b/src/vulkan/query.c index 3a1f594816d..b3b85897814 100644 --- a/src/vulkan/query.c +++ b/src/vulkan/query.c @@ -36,25 +36,11 @@ struct anv_query_pool_slot { }; struct anv_query_pool { - struct anv_object base; VkQueryType type; uint32_t slots; struct anv_bo bo; }; -static void -anv_query_pool_destroy(struct anv_device *device, - struct anv_object *object, - VkObjectType obj_type) -{ - struct anv_query_pool *pool = (struct anv_query_pool *) object; - - assert(obj_type == VK_OBJECT_TYPE_QUERY_POOL); - - anv_DestroyQueryPool(anv_device_to_handle(device), - anv_query_pool_to_handle(pool)); -} - VkResult anv_CreateQueryPool( VkDevice _device, const VkQueryPoolCreateInfo* pCreateInfo, @@ -81,9 +67,6 @@ VkResult anv_CreateQueryPool( if (pool == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - pool->base.destructor = anv_query_pool_destroy; - - pool->type = pCreateInfo->queryType; size = pCreateInfo->slots * sizeof(struct anv_query_pool_slot); result = anv_bo_init_new(&pool->bo, device, size); if (result != VK_SUCCESS) -- 2.30.2