Flutter Impeller
impeller::KHRSwapchainImageVK Class Referencefinal

#include <khr_swapchain_image_vk.h>

Inheritance diagram for impeller::KHRSwapchainImageVK:
impeller::TextureSourceVK

Public Member Functions

 KHRSwapchainImageVK (TextureDescriptor desc, const vk::Device &device, vk::Image image)
 
 ~KHRSwapchainImageVK () override
 
bool IsValid () const
 
vk::Image GetImage () const override
 Get the image handle for this texture source. More...
 
vk::ImageView GetImageView () const override
 Retrieve the image view used for sampling/blitting/compute with this texture source. More...
 
vk::ImageView GetRenderTargetView (uint32_t mip_level, uint32_t array_layer) const override
 Retrieve the image view used to attach a specific subresource of this texture as a render target. More...
 
bool IsSwapchainImage () const override
 Determines if swapchain image. That is, an image used as the root render target. More...
 
- Public Member Functions inherited from impeller::TextureSourceVK
virtual ~TextureSourceVK ()
 
const TextureDescriptor & GetTextureDescriptor () const
 Gets the texture descriptor for this image source. More...
 
fml::Status SetLayout (const BarrierVK &barrier) const
 Encodes the layout transition barrier to barrier.cmd_buffer for the image. More...
 
vk::ImageLayout SetLayoutWithoutEncoding (vk::ImageLayout layout) const
 Store the layout of the image. More...
 
vk::ImageLayout GetLayout () const
 Get the last layout assigned to the TextureSourceVK. More...
 
virtual std::shared_ptr< YUVConversionVK > GetYUVConversion () const
 When sampling from textures whose formats are not known to Vulkan, a custom conversion is necessary to setup custom samplers. This accessor provides this conversion if one is present. Most texture source have none. More...
 
void SetCachedFrameData (const FramebufferAndRenderPass &data, SampleCount sample_count, uint32_t mip_level=0u, uint32_t slice=0u)
 
FramebufferAndRenderPass GetCachedFrameData (SampleCount sample_count, uint32_t mip_level=0u, uint32_t slice=0u) const
 

Additional Inherited Members

- Protected Member Functions inherited from impeller::TextureSourceVK
 TextureSourceVK (TextureDescriptor desc)
 
- Protected Attributes inherited from impeller::TextureSourceVK
const TextureDescriptor desc_
 

Detailed Description

Definition at line 15 of file khr_swapchain_image_vk.h.

Constructor & Destructor Documentation

◆ KHRSwapchainImageVK()

impeller::KHRSwapchainImageVK::KHRSwapchainImageVK ( TextureDescriptor  desc,
const vk::Device &  device,
vk::Image  image 
)

Definition at line 9 of file khr_swapchain_image_vk.cc.

12  : TextureSourceVK(desc), image_(image) {
13  vk::ImageViewCreateInfo view_info;
14  view_info.image = image_;
15  view_info.viewType = vk::ImageViewType::e2D;
16  view_info.format = ToVKImageFormat(desc.format);
17  view_info.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eColor;
18  view_info.subresourceRange.baseMipLevel = 0u;
19  view_info.subresourceRange.baseArrayLayer = 0u;
20  view_info.subresourceRange.levelCount = desc.mip_count;
21  view_info.subresourceRange.layerCount = ToArrayLayerCount(desc.type);
22 
23  auto [view_result, view] = device.createImageViewUnique(view_info);
24  if (view_result != vk::Result::eSuccess) {
25  return;
26  }
27 
28  image_view_ = std::move(view);
29  is_valid_ = true;
30 }
TextureSourceVK(TextureDescriptor desc)
constexpr uint32_t ToArrayLayerCount(TextureType type)
Definition: formats_vk.h:611
constexpr vk::Format ToVKImageFormat(PixelFormat format)
Definition: formats_vk.h:146

References impeller::TextureDescriptor::format, impeller::TextureDescriptor::mip_count, impeller::ToArrayLayerCount(), impeller::ToVKImageFormat(), and impeller::TextureDescriptor::type.

◆ ~KHRSwapchainImageVK()

impeller::KHRSwapchainImageVK::~KHRSwapchainImageVK ( )
overridedefault

Member Function Documentation

◆ GetImage()

vk::Image impeller::KHRSwapchainImageVK::GetImage ( ) const
overridevirtual

Get the image handle for this texture source.

Returns
The image.

Implements impeller::TextureSourceVK.

Definition at line 39 of file khr_swapchain_image_vk.cc.

39  {
40  return image_;
41 }

◆ GetImageView()

vk::ImageView impeller::KHRSwapchainImageVK::GetImageView ( ) const
overridevirtual

Retrieve the image view used for sampling/blitting/compute with this texture source.

Returns
The image view.

Implements impeller::TextureSourceVK.

Definition at line 44 of file khr_swapchain_image_vk.cc.

44  {
45  return image_view_.get();
46 }

◆ GetRenderTargetView()

vk::ImageView impeller::KHRSwapchainImageVK::GetRenderTargetView ( uint32_t  mip_level,
uint32_t  array_layer 
) const
overridevirtual

Retrieve the image view used to attach a specific subresource of this texture as a render target.

The returned view covers a single mip level and a single array layer (or cube map face), since attachment views cannot span multiple levels or layers.

Parameters
[in]mip_levelThe mip level to attach.
[in]array_layerThe array layer or cube map face to attach.
Returns
The render target view.

Implements impeller::TextureSourceVK.

Definition at line 49 of file khr_swapchain_image_vk.cc.

51  {
52  // Swapchain images are always a single 2D mip and layer.
53  return image_view_.get();
54 }

◆ IsSwapchainImage()

bool impeller::KHRSwapchainImageVK::IsSwapchainImage ( ) const
overridevirtual

Determines if swapchain image. That is, an image used as the root render target.

Returns
Whether or not this is a swapchain image.

Implements impeller::TextureSourceVK.

Definition at line 57 of file khr_swapchain_image_vk.cc.

57  {
58  return true;
59 }

◆ IsValid()

bool impeller::KHRSwapchainImageVK::IsValid ( ) const

Definition at line 34 of file khr_swapchain_image_vk.cc.

34  {
35  return is_valid_;
36 }

The documentation for this class was generated from the following files: