Flutter Impeller
impeller::TextureVK Class Referencefinal

#include <texture_vk.h>

Inheritance diagram for impeller::TextureVK:
impeller::Texture impeller::BackendCast< TextureVK, Texture >

Public Member Functions

 TextureVK (std::weak_ptr< Context > context, std::shared_ptr< TextureSourceVK > source)
 
 ~TextureVK () override
 
vk::Image GetImage () const
 
vk::ImageView GetImageView () const
 
vk::ImageView GetRenderTargetView () const
 
bool SetLayout (const BarrierVK &barrier) const
 
vk::ImageLayout SetLayoutWithoutEncoding (vk::ImageLayout layout) const
 
vk::ImageLayout GetLayout () const
 
std::shared_ptr< const TextureSourceVKGetTextureSource () const
 
ISize GetSize () const override
 
void SetMipMapGenerated ()
 
bool IsSwapchainImage () const
 
std::shared_ptr< SamplerVKGetImmutableSamplerVariant (const SamplerVK &sampler) const
 
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
 
- Public Member Functions inherited from impeller::Texture
virtual ~Texture ()
 
bool SetContents (const uint8_t *contents, size_t length, size_t slice=0, bool is_opaque=false)
 
bool SetContents (std::shared_ptr< const fml::Mapping > mapping, size_t slice=0, bool is_opaque=false)
 
bool IsOpaque () const
 
size_t GetMipCount () const
 
const TextureDescriptorGetTextureDescriptor () const
 
void SetCoordinateSystem (TextureCoordinateSystem coordinate_system)
 
TextureCoordinateSystem GetCoordinateSystem () const
 
virtual Scalar GetYCoordScale () const
 
bool NeedsMipmapGeneration () const
 

Additional Inherited Members

- Static Public Member Functions inherited from impeller::BackendCast< TextureVK, Texture >
static TextureVKCast (Texture &base)
 
static const TextureVKCast (const Texture &base)
 
static TextureVKCast (Texture *base)
 
static const TextureVKCast (const Texture *base)
 
- Protected Member Functions inherited from impeller::Texture
 Texture (TextureDescriptor desc)
 
- Protected Attributes inherited from impeller::Texture
bool mipmap_generated_ = false
 

Detailed Description

Definition at line 19 of file texture_vk.h.

Constructor & Destructor Documentation

◆ TextureVK()

impeller::TextureVK::TextureVK ( std::weak_ptr< Context context,
std::shared_ptr< TextureSourceVK source 
)

Definition at line 14 of file texture_vk.cc.

16  : Texture(source->GetTextureDescriptor()),
17  context_(std::move(context)),
18  source_(std::move(source)) {
19 #ifdef IMPELLER_DEBUG
20  has_validation_layers_ = HasValidationLayers();
21 #endif // IMPELLER_DEBUG
22 }
Texture(TextureDescriptor desc)
Definition: texture.cc:11
bool HasValidationLayers()
Definition: context_vk.cc:53

References impeller::HasValidationLayers().

◆ ~TextureVK()

impeller::TextureVK::~TextureVK ( )
overridedefault

Member Function Documentation

◆ GetCachedFramebuffer()

SharedHandleVK< vk::Framebuffer > impeller::TextureVK::GetCachedFramebuffer ( ) const

Retrieve the last framebuffer object used with this texture.

May be nullptr if no previous framebuffer existed.

Definition at line 209 of file texture_vk.cc.

209  {
210  return source_->GetCachedFramebuffer();
211 }

Referenced by impeller::testing::TEST_P().

◆ GetCachedRenderPass()

SharedHandleVK< vk::RenderPass > impeller::TextureVK::GetCachedRenderPass ( ) const

Retrieve the last render pass object used with this texture.

May be nullptr if no previous render pass existed.

Definition at line 213 of file texture_vk.cc.

213  {
214  return source_->GetCachedRenderPass();
215 }

Referenced by impeller::testing::TEST_P().

◆ GetImage()

vk::Image impeller::TextureVK::GetImage ( ) const

Definition at line 169 of file texture_vk.cc.

169  {
170  return source_->GetImage();
171 }

◆ GetImageView()

vk::ImageView impeller::TextureVK::GetImageView ( ) const

Definition at line 173 of file texture_vk.cc.

173  {
174  return source_->GetImageView();
175 }

◆ GetImmutableSamplerVariant()

std::shared_ptr< SamplerVK > impeller::TextureVK::GetImmutableSamplerVariant ( const SamplerVK sampler) const

Definition at line 225 of file texture_vk.cc.

226  {
227  if (!source_) {
228  return nullptr;
229  }
230  std::shared_ptr<YUVConversionVK> conversion = source_->GetYUVConversion();
231  if (!conversion) {
232  // Most textures don't need a sampler conversion and will go down this path.
233  // Only needed for YUV sampling from external textures.
234  return nullptr;
235  }
236  return sampler.CreateVariantForConversion(std::move(conversion));
237 }

References impeller::SamplerVK::CreateVariantForConversion().

◆ GetLayout()

vk::ImageLayout impeller::TextureVK::GetLayout ( ) const

Definition at line 191 of file texture_vk.cc.

191  {
192  return source_ ? source_->GetLayout() : vk::ImageLayout::eUndefined;
193 }

◆ GetRenderTargetView()

vk::ImageView impeller::TextureVK::GetRenderTargetView ( ) const

Definition at line 195 of file texture_vk.cc.

195  {
196  return source_->GetRenderTargetView();
197 }

◆ GetSize()

ISize impeller::TextureVK::GetSize ( ) const
overridevirtual

Implements impeller::Texture.

Definition at line 165 of file texture_vk.cc.

165  {
166  return GetTextureDescriptor().size;
167 }
const TextureDescriptor & GetTextureDescriptor() const
Definition: texture.cc:57

References impeller::Texture::GetTextureDescriptor(), and impeller::TextureDescriptor::size.

◆ GetTextureSource()

std::shared_ptr< const TextureSourceVK > impeller::TextureVK::GetTextureSource ( ) const

Definition at line 177 of file texture_vk.cc.

177  {
178  return source_;
179 }

◆ IsSwapchainImage()

bool impeller::TextureVK::IsSwapchainImage ( ) const

Definition at line 221 of file texture_vk.cc.

221  {
222  return source_->IsSwapchainImage();
223 }

◆ SetCachedFramebuffer()

void impeller::TextureVK::SetCachedFramebuffer ( const SharedHandleVK< vk::Framebuffer > &  framebuffer)

Store the last framebuffer object used with this texture.

This field is only set if this texture is used as the resolve texture of a render pass. By construction, this framebuffer should be compatible with any future render passes.

Definition at line 199 of file texture_vk.cc.

200  {
201  source_->SetCachedFramebuffer(framebuffer);
202 }

◆ SetCachedRenderPass()

void impeller::TextureVK::SetCachedRenderPass ( const SharedHandleVK< vk::RenderPass > &  render_pass)

Store the last render pass object used with this texture.

This field is only set if this texture is used as the resolve texture of a render pass. By construction, this framebuffer should be compatible with any future render passes.

Definition at line 204 of file texture_vk.cc.

205  {
206  source_->SetCachedRenderPass(render_pass);
207 }

◆ SetLayout()

bool impeller::TextureVK::SetLayout ( const BarrierVK barrier) const

Definition at line 181 of file texture_vk.cc.

181  {
182  return source_ ? source_->SetLayout(barrier).ok() : false;
183 }

◆ SetLayoutWithoutEncoding()

vk::ImageLayout impeller::TextureVK::SetLayoutWithoutEncoding ( vk::ImageLayout  layout) const

Definition at line 185 of file texture_vk.cc.

186  {
187  return source_ ? source_->SetLayoutWithoutEncoding(layout)
188  : vk::ImageLayout::eUndefined;
189 }

◆ SetMipMapGenerated()

void impeller::TextureVK::SetMipMapGenerated ( )

Definition at line 217 of file texture_vk.cc.

217  {
218  mipmap_generated_ = true;
219 }
bool mipmap_generated_
Definition: texture.h:79

References impeller::Texture::mipmap_generated_.


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