diff options
author | Jason Ekstrand <[email protected]> | 2015-06-09 11:08:03 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-06-09 12:36:23 -0700 |
commit | 9d6f55dedf92697d551b699e3fe52389b5fb9c27 (patch) | |
tree | 22fd49e24303d10f6baa5b04eb82e674ce2dffb2 /src/vulkan/image.c | |
parent | e6162c2feff6dee48cd5c1e99e2fe70b5ce07f9f (diff) |
vk/surface_view: Add a destructor
Diffstat (limited to 'src/vulkan/image.c')
-rw-r--r-- | src/vulkan/image.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/vulkan/image.c b/src/vulkan/image.c index 529f7ad9774..83f4a1bf0cb 100644 --- a/src/vulkan/image.c +++ b/src/vulkan/image.c @@ -163,6 +163,21 @@ VkResult anv_GetImageSubresourceInfo( } void +anv_surface_view_destroy(struct anv_device *device, + struct anv_object *obj, VkObjectType obj_type) +{ + struct anv_surface_view *view = (struct anv_surface_view *)obj; + + assert(obj_type == VK_OBJECT_TYPE_BUFFER_VIEW || + obj_type == VK_OBJECT_TYPE_IMAGE_VIEW || + obj_type == VK_OBJECT_TYPE_COLOR_ATTACHMENT_VIEW); + + anv_state_pool_free(&device->surface_state_pool, view->surface_state); + + anv_device_free(device, view); +} + +void anv_image_view_init(struct anv_surface_view *view, struct anv_device *device, const VkImageViewCreateInfo* pCreateInfo, @@ -268,6 +283,8 @@ VkResult anv_CreateImageView( anv_image_view_init(view, device, pCreateInfo, NULL); + view->base.destructor = anv_surface_view_destroy; + *pView = (VkImageView) view; return VK_SUCCESS; @@ -352,6 +369,8 @@ VkResult anv_CreateColorAttachmentView( anv_color_attachment_view_init(view, device, pCreateInfo, NULL); + view->base.destructor = anv_surface_view_destroy; + *pView = (VkColorAttachmentView) view; return VK_SUCCESS; |