From 08f7731f67dfb7926d66928619e84e4dd33624d3 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Tue, 14 Jul 2015 10:59:30 -0700 Subject: [PATCH] vk/0.132: Add vkDestroyFramebuffer() --- include/vulkan/vulkan.h | 5 +++++ src/vulkan/device.c | 25 +++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index 4527f2b51a7..13d93094978 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -2067,6 +2067,7 @@ typedef VkResult (VKAPI *PFN_vkDestroyDynamicColorBlendState)(VkDevice device, V typedef VkResult (VKAPI *PFN_vkCreateDynamicDepthStencilState)(VkDevice device, const VkDynamicDepthStencilStateCreateInfo* pCreateInfo, VkDynamicDepthStencilState* pState); typedef VkResult (VKAPI *PFN_vkDestroyDynamicDepthStencilState)(VkDevice device, VkDynamicDepthStencilState dynamicDepthStencilState); typedef VkResult (VKAPI *PFN_vkCreateFramebuffer)(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, VkFramebuffer* pFramebuffer); +typedef VkResult (VKAPI *PFN_vkDestroyFramebuffer)(VkDevice device, VkFramebuffer framebuffer); typedef VkResult (VKAPI *PFN_vkCreateRenderPass)(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, VkRenderPass* pRenderPass); typedef VkResult (VKAPI *PFN_vkGetRenderAreaGranularity)(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity); typedef VkResult (VKAPI *PFN_vkCreateCommandBuffer)(VkDevice device, const VkCmdBufferCreateInfo* pCreateInfo, VkCmdBuffer* pCmdBuffer); @@ -2558,6 +2559,10 @@ VkResult VKAPI vkCreateFramebuffer( const VkFramebufferCreateInfo* pCreateInfo, VkFramebuffer* pFramebuffer); +VkResult VKAPI vkDestroyFramebuffer( + VkDevice device, + VkFramebuffer framebuffer); + VkResult VKAPI vkCreateRenderPass( VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, diff --git a/src/vulkan/device.c b/src/vulkan/device.c index b35e0ea97b5..a632a4f7e37 100644 --- a/src/vulkan/device.c +++ b/src/vulkan/device.c @@ -1262,8 +1262,10 @@ VkResult anv_DestroyObject( case VK_OBJECT_TYPE_DYNAMIC_DS_STATE: return anv_DestroyDynamicDepthStencilState(_device, (VkDynamicDepthStencilState) _object); - case VK_OBJECT_TYPE_COMMAND_BUFFER: case VK_OBJECT_TYPE_FRAMEBUFFER: + return anv_DestroyFramebuffer(_device, (VkFramebuffer) _object); + + case VK_OBJECT_TYPE_COMMAND_BUFFER: (object->destructor)(device, object, objType); return VK_SUCCESS; @@ -3818,11 +3820,8 @@ anv_framebuffer_destroy(struct anv_device *device, assert(obj_type == VK_OBJECT_TYPE_FRAMEBUFFER); - anv_DestroyObject(anv_device_to_handle(device), - VK_OBJECT_TYPE_DYNAMIC_VP_STATE, - fb->vp_state); - - anv_device_free(device, fb); + anv_DestroyFramebuffer(anv_device_to_handle(device), + anv_framebuffer_to_handle(fb)); } VkResult anv_CreateFramebuffer( @@ -3889,6 +3888,20 @@ VkResult anv_CreateFramebuffer( return VK_SUCCESS; } +VkResult anv_DestroyFramebuffer( + VkDevice _device, + VkFramebuffer _fb) +{ + ANV_FROM_HANDLE(anv_device, device, _device); + ANV_FROM_HANDLE(anv_framebuffer, fb, _fb); + + anv_DestroyDynamicViewportState(anv_device_to_handle(device), + fb->vp_state); + anv_device_free(device, fb); + + return VK_SUCCESS; +} + VkResult anv_CreateRenderPass( VkDevice _device, const VkRenderPassCreateInfo* pCreateInfo, -- 2.30.2