/* These are just dummys anyway, so we don't need to destroy them */
return VK_SUCCESS;
+ case VK_OBJECT_TYPE_BUFFER_VIEW:
+ return anv_DestroyBufferView(_device, _object);
+
+ case VK_OBJECT_TYPE_IMAGE_VIEW:
+ return anv_DestroyImageView(_device, _object);
+
+ case VK_OBJECT_TYPE_COLOR_ATTACHMENT_VIEW:
+ return anv_DestroyColorAttachmentView(_device, _object);
+
+ case VK_OBJECT_TYPE_DEPTH_STENCIL_VIEW:
+ return anv_DestroyDepthStencilView(_device, _object);
+
case VK_OBJECT_TYPE_BUFFER:
case VK_OBJECT_TYPE_IMAGE:
- case VK_OBJECT_TYPE_DEPTH_STENCIL_VIEW:
case VK_OBJECT_TYPE_SHADER:
case VK_OBJECT_TYPE_SHADER_MODULE:
case VK_OBJECT_TYPE_PIPELINE_LAYOUT:
case VK_OBJECT_TYPE_FENCE:
case VK_OBJECT_TYPE_QUERY_POOL:
case VK_OBJECT_TYPE_FRAMEBUFFER:
- case VK_OBJECT_TYPE_BUFFER_VIEW:
- case VK_OBJECT_TYPE_IMAGE_VIEW:
- case VK_OBJECT_TYPE_COLOR_ATTACHMENT_VIEW:
(object->destructor)(device, object, objType);
return VK_SUCCESS;
if (view == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
- view->base.destructor = anv_surface_view_destroy;
-
view->bo = buffer->bo;
view->offset = buffer->offset + pCreateInfo->offset;
view->surface_state =
return VK_SUCCESS;
}
+VkResult anv_DestroyBufferView(
+ VkDevice _device,
+ VkBufferView _view)
+{
+ ANV_FROM_HANDLE(anv_device, device, _device);
+
+ anv_surface_view_destroy(device, (struct anv_surface_view *)_view);
+
+ return VK_SUCCESS;
+}
+
// Sampler functions
VkResult anv_CreateSampler(
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);
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,
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,
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;
+}
};
struct anv_surface_view {
- struct anv_object base;
-
struct anv_state surface_state;
struct anv_bo * bo;
uint32_t offset;
struct anv_cmd_buffer *cmd_buffer);
void anv_surface_view_destroy(struct anv_device *device,
- struct anv_object *obj, VkObjectType obj_type);
+ struct anv_surface_view *view);
struct anv_sampler {
uint32_t state[4];
void *
anv_lookup_entrypoint(const char *name);
+VkResult anv_DestroyImageView(VkDevice device, VkImageView imageView);
+VkResult anv_DestroyBufferView(VkDevice device, VkBufferView bufferView);
+VkResult anv_DestroyColorAttachmentView(VkDevice device,
+ VkColorAttachmentView view);
+VkResult anv_DestroyDepthStencilView(VkDevice device, VkDepthStencilView view);
+
#define ANV_DEFINE_CASTS(__anv_type, __VkType) \
static inline struct __anv_type * \
__anv_type ## _from_handle(__VkType _handle) \