From d80fea1af603672a774fdffbbcf0b4e2011a4526 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Tue, 14 Jul 2015 10:42:45 -0700 Subject: [PATCH] vk/0.132: Add vkDestroyDynamicViewportState() --- include/vulkan/vulkan.h | 5 +++++ src/vulkan/device.c | 29 ++++++++++++++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index eb5514c59eb..949b7df8c5f 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -2059,6 +2059,7 @@ typedef VkResult (VKAPI *PFN_vkResetDescriptorPool)(VkDevice device, VkDescripto typedef VkResult (VKAPI *PFN_vkAllocDescriptorSets)(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorSetUsage setUsage, uint32_t count, const VkDescriptorSetLayout* pSetLayouts, VkDescriptorSet* pDescriptorSets, uint32_t* pCount); typedef VkResult (VKAPI *PFN_vkUpdateDescriptorSets)(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies); typedef VkResult (VKAPI *PFN_vkCreateDynamicViewportState)(VkDevice device, const VkDynamicViewportStateCreateInfo* pCreateInfo, VkDynamicViewportState* pState); +typedef VkResult (VKAPI *PFN_vkDestroyDynamicViewportState)(VkDevice device, VkDynamicViewportState dynamicViewportState); typedef VkResult (VKAPI *PFN_vkCreateDynamicRasterState)(VkDevice device, const VkDynamicRasterStateCreateInfo* pCreateInfo, VkDynamicRasterState* pState); typedef VkResult (VKAPI *PFN_vkCreateDynamicColorBlendState)(VkDevice device, const VkDynamicColorBlendStateCreateInfo* pCreateInfo, VkDynamicColorBlendState* pState); typedef VkResult (VKAPI *PFN_vkCreateDynamicDepthStencilState)(VkDevice device, const VkDynamicDepthStencilStateCreateInfo* pCreateInfo, VkDynamicDepthStencilState* pState); @@ -2518,6 +2519,10 @@ VkResult VKAPI vkCreateDynamicViewportState( const VkDynamicViewportStateCreateInfo* pCreateInfo, VkDynamicViewportState* pState); +VkResult VKAPI vkDestroyDynamicViewportState( + VkDevice device, + VkDynamicViewportState dynamicViewportState); + VkResult VKAPI vkCreateDynamicRasterState( VkDevice device, const VkDynamicRasterStateCreateInfo* pCreateInfo, diff --git a/src/vulkan/device.c b/src/vulkan/device.c index 9d1c0019a68..0b2914e7d8e 100644 --- a/src/vulkan/device.c +++ b/src/vulkan/device.c @@ -1253,8 +1253,10 @@ VkResult anv_DestroyObject( anv_device_free(device, (void *) _object); return VK_SUCCESS; - case VK_OBJECT_TYPE_COMMAND_BUFFER: case VK_OBJECT_TYPE_DYNAMIC_VP_STATE: + return anv_DestroyDynamicViewportState(_device, (VkDynamicViewportState) _object); + + case VK_OBJECT_TYPE_COMMAND_BUFFER: case VK_OBJECT_TYPE_FRAMEBUFFER: (object->destructor)(device, object, objType); return VK_SUCCESS; @@ -2143,15 +2145,12 @@ anv_dynamic_vp_state_destroy(struct anv_device *device, struct anv_object *object, VkObjectType obj_type) { - struct anv_dynamic_vp_state *state = (void *)object; + struct anv_dynamic_vp_state *vp_state = (void *) object; assert(obj_type == VK_OBJECT_TYPE_DYNAMIC_VP_STATE); - anv_state_pool_free(&device->dynamic_state_pool, state->sf_clip_vp); - anv_state_pool_free(&device->dynamic_state_pool, state->cc_vp); - anv_state_pool_free(&device->dynamic_state_pool, state->scissor); - - anv_device_free(device, state); + anv_DestroyDynamicViewportState(anv_device_to_handle(device), + anv_dynamic_vp_state_to_handle(vp_state)); } VkResult anv_CreateDynamicViewportState( @@ -2241,6 +2240,22 @@ VkResult anv_CreateDynamicViewportState( return VK_SUCCESS; } +VkResult anv_DestroyDynamicViewportState( + VkDevice _device, + VkDynamicViewportState _vp_state) +{ + ANV_FROM_HANDLE(anv_device, device, _device); + ANV_FROM_HANDLE(anv_dynamic_vp_state, vp_state, _vp_state); + + anv_state_pool_free(&device->dynamic_state_pool, vp_state->sf_clip_vp); + anv_state_pool_free(&device->dynamic_state_pool, vp_state->cc_vp); + anv_state_pool_free(&device->dynamic_state_pool, vp_state->scissor); + + anv_device_free(device, vp_state); + + return VK_SUCCESS; +} + VkResult anv_CreateDynamicRasterState( VkDevice _device, const VkDynamicRasterStateCreateInfo* pCreateInfo, -- 2.30.2