Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
impeller::Texture Class Referenceabstract

#include <texture.h>

Inheritance diagram for impeller::Texture:
impeller::TestImpellerTexture impeller::TextureGLES impeller::TextureMTL impeller::TextureVK

Public Member Functions

virtual ~Texture ()
 
virtual void SetLabel (std::string_view label)=0
 Label this resource for inspection in GPU debugging tools.
 
virtual void SetLabel (std::string_view label, std::string_view trailing)=0
 Label this resource for inspection in GPU debugging tools, with label and trailing will be concatenated together.
 
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)
 
virtual bool IsValid () const =0
 
virtual ISize GetSize () const =0
 
bool IsOpaque () const
 
size_t GetMipCount () const
 
const TextureDescriptorGetTextureDescriptor () const
 
bool NeedsMipmapGeneration () const
 

Protected Member Functions

 Texture (TextureDescriptor desc)
 
virtual bool OnSetContents (const uint8_t *contents, size_t length, size_t slice)=0
 
virtual bool OnSetContents (std::shared_ptr< const fml::Mapping > mapping, size_t slice)=0
 

Protected Attributes

bool mipmap_generated_ = false
 

Detailed Description

Definition at line 17 of file texture.h.

Constructor & Destructor Documentation

◆ ~Texture()

impeller::Texture::~Texture ( )
virtualdefault

◆ Texture()

impeller::Texture::Texture ( TextureDescriptor  desc)
explicitprotected

Definition at line 11 of file texture.cc.

11: desc_(desc) {}

Member Function Documentation

◆ GetMipCount()

size_t impeller::Texture::GetMipCount ( ) const

Definition at line 51 of file texture.cc.

51 {
53}
const TextureDescriptor & GetTextureDescriptor() const
Definition texture.cc:55

References GetTextureDescriptor(), and impeller::TextureDescriptor::mip_count.

◆ GetSize()

virtual ISize impeller::Texture::GetSize ( ) const
pure virtual

◆ GetTextureDescriptor()

◆ IsOpaque()

bool impeller::Texture::IsOpaque ( ) const

Definition at line 47 of file texture.cc.

47 {
48 return is_opaque_;
49}

◆ IsValid()

virtual bool impeller::Texture::IsValid ( ) const
pure virtual

◆ NeedsMipmapGeneration()

bool impeller::Texture::NeedsMipmapGeneration ( ) const

Returns true if mipmaps have never been generated. The contents of the mipmap may be out of date if the root texture has been modified and the mipmaps hasn't been regenerated.

Definition at line 71 of file texture.cc.

71 {
72 return !mipmap_generated_ && desc_.mip_count > 1;
73}
bool mipmap_generated_
Definition texture.h:69

References impeller::TextureDescriptor::mip_count, and mipmap_generated_.

◆ OnSetContents() [1/2]

virtual bool impeller::Texture::OnSetContents ( const uint8_t *  contents,
size_t  length,
size_t  slice 
)
protectedpure virtual

Implemented in impeller::TestImpellerTexture.

Referenced by SetContents(), and SetContents().

◆ OnSetContents() [2/2]

virtual bool impeller::Texture::OnSetContents ( std::shared_ptr< const fml::Mapping mapping,
size_t  slice 
)
protectedpure virtual

◆ SetContents() [1/2]

bool impeller::Texture::SetContents ( const uint8_t *  contents,
size_t  length,
size_t  slice = 0,
bool  is_opaque = false 
)

Definition at line 15 of file texture.cc.

18 {
19 if (!IsSliceValid(slice)) {
20 VALIDATION_LOG << "Invalid slice for texture.";
21 return false;
22 }
23 if (!OnSetContents(contents, length, slice)) {
24 return false;
25 }
26 is_opaque_ = is_opaque;
27 return true;
28}
virtual bool OnSetContents(const uint8_t *contents, size_t length, size_t slice)=0
size_t length
#define VALIDATION_LOG
Definition validation.h:91

References length, OnSetContents(), and VALIDATION_LOG.

◆ SetContents() [2/2]

bool impeller::Texture::SetContents ( std::shared_ptr< const fml::Mapping mapping,
size_t  slice = 0,
bool  is_opaque = false 
)

Definition at line 30 of file texture.cc.

32 {
33 if (!IsSliceValid(slice)) {
34 VALIDATION_LOG << "Invalid slice for texture.";
35 return false;
36 }
37 if (!mapping) {
38 return false;
39 }
40 if (!OnSetContents(std::move(mapping), slice)) {
41 return false;
42 }
43 is_opaque_ = is_opaque;
44 return true;
45}

References OnSetContents(), and VALIDATION_LOG.

◆ SetLabel() [1/2]

virtual void impeller::Texture::SetLabel ( std::string_view  label)
pure virtual

Label this resource for inspection in GPU debugging tools.

This functionality may be disabled in release builds.

Implemented in impeller::TestImpellerTexture.

◆ SetLabel() [2/2]

virtual void impeller::Texture::SetLabel ( std::string_view  label,
std::string_view  trailing 
)
pure virtual

Label this resource for inspection in GPU debugging tools, with label and trailing will be concatenated together.

This functionality may be disabled in release builds.

Implemented in impeller::TestImpellerTexture.

Member Data Documentation

◆ mipmap_generated_

bool impeller::Texture::mipmap_generated_ = false
protected

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