| 662 | } |
| 663 | |
| 664 | func (*stencilOverdraw) createImageView(ctx context.Context, |
| 665 | cb CommandBuilder, |
| 666 | st *State, |
| 667 | a arena.Arena, |
| 668 | device VkDevice, |
| 669 | image VkImage, |
| 670 | alloc func(v ...interface{}) api.AllocResult, |
| 671 | addCleanup func(func()), |
| 672 | out transform.Writer, |
| 673 | ) VkImageView { |
| 674 | imageObject := st.Images().Get(image) |
| 675 | createInfo := NewVkImageViewCreateInfo(a, |
| 676 | VkStructureType_VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // sType |
| 677 | 0, // pNext |
| 678 | 0, // flags |
| 679 | image, // image |
| 680 | VkImageViewType_VK_IMAGE_VIEW_TYPE_2D, // viewType |
| 681 | imageObject.Info().Fmt(), // format |
| 682 | NewVkComponentMapping(a, |
| 683 | VkComponentSwizzle_VK_COMPONENT_SWIZZLE_IDENTITY, |
| 684 | VkComponentSwizzle_VK_COMPONENT_SWIZZLE_IDENTITY, |
| 685 | VkComponentSwizzle_VK_COMPONENT_SWIZZLE_IDENTITY, |
| 686 | VkComponentSwizzle_VK_COMPONENT_SWIZZLE_IDENTITY, |
| 687 | ), // components |
| 688 | NewVkImageSubresourceRange(a, |
| 689 | imageObject.ImageAspect(), // aspectMask |
| 690 | 0, // baseMipLevel |
| 691 | 1, // levelCount |
| 692 | 0, // baseArrayLayer |
| 693 | 1, // layerCount |
| 694 | ), // subresourceRange |
| 695 | ) |
| 696 | createInfoData := alloc(createInfo) |
| 697 | |
| 698 | imageView := VkImageView(newUnusedID(false, func(id uint64) bool { |
| 699 | return st.ImageViews().Contains(VkImageView(id)) |
| 700 | })) |
| 701 | imageViewData := alloc(imageView) |
| 702 | |
| 703 | writeEach(ctx, out, |
| 704 | cb.VkCreateImageView( |
| 705 | device, |
| 706 | createInfoData.Ptr(), |
| 707 | memory.Nullptr, |
| 708 | imageViewData.Ptr(), |
| 709 | VkResult_VK_SUCCESS, |
| 710 | ).AddRead( |
| 711 | createInfoData.Data(), |
| 712 | ).AddWrite( |
| 713 | imageViewData.Data(), |
| 714 | ), |
| 715 | ) |
| 716 | |
| 717 | addCleanup(func() { |
| 718 | writeEach(ctx, out, |
| 719 | cb.VkDestroyImageView( |
| 720 | device, |
| 721 | imageView, |