Flutter Impeller
impeller::TextureMTL Class Referencefinal

#include <texture_mtl.h>

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

Public Member Functions

 TextureMTL (TextureDescriptor desc, id< MTLTexture > texture, bool wrapped=false)
 
 ~TextureMTL () override
 
id< MTLTexture > GetMTLTexture () const
 
bool IsWrapped () const
 
bool GenerateMipmap (id< MTLBlitCommandEncoder > encoder)
 
- 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
 

Static Public Member Functions

static std::shared_ptr< TextureMTLWrapper (TextureDescriptor desc, id< MTLTexture > texture, std::function< void()> deletion_proc=nullptr)
 
- Static Public Member Functions inherited from impeller::BackendCast< TextureMTL, Texture >
static TextureMTLCast (Texture &base)
 
static const TextureMTLCast (const Texture &base)
 
static TextureMTLCast (Texture *base)
 
static const TextureMTLCast (const Texture *base)
 

Additional Inherited Members

- 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 15 of file texture_mtl.h.

Constructor & Destructor Documentation

◆ TextureMTL()

impeller::TextureMTL::TextureMTL ( TextureDescriptor  desc,
id< MTLTexture >  texture,
bool  wrapped = false 
)

Definition at line 19 of file texture_mtl.mm.

22  : Texture(p_desc), texture_(texture) {
23  const auto& desc = GetTextureDescriptor();
24 
25  if (!desc.IsValid() || !texture_) {
26  return;
27  }
28 
29  if (desc.size != GetSize()) {
30  VALIDATION_LOG << "The texture and its descriptor disagree about its size.";
31  return;
32  }
33 
34  is_wrapped_ = wrapped;
35  is_valid_ = true;
36 }

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

Referenced by Wrapper().

◆ ~TextureMTL()

impeller::TextureMTL::~TextureMTL ( )
overridedefault

Member Function Documentation

◆ GenerateMipmap()

bool impeller::TextureMTL::GenerateMipmap ( id< MTLBlitCommandEncoder >  encoder)

Definition at line 112 of file texture_mtl.mm.

112  {
113  if (!texture_) {
114  return false;
115  }
116 
117  [encoder generateMipmapsForTexture:texture_];
118  mipmap_generated_ = true;
119 
120  return true;
121 }

References impeller::Texture::mipmap_generated_.

Referenced by impeller::BlitGenerateMipmapCommandMTL::Encode().

◆ GetMTLTexture()

◆ IsWrapped()

bool impeller::TextureMTL::IsWrapped ( ) const

Definition at line 108 of file texture_mtl.mm.

108  {
109  return is_wrapped_;
110 }

◆ Wrapper()

std::shared_ptr< TextureMTL > impeller::TextureMTL::Wrapper ( TextureDescriptor  desc,
id< MTLTexture >  texture,
std::function< void()>  deletion_proc = nullptr 
)
static

Definition at line 38 of file texture_mtl.mm.

41  {
42  if (deletion_proc) {
43  return std::shared_ptr<TextureMTL>(
44  new TextureMTL(desc, texture, true),
45  [deletion_proc = std::move(deletion_proc)](TextureMTL* t) {
46  deletion_proc();
47  delete t;
48  });
49  }
50  return std::shared_ptr<TextureMTL>(new TextureMTL(desc, texture, true));
51 }

References TextureMTL().

Referenced by impeller::SurfaceMTL::MakeFromTexture(), impeller::WrapperMTL(), and impeller::WrapTextureMTL().


The documentation for this class was generated from the following files:
impeller::Texture::GetTextureDescriptor
const TextureDescriptor & GetTextureDescriptor() const
Definition: texture.cc:57
impeller::TextureMTL::TextureMTL
TextureMTL(TextureDescriptor desc, id< MTLTexture > texture, bool wrapped=false)
Definition: texture_mtl.mm:19
impeller::Texture::mipmap_generated_
bool mipmap_generated_
Definition: texture.h:61
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:60
impeller::Texture::Texture
Texture(TextureDescriptor desc)
Definition: texture.cc:11