Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
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 = TextureUsage::kShaderRead
 
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 37 of file texture_descriptor.h.

Member Function Documentation

◆ GetByteSizeOfBaseMipLevel()

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

Definition at line 47 of file texture_descriptor.h.

47 {
48 if (!IsValid()) {
49 return 0u;
50 }
52 }
constexpr size_t BytesPerPixelForPixelFormat(PixelFormat format)
Definition: formats.h:460
constexpr Type Area() const
Definition: size.h:102
constexpr bool IsValid() const

◆ GetBytesPerRow()

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

Definition at line 54 of file texture_descriptor.h.

54 {
55 if (!IsValid()) {
56 return 0u;
57 }
59 }
Type width
Definition: size.h:22

◆ IsValid()

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

Definition at line 81 of file texture_descriptor.h.

81 {
82 return format != PixelFormat::kUnknown && //
83 !size.IsEmpty() && //
84 mip_count >= 1u && //
86 }
constexpr bool IsEmpty() const
Returns true if either of the width or height are 0, negative, or NaN.
Definition: size.h:105
constexpr bool SamplingOptionsAreValid() const

◆ operator!=()

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

Definition at line 77 of file texture_descriptor.h.

77 {
78 return !(*this == other);
79 }

◆ operator==()

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

Definition at line 66 of file texture_descriptor.h.

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

◆ SamplingOptionsAreValid()

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

Definition at line 61 of file texture_descriptor.h.

61 {
62 const auto count = static_cast<uint64_t>(sample_count);
63 return IsMultisampleCapable(type) ? count > 1 : count == 1;
64 }
int count
Definition: FontMgrTest.cpp:50
constexpr bool IsMultisampleCapable(TextureType type)
Definition: formats.h:283

Member Data Documentation

◆ compression_type

CompressionType impeller::TextureDescriptor::compression_type = CompressionType::kLossless

Definition at line 45 of file texture_descriptor.h.

◆ format

PixelFormat impeller::TextureDescriptor::format = PixelFormat::kUnknown

Definition at line 40 of file texture_descriptor.h.

◆ mip_count

size_t impeller::TextureDescriptor::mip_count = 1u

Definition at line 42 of file texture_descriptor.h.

◆ sample_count

SampleCount impeller::TextureDescriptor::sample_count = SampleCount::kCount1

Definition at line 44 of file texture_descriptor.h.

◆ size

ISize impeller::TextureDescriptor::size

Definition at line 41 of file texture_descriptor.h.

◆ storage_mode

StorageMode impeller::TextureDescriptor::storage_mode = StorageMode::kDeviceTransient

Definition at line 38 of file texture_descriptor.h.

◆ type

TextureType impeller::TextureDescriptor::type = TextureType::kTexture2D

Definition at line 39 of file texture_descriptor.h.

◆ usage

TextureUsageMask impeller::TextureDescriptor::usage = TextureUsage::kShaderRead

Definition at line 43 of file texture_descriptor.h.


The documentation for this struct was generated from the following file: