vk: Remove struct anv_object
authorChad Versace <chad.versace@intel.com>
Wed, 15 Jul 2015 18:26:31 +0000 (11:26 -0700)
committerChad Versace <chad.versace@intel.com>
Wed, 15 Jul 2015 18:29:43 +0000 (11:29 -0700)
Trivial removal because vkDestroyObject() no longer uses it.

src/vulkan/device.c
src/vulkan/pipeline.c
src/vulkan/private.h
src/vulkan/query.c

index fd96457033ecf01e2071c8a375180752bcb1fb54..fd0b80d272b0583725e7f1e64d08cf650bcceb62 100644 (file)
@@ -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,
index c6dc499e52cd82952052c246939a0528ed91daeb..afe4f5b767b0d9a12f80fda4e408809934b33db9 100644 (file)
@@ -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;
index b7d313d293344ed4f2fac24f55942e928fbbdf4e..c1f04dfbc19c198fcfb16421e34d219009a190c5 100644 (file)
@@ -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;
index 3a1f594816d90d013ae07855e34a52376b0f3b52..b3b85897814373ea735405b5667de83ef8078bd0 100644 (file)
@@ -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)