-/** The attachment may be a color view into a non-color image. */
-struct anv_surface *
-anv_image_get_surface_for_color_attachment(struct anv_image *image)
-{
- if (anv_format_is_color(image->format)) {
- return &image->color_surface;
- } else if (image->format->depth_format) {
- return &image->depth_surface;
- } else if (image->format->has_stencil) {
- return &image->stencil_surface;
- } else {
- unreachable("image has bad format");
- return NULL;
- }
-}
-
-void
-anv_color_attachment_view_init(struct anv_color_attachment_view *aview,
- struct anv_device *device,
- const VkAttachmentViewCreateInfo* pCreateInfo,
- struct anv_cmd_buffer *cmd_buffer)
-{
- switch (device->info.gen) {
- case 7:
- gen7_color_attachment_view_init(aview, device, pCreateInfo, cmd_buffer);
- break;
- case 8:
- gen8_color_attachment_view_init(aview, device, pCreateInfo, cmd_buffer);
- break;
- default:
- unreachable("unsupported gen\n");
- }
-}
-
-VkResult
-anv_CreateAttachmentView(VkDevice _device,
- const VkAttachmentViewCreateInfo *pCreateInfo,
- VkAttachmentView *pView)
-{
- ANV_FROM_HANDLE(anv_device, device, _device);
-
- assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO);
-
- const struct anv_format *format =
- anv_format_for_vk_format(pCreateInfo->format);
-
- if (anv_format_is_depth_or_stencil(format)) {
- struct anv_depth_stencil_view *view =
- anv_device_alloc(device, sizeof(*view), 8,
- VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
- if (view == NULL)
- return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
-
- anv_depth_stencil_view_init(view, pCreateInfo);
-
- *pView = anv_attachment_view_to_handle(&view->base);
- } else {
- struct anv_color_attachment_view *view =
- anv_device_alloc(device, sizeof(*view), 8,
- VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
- if (view == NULL)
- return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
-
- anv_color_attachment_view_init(view, device, pCreateInfo, NULL);
-
- *pView = anv_attachment_view_to_handle(&view->base);
- }
-
- return VK_SUCCESS;
-}
-
-VkResult
-anv_DestroyAttachmentView(VkDevice _device, VkAttachmentView _view)
-{
- ANV_FROM_HANDLE(anv_device, device, _device);
- ANV_FROM_HANDLE(anv_attachment_view, view, _view);
-
- if (view->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_COLOR) {
- struct anv_color_attachment_view *aview =
- (struct anv_color_attachment_view *)view;
-
- anv_surface_view_fini(device, &aview->view);
- }
-
- anv_device_free(device, view);
-
- return VK_SUCCESS;
-}
+#if 0
+ VkImageAspectFlags aspect_mask = 0;
+ if (format->depth_format)
+ aspect_mask |= VK_IMAGE_ASPECT_DEPTH_BIT;
+ if (format->has_stencil)
+ aspect_mask |= VK_IMAGE_ASPECT_STENCIL_BIT;
+ if (!aspect_mask)
+ aspect_mask |= VK_IMAGE_ASPECT_COLOR_BIT;
+
+ anv_image_view_init(iview, device,
+ &(VkImageViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
+ .image = info->image,
+ .viewType = VK_IMAGE_VIEW_TYPE_2D,
+ .format = info->format,
+ .channels = {
+ .r = VK_CHANNEL_SWIZZLE_R,
+ .g = VK_CHANNEL_SWIZZLE_G,
+ .b = VK_CHANNEL_SWIZZLE_B,
+ .a = VK_CHANNEL_SWIZZLE_A,
+ },
+ .subresourceRange = {
+ .aspectMask = aspect_mask,
+ .baseMipLevel = info->mipLevel,
+ .mipLevels = 1,
+ .baseArrayLayer = info->baseArraySlice,
+ .arraySize = info->arraySize,
+ },
+ },
+ NULL);
+#endif