From 6e5ab5cf1bdac9292b512bbbe10da44558fe1bc0 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Tue, 14 Jul 2015 10:26:17 -0700 Subject: vk/0.132: Add vkDestroyPipeline() --- include/vulkan/vulkan.h | 5 +++++ src/vulkan/device.c | 4 +++- src/vulkan/pipeline.c | 23 ++++++++++++++++++----- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index 35d8e45888d..bbb75001d45 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -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, diff --git a/src/vulkan/device.c b/src/vulkan/device.c index 599475135e7..43724641c08 100644 --- a/src/vulkan/device.c +++ b/src/vulkan/device.c @@ -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); diff --git a/src/vulkan/pipeline.c b/src/vulkan/pipeline.c index d21af0ff8b4..3d67a3a1b6d 100644 --- a/src/vulkan/pipeline.c +++ b/src/vulkan/pipeline.c @@ -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, -- cgit v1.2.3