diff options
author | Jason Ekstrand <[email protected]> | 2015-07-10 12:25:30 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-07-10 12:26:31 -0700 |
commit | b94b8dfad5ca8168db0436721100254d2e61b4b7 (patch) | |
tree | c1141321eafc74f4ed553f992adf73bfddb9d1d2 /src/vulkan/image.c | |
parent | 18340883e3c9736db5ed319dfb036af00c39ba82 (diff) |
vk/image: Add explicit constructors for buffer/image view types
Diffstat (limited to 'src/vulkan/image.c')
-rw-r--r-- | src/vulkan/image.c | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/src/vulkan/image.c b/src/vulkan/image.c index d63ae1dfed8..5f82ed369cb 100644 --- a/src/vulkan/image.c +++ b/src/vulkan/image.c @@ -317,14 +317,8 @@ VkResult anv_GetImageSubresourceLayout( 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 *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); @@ -544,13 +538,21 @@ anv_CreateImageView(VkDevice _device, anv_image_view_init(view, device, pCreateInfo, NULL); - view->base.destructor = anv_surface_view_destroy; - *pView = (VkImageView) view; return VK_SUCCESS; } +VkResult +anv_DestroyImageView(VkDevice _device, VkImageView _view) +{ + ANV_FROM_HANDLE(anv_device, device, _device); + + anv_surface_view_destroy(device, (struct anv_surface_view *)_view); + + return VK_SUCCESS; +} + void anv_color_attachment_view_init(struct anv_surface_view *view, struct anv_device *device, @@ -664,14 +666,22 @@ anv_CreateColorAttachmentView(VkDevice _device, anv_color_attachment_view_init(view, device, pCreateInfo, NULL); - view->base.destructor = anv_surface_view_destroy; - *pView = (VkColorAttachmentView) view; return VK_SUCCESS; } VkResult +anv_DestroyColorAttachmentView(VkDevice _device, VkColorAttachmentView _view) +{ + ANV_FROM_HANDLE(anv_device, device, _device); + + anv_surface_view_destroy(device, (struct anv_surface_view *)_view); + + return VK_SUCCESS; +} + +VkResult anv_CreateDepthStencilView(VkDevice _device, const VkDepthStencilViewCreateInfo *pCreateInfo, VkDepthStencilView *pView) @@ -711,3 +721,14 @@ anv_CreateDepthStencilView(VkDevice _device, return VK_SUCCESS; } + +VkResult +anv_DestroyDepthStencilView(VkDevice _device, VkDepthStencilView _view) +{ + ANV_FROM_HANDLE(anv_device, device, _device); + ANV_FROM_HANDLE(anv_depth_stencil_view, view, _view); + + anv_device_free(device, view); + + return VK_SUCCESS; +} |