Abstract base class that represents a vkImage and an vkImageView. More...
#include <texture_source_vk.h>
Public Member Functions | |
| virtual | ~TextureSourceVK () |
| const TextureDescriptor & | GetTextureDescriptor () const |
| Gets the texture descriptor for this image source. | |
| virtual vk::Image | GetImage () const =0 |
| Get the image handle for this texture source. | |
| virtual vk::ImageView | GetImageView () const =0 |
| Retrieve the image view used for sampling/blitting/compute with this texture source. | |
| virtual vk::ImageView | GetRenderTargetView (uint32_t mip_level, uint32_t array_layer) const =0 |
| Retrieve the image view used to attach a specific subresource of this texture as a render target. | |
| fml::Status | SetLayout (const BarrierVK &barrier) const |
Encodes the layout transition barrier to barrier.cmd_buffer for the image. | |
| vk::ImageLayout | SetLayoutWithoutEncoding (vk::ImageLayout layout) const |
| Store the layout of the image. | |
| vk::ImageLayout | GetLayout () const |
| Get the last layout assigned to the TextureSourceVK. | |
| 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. | |
| virtual bool | IsSwapchainImage () const =0 |
| Determines if swapchain image. That is, an image used as the root render target. | |
| 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 |
Protected Member Functions | |
| TextureSourceVK (TextureDescriptor desc) | |
Protected Attributes | |
| const TextureDescriptor | desc_ |
Abstract base class that represents a vkImage and an vkImageView.
This is intended to be used with an impeller::TextureVK. Example implementations represent swapchain images, uploaded textures, Android Hardware Buffer backend textures, etc...
Definition at line 36 of file texture_source_vk.h.
|
virtualdefault |
|
explicitprotected |
Definition at line 9 of file texture_source_vk.cc.
| FramebufferAndRenderPass impeller::TextureSourceVK::GetCachedFrameData | ( | SampleCount | sample_count, |
| uint32_t | mip_level = 0u, |
||
| uint32_t | slice = 0u |
||
| ) | const |
Retrieve the cached framebuffer and render pass for the given (sample_count, mip_level, slice) subresource.
An empty FramebufferAndRenderPass is returned when no cached entry exists for that key. Entries are populated lazily on first use and live for the lifetime of the texture.
Definition at line 75 of file texture_source_vk.cc.
|
pure virtual |
Get the image handle for this texture source.
Implemented in impeller::AllocatedTextureSourceVK, impeller::AHBTextureSourceVK, and impeller::KHRSwapchainImageVK.
Referenced by SetLayout().
|
pure virtual |
Retrieve the image view used for sampling/blitting/compute with this texture source.
Implemented in impeller::AllocatedTextureSourceVK, impeller::AHBTextureSourceVK, and impeller::KHRSwapchainImageVK.
| vk::ImageLayout impeller::TextureSourceVK::GetLayout | ( | ) | const |
Get the last layout assigned to the TextureSourceVK.
This value is synchronized with the GPU via SetLayout so it
may not reflect the actual layout.
Definition at line 21 of file texture_source_vk.cc.
|
pure virtual |
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.
| [in] | mip_level | The mip level to attach. |
| [in] | array_layer | The array layer or cube map face to attach. |
Implemented in impeller::AllocatedTextureSourceVK, impeller::AHBTextureSourceVK, and impeller::KHRSwapchainImageVK.
| const TextureDescriptor & impeller::TextureSourceVK::GetTextureDescriptor | ( | ) | const |
Gets the texture descriptor for this image source.
Definition at line 13 of file texture_source_vk.cc.
References desc_.
Referenced by impeller::glvk::Trampoline::BlitTextureOpenGLToVulkan().
|
virtual |
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.
Reimplemented in impeller::AHBTextureSourceVK.
Definition at line 17 of file texture_source_vk.cc.
|
pure virtual |
Determines if swapchain image. That is, an image used as the root render target.
Implemented in impeller::AllocatedTextureSourceVK, impeller::AHBTextureSourceVK, and impeller::KHRSwapchainImageVK.
| void impeller::TextureSourceVK::SetCachedFrameData | ( | const FramebufferAndRenderPass & | data, |
| SampleCount | sample_count, | ||
| uint32_t | mip_level = 0u, |
||
| uint32_t | slice = 0u |
||
| ) |
Store the framebuffer and render pass last used to render into the (sample_count, mip_level, slice) subresource of this texture.
This is only called when this texture is being used as the resolve (or non-MSAA color) target of a render pass. By construction, the cached objects are compatible with any future render pass that targets the same subresource.
Definition at line 61 of file texture_source_vk.cc.
| fml::Status impeller::TextureSourceVK::SetLayout | ( | const BarrierVK & | barrier | ) | const |
Encodes the layout transition barrier to barrier.cmd_buffer for the image.
The transition is from the layout stored via SetLayoutWithoutEncoding to barrier.new_layout.
| [in] | barrier | The barrier. |
Definition at line 32 of file texture_source_vk.cc.
References impeller::BarrierVK::base_mip_level, impeller::BarrierVK::cmd_buffer, desc_, impeller::BarrierVK::dst_access, impeller::BarrierVK::dst_stage, impeller::TextureDescriptor::format, GetImage(), impeller::TextureDescriptor::mip_count, impeller::BarrierVK::new_layout, SetLayoutWithoutEncoding(), impeller::BarrierVK::src_access, impeller::BarrierVK::src_stage, impeller::ToArrayLayerCount(), impeller::ToImageAspectFlags(), and impeller::TextureDescriptor::type.
| vk::ImageLayout impeller::TextureSourceVK::SetLayoutWithoutEncoding | ( | vk::ImageLayout | layout | ) | const |
Store the layout of the image.
This just is bookkeeping on the CPU, to actually set the
layout use `SetLayout`.
| [in] | layout | The new layout. |
Definition at line 25 of file texture_source_vk.cc.
Referenced by SetLayout().
|
protected |
Definition at line 164 of file texture_source_vk.h.
Referenced by GetTextureDescriptor(), and SetLayout().