vk/0.132: Add vkDestroyPipeline()
authorChad Versace <chad.versace@intel.com>
Tue, 14 Jul 2015 17:26:17 +0000 (10:26 -0700)
committerChad Versace <chad.versace@intel.com>
Tue, 14 Jul 2015 17:26:17 +0000 (10:26 -0700)
include/vulkan/vulkan.h
src/vulkan/device.c
src/vulkan/pipeline.c

index 35d8e45888d360625366c264f70f03e69dc5d58c..bbb75001d45ae69acad8eab12fa1ed78736620dd 100644 (file)
@@ -2046,6 +2046,7 @@ typedef VkResult (VKAPI *PFN_vkGetPipelineCacheData)(VkDevice device, VkPipeline
 typedef VkResult (VKAPI *PFN_vkMergePipelineCaches)(VkDevice device, VkPipelineCache destCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches);
 typedef VkResult (VKAPI *PFN_vkCreateGraphicsPipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t count, const VkGraphicsPipelineCreateInfo* pCreateInfos, VkPipeline* pPipelines);
 typedef VkResult (VKAPI *PFN_vkCreateComputePipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t count, const VkComputePipelineCreateInfo* pCreateInfos, VkPipeline* pPipelines);
+typedef VkResult (VKAPI *PFN_vkDestroyPipeline)(VkDevice device, VkPipeline pipeline);
 typedef VkResult (VKAPI *PFN_vkCreatePipelineLayout)(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, VkPipelineLayout* pPipelineLayout);
 typedef VkResult (VKAPI *PFN_vkCreateSampler)(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, VkSampler* pSampler);
 typedef VkResult (VKAPI *PFN_vkCreateDescriptorSetLayout)(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayout* pSetLayout);
@@ -2446,6 +2447,10 @@ VkResult VKAPI vkCreateComputePipelines(
     const VkComputePipelineCreateInfo*          pCreateInfos,
     VkPipeline*                                 pPipelines);
 
+VkResult VKAPI vkDestroyPipeline(
+    VkDevice                                    device,
+    VkPipeline                                  pipeline);
+
 VkResult VKAPI vkCreatePipelineLayout(
     VkDevice                                    device,
     const VkPipelineLayoutCreateInfo*           pCreateInfo,
index 599475135e7dddfcfa4696ef61b73821989a47e3..43724641c0866f6a6c1885a67fa73e65280ecce2 100644 (file)
@@ -1249,12 +1249,14 @@ VkResult anv_DestroyObject(
       return VK_SUCCESS;
 
    case VK_OBJECT_TYPE_COMMAND_BUFFER:
-   case VK_OBJECT_TYPE_PIPELINE:
    case VK_OBJECT_TYPE_DYNAMIC_VP_STATE:
    case VK_OBJECT_TYPE_FRAMEBUFFER:
       (object->destructor)(device, object, objType);
       return VK_SUCCESS;
 
+   case VK_OBJECT_TYPE_PIPELINE:
+      return anv_DestroyPipeline(_device, (VkPipeline) _object);
+
    case VK_OBJECT_TYPE_QUERY_POOL:
       return anv_DestroyQueryPool(_device, (VkQueryPool) _object);
 
index d21af0ff8b4291f8c5b059d1ce90a558f4e4f608..3d67a3a1b6d897b43df3a4d41d1663379b001303 100644 (file)
@@ -476,11 +476,8 @@ anv_pipeline_destroy(struct anv_device *device,
 
    assert(obj_type == VK_OBJECT_TYPE_PIPELINE);
 
-   anv_compiler_free(pipeline);
-   anv_reloc_list_finish(&pipeline->batch.relocs, pipeline->device);
-   anv_state_stream_finish(&pipeline->program_stream);
-   anv_state_pool_free(&device->dynamic_state_pool, pipeline->blend_state);
-   anv_device_free(pipeline->device, pipeline);
+   anv_DestroyPipeline(anv_device_to_handle(device),
+                       anv_pipeline_to_handle(pipeline));
 }
 
 VkResult
@@ -769,6 +766,22 @@ anv_pipeline_create(
    return VK_SUCCESS;
 }
 
+VkResult anv_DestroyPipeline(
+    VkDevice                                    _device,
+    VkPipeline                                  _pipeline)
+{
+   ANV_FROM_HANDLE(anv_device, device, _device);
+   ANV_FROM_HANDLE(anv_pipeline, pipeline, _pipeline);
+
+   anv_compiler_free(pipeline);
+   anv_reloc_list_finish(&pipeline->batch.relocs, pipeline->device);
+   anv_state_stream_finish(&pipeline->program_stream);
+   anv_state_pool_free(&device->dynamic_state_pool, pipeline->blend_state);
+   anv_device_free(pipeline->device, pipeline);
+
+   return VK_SUCCESS;
+}
+
 VkResult anv_CreateGraphicsPipelines(
     VkDevice                                    _device,
     VkPipelineCache                             pipelineCache,