ConfigStdView configures a standard 2D image view, for current image, format, and device.
()
| 640 | // ConfigStdView configures a standard 2D image view, for current image, |
| 641 | // format, and device. |
| 642 | func (im *Image) ConfigStdView() { |
| 643 | im.DestroyView() |
| 644 | var view vk.ImageView |
| 645 | viewtyp := vk.ImageViewType2d |
| 646 | if !im.HasFlag(DepthImage) && !im.HasFlag(FramebufferImage) { |
| 647 | viewtyp = vk.ImageViewType2dArray |
| 648 | } |
| 649 | ret := vk.CreateImageView(im.Dev, &vk.ImageViewCreateInfo{ |
| 650 | SType: vk.StructureTypeImageViewCreateInfo, |
| 651 | Format: im.Format.Format, |
| 652 | Components: vk.ComponentMapping{ // this is the default anyway |
| 653 | R: vk.ComponentSwizzleIdentity, |
| 654 | G: vk.ComponentSwizzleIdentity, |
| 655 | B: vk.ComponentSwizzleIdentity, |
| 656 | A: vk.ComponentSwizzleIdentity, |
| 657 | }, |
| 658 | SubresourceRange: vk.ImageSubresourceRange{ |
| 659 | AspectMask: vk.ImageAspectFlags(vk.ImageAspectColorBit), |
| 660 | LevelCount: 1, |
| 661 | LayerCount: uint32(im.Format.Layers), |
| 662 | }, |
| 663 | ViewType: viewtyp, |
| 664 | Image: im.Image, |
| 665 | }, nil, &view) |
| 666 | IfPanic(NewError(ret)) |
| 667 | im.View = view |
| 668 | im.SetFlag(true, ImageActive) |
| 669 | } |
| 670 | |
| 671 | // ConfigDepthView configures a depth view image |
| 672 | func (im *Image) ConfigDepthView() { |
no test coverage detected