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
 
PixelFormat GetPixelFormat () const
 
ISize GetSize () const
 
vk::Image GetImage () const override
 Get the image handle for this texture source. More...
 
std::shared_ptr< TextureGetMSAATexture () const
 
std::shared_ptr< TextureGetDepthStencilTexture () const
 
vk::ImageView GetImageView () const override
 Retrieve the image view used for sampling/blitting/compute with this texture source. More...
 
vk::ImageView GetRenderTargetView () const override
 Retrieve the image view used for render target attachments with this texture source. More...
 
void SetMSAATexture (std::shared_ptr< Texture > texture)
 
void SetDepthStencilTexture (std::shared_ptr< Texture > texture)
 
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 TextureDescriptorGetTextureDescriptor () 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< YUVConversionVKGetYUVConversion () 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 SetCachedFramebuffer (const SharedHandleVK< vk::Framebuffer > &framebuffer)
 
void SetCachedRenderPass (const SharedHandleVK< vk::RenderPass > &render_pass)
 
SharedHandleVK< vk::Framebuffer > GetCachedFramebuffer () const
 
SharedHandleVK< vk::RenderPass > GetCachedRenderPass () 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 16 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 }

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

◆ ~KHRSwapchainImageVK()

impeller::KHRSwapchainImageVK::~KHRSwapchainImageVK ( )
overridedefault

Member Function Documentation

◆ GetDepthStencilTexture()

std::shared_ptr< Texture > impeller::KHRSwapchainImageVK::GetDepthStencilTexture ( ) const

Definition at line 42 of file khr_swapchain_image_vk.cc.

42  {
43  return depth_stencil_texture_;
44 }

◆ 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 64 of file khr_swapchain_image_vk.cc.

64  {
65  return image_;
66 }

◆ 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 69 of file khr_swapchain_image_vk.cc.

69  {
70  return image_view_.get();
71 }

◆ GetMSAATexture()

std::shared_ptr< Texture > impeller::KHRSwapchainImageVK::GetMSAATexture ( ) const

Definition at line 38 of file khr_swapchain_image_vk.cc.

38  {
39  return msaa_texture_;
40 }

◆ GetPixelFormat()

PixelFormat impeller::KHRSwapchainImageVK::GetPixelFormat ( ) const

Definition at line 55 of file khr_swapchain_image_vk.cc.

55  {
56  return desc_.format;
57 }

References impeller::TextureSourceVK::desc_, and impeller::TextureDescriptor::format.

◆ GetRenderTargetView()

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

Retrieve the image view used for render target attachments with this texture source.

ImageViews used as render target attachments cannot have any mip levels. In cases where we want to generate mipmaps with the result of this texture, we need to create multiple image views.

Returns
The render target view.

Implements impeller::TextureSourceVK.

Definition at line 74 of file khr_swapchain_image_vk.cc.

74  {
75  return image_view_.get();
76 }

◆ GetSize()

ISize impeller::KHRSwapchainImageVK::GetSize ( ) const

Definition at line 59 of file khr_swapchain_image_vk.cc.

59  {
60  return desc_.size;
61 }

References impeller::TextureSourceVK::desc_, and impeller::TextureDescriptor::size.

◆ IsSwapchainImage()

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

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 47 of file khr_swapchain_image_vk.h.

47 { return true; }

◆ IsValid()

bool impeller::KHRSwapchainImageVK::IsValid ( ) const

Definition at line 34 of file khr_swapchain_image_vk.cc.

34  {
35  return is_valid_;
36 }

◆ SetDepthStencilTexture()

void impeller::KHRSwapchainImageVK::SetDepthStencilTexture ( std::shared_ptr< Texture texture)

Definition at line 50 of file khr_swapchain_image_vk.cc.

51  {
52  depth_stencil_texture_ = std::move(texture);
53 }

◆ SetMSAATexture()

void impeller::KHRSwapchainImageVK::SetMSAATexture ( std::shared_ptr< Texture texture)

Definition at line 46 of file khr_swapchain_image_vk.cc.

46  {
47  msaa_texture_ = std::move(texture);
48 }

The documentation for this class was generated from the following files:
impeller::TextureSourceVK::TextureSourceVK
TextureSourceVK(TextureDescriptor desc)
Definition: texture_source_vk.cc:9
impeller::TextureDescriptor::format
PixelFormat format
Definition: texture_descriptor.h:40
impeller::ToArrayLayerCount
constexpr uint32_t ToArrayLayerCount(TextureType type)
Definition: formats_vk.h:517
impeller::TextureSourceVK::desc_
const TextureDescriptor desc_
Definition: texture_source_vk.h:155
impeller::ToVKImageFormat
constexpr vk::Format ToVKImageFormat(PixelFormat format)
Definition: formats_vk.h:135
impeller::TextureDescriptor::size
ISize size
Definition: texture_descriptor.h:41