Flutter Impeller
impeller::TextureDescriptor Struct Reference

A lightweight object that describes the attributes of a texture that can then used an allocator to create that texture. More...

#include <texture_descriptor.h>

Public Member Functions

constexpr size_t GetByteSizeOfBaseMipLevel () const
 
constexpr size_t GetBytesPerRow () const
 
constexpr bool SamplingOptionsAreValid () const
 
constexpr bool operator== (const TextureDescriptor &other) const
 
constexpr bool operator!= (const TextureDescriptor &other) const
 
constexpr bool IsValid () const
 

Public Attributes

StorageMode storage_mode = StorageMode::kDeviceTransient
 
TextureType type = TextureType::kTexture2D
 
PixelFormat format = PixelFormat::kUnknown
 
ISize size
 
size_t mip_count = 1u
 
TextureUsageMask usage
 
SampleCount sample_count = SampleCount::kCount1
 
CompressionType compression_type = CompressionType::kLossless
 

Detailed Description

A lightweight object that describes the attributes of a texture that can then used an allocator to create that texture.

Definition at line 39 of file texture_descriptor.h.

Member Function Documentation

◆ GetByteSizeOfBaseMipLevel()

constexpr size_t impeller::TextureDescriptor::GetByteSizeOfBaseMipLevel ( ) const
inlineconstexpr

Definition at line 50 of file texture_descriptor.h.

50  {
51  if (!IsValid()) {
52  return 0u;
53  }
55  }

References impeller::TSize< T >::Area(), impeller::BytesPerPixelForPixelFormat(), format, IsValid(), and size.

Referenced by impeller::UploadGlyphTextureAtlas().

◆ GetBytesPerRow()

constexpr size_t impeller::TextureDescriptor::GetBytesPerRow ( ) const
inlineconstexpr

Definition at line 57 of file texture_descriptor.h.

57  {
58  if (!IsValid()) {
59  return 0u;
60  }
62  }

References impeller::BytesPerPixelForPixelFormat(), format, IsValid(), size, and impeller::TSize< T >::width.

◆ IsValid()

constexpr bool impeller::TextureDescriptor::IsValid ( ) const
inlineconstexpr

◆ operator!=()

constexpr bool impeller::TextureDescriptor::operator!= ( const TextureDescriptor other) const
inlineconstexpr

Definition at line 80 of file texture_descriptor.h.

80  {
81  return !(*this == other);
82  }

◆ operator==()

constexpr bool impeller::TextureDescriptor::operator== ( const TextureDescriptor other) const
inlineconstexpr

Definition at line 69 of file texture_descriptor.h.

69  {
70  return size == other.size && //
71  storage_mode == other.storage_mode && //
72  format == other.format && //
73  usage == other.usage && //
74  sample_count == other.sample_count && //
75  type == other.type && //
76  compression_type == other.compression_type && //
77  mip_count == other.mip_count;
78  }

References compression_type, format, mip_count, sample_count, size, storage_mode, type, and usage.

◆ SamplingOptionsAreValid()

constexpr bool impeller::TextureDescriptor::SamplingOptionsAreValid ( ) const
inlineconstexpr

Definition at line 64 of file texture_descriptor.h.

64  {
65  const auto count = static_cast<uint64_t>(sample_count);
66  return IsMultisampleCapable(type) ? count > 1 : count == 1;
67  }

References impeller::IsMultisampleCapable(), sample_count, and type.

Referenced by IsValid().

Member Data Documentation

◆ compression_type

◆ format

◆ mip_count

◆ sample_count

◆ size

◆ storage_mode

◆ type

◆ usage


The documentation for this struct was generated from the following file:
impeller::TextureUsageMask
uint64_t TextureUsageMask
Definition: formats.h:274
impeller::TextureDescriptor::format
PixelFormat format
Definition: texture_descriptor.h:42
impeller::TextureDescriptor::mip_count
size_t mip_count
Definition: texture_descriptor.h:44
impeller::TextureDescriptor::sample_count
SampleCount sample_count
Definition: texture_descriptor.h:47
impeller::TextureDescriptor::usage
TextureUsageMask usage
Definition: texture_descriptor.h:45
impeller::TextureDescriptor::type
TextureType type
Definition: texture_descriptor.h:41
impeller::TextureDescriptor::IsValid
constexpr bool IsValid() const
Definition: texture_descriptor.h:84
impeller::BytesPerPixelForPixelFormat
constexpr size_t BytesPerPixelForPixelFormat(PixelFormat format)
Definition: formats.h:399
impeller::TextureUsage::kShaderRead
@ kShaderRead
impeller::PixelFormat::kUnknown
@ kUnknown
impeller::IsMultisampleCapable
constexpr bool IsMultisampleCapable(TextureType type)
Definition: formats.h:257
impeller::TSize::width
Type width
Definition: size.h:21
impeller::TextureDescriptor::size
ISize size
Definition: texture_descriptor.h:43
impeller::TSize::Area
constexpr Type Area() const
Definition: size.h:97
impeller::TextureDescriptor::SamplingOptionsAreValid
constexpr bool SamplingOptionsAreValid() const
Definition: texture_descriptor.h:64
impeller::TextureDescriptor::storage_mode
StorageMode storage_mode
Definition: texture_descriptor.h:40
impeller::TSize::IsPositive
constexpr bool IsPositive() const
Definition: size.h:99
impeller::TextureDescriptor::compression_type
CompressionType compression_type
Definition: texture_descriptor.h:48