| Flutter Impeller |

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
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
| inline constexpr

Definition at line 48 of file texture_descriptor.h.

48 {
49 if (!IsValid()) {
50 return 0u;
51 }
52 return size.Area() * BytesPerPixelForPixelFormat(format);
53 }

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

Referenced by impeller::UploadGlyphTextureAtlas().

## ◆ GetBytesPerRow()

constexpr size_t impeller::TextureDescriptor::GetBytesPerRow | ( |  | ) | const
| inline constexpr

Definition at line 55 of file texture_descriptor.h.

55 {
56 if (!IsValid()) {
57 return 0u;
58 }
59 return size.width * BytesPerPixelForPixelFormat(format);
60 }

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

## ◆ IsValid()

constexpr bool impeller::TextureDescriptor::IsValid | ( |  | ) | const
| inline constexpr

Definition at line 82 of file texture_descriptor.h.

82 {
83 return format != PixelFormat::kUnknown && //
84 !size.IsEmpty() && //
85 mip_count >= 1u && //
86 SamplingOptionsAreValid();
87 }

References format, impeller::TSize< T >::IsEmpty(), impeller::kUnknown, mip_count, SamplingOptionsAreValid(), and size.

Referenced by GetByteSizeOfBaseMipLevel(), GetBytesPerRow(), impeller::TextureMTL::TextureMTL(), and impeller::ToMTLTextureDescriptor().

## ◆ operator!=()

constexpr bool impeller::TextureDescriptor::operator!= | ( | const TextureDescriptor & | other | ) | const
| inline constexpr

Definition at line 78 of file texture_descriptor.h.

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

## ◆ operator==()

constexpr bool impeller::TextureDescriptor::operator== | ( | const TextureDescriptor & | other | ) | const
| inline constexpr

Definition at line 67 of file texture_descriptor.h.

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

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

## ◆ SamplingOptionsAreValid()

constexpr bool impeller::TextureDescriptor::SamplingOptionsAreValid | ( |  | ) | const
| inline constexpr

Definition at line 62 of file texture_descriptor.h.

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

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

Referenced by IsValid().

## Member Data Documentation

## ◆ compression_type

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

Definition at line 46 of file texture_descriptor.h.

Referenced by impeller::RenderTarget::CreateOffscreenMSAA(), operator==(), impeller::testing::TEST(), impeller::TextureDescriptorToString(), and impeller::WrapTextureWithRenderTarget().

## ◆ format

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

Definition at line 40 of file texture_descriptor.h.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::CreateGradientTexture(), impeller::RenderTarget::CreateOffscreen(), impeller::RenderTarget::CreateOffscreenMSAA(), impeller::testing::CreateTestYUVTextures(), impeller::CreateTextureForDecompressedImage(), GetByteSizeOfBaseMipLevel(), GetBytesPerRow(), impeller::scene::Skin::GetJointsTexture(), impeller::SwapchainImageVK::GetPixelFormat(), impeller::GetTextureTypeFromDescriptor(), IsValid(), operator==(), impeller::scene::SceneContext::SceneContext(), impeller::TextureSourceVK::SetLayout(), impeller::RenderTarget::SetupStencilAttachment(), impeller::SwapchainImageVK::SwapchainImageVK(), impeller::testing::TEST(), impeller::testing::TEST_P(), impeller::TextureDescriptorToString(), impeller::ToMTLTextureDescriptor(), impeller::UploadGlyphTextureAtlas(), impeller::SurfaceGLES::WrapFBO(), impeller::SurfaceVK::WrapSwapchainImage(), impeller::WrapTextureMTL(), and impeller::WrapTextureWithRenderTarget().

## ◆ mip_count

size_t impeller::TextureDescriptor::mip_count = 1u

Definition at line 42 of file texture_descriptor.h.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::SamplerGLES::ConfigureBoundTexture(), impeller::CreateTextureForDecompressedImage(), impeller::scene::Skin::GetJointsTexture(), impeller::Texture::GetMipCount(), IsValid(), impeller::Texture::NeedsMipmapGeneration(), operator==(), impeller::scene::SceneContext::SceneContext(), impeller::TextureSourceVK::SetLayout(), impeller::SwapchainImageVK::SwapchainImageVK(), impeller::testing::TEST(), impeller::testing::TEST_P(), impeller::TextureDescriptorToString(), and impeller::ToMTLTextureDescriptor().

## ◆ sample_count

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

Definition at line 45 of file texture_descriptor.h.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::RenderTarget::CreateOffscreenMSAA(), impeller::GetTextureTypeFromDescriptor(), operator==(), SamplingOptionsAreValid(), impeller::RenderTarget::SetupStencilAttachment(), impeller::testing::TEST(), impeller::testing::TEST_P(), impeller::TextureDescriptorToString(), impeller::ToMTLTextureDescriptor(), impeller::SurfaceGLES::WrapFBO(), impeller::SurfaceVK::WrapSwapchainImage(), and impeller::WrapTextureWithRenderTarget().

## ◆ size

ISize impeller::TextureDescriptor::size

Definition at line 41 of file texture_descriptor.h.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::CreateGradientTexture(), impeller::RenderTarget::CreateOffscreen(), impeller::RenderTarget::CreateOffscreenMSAA(), impeller::testing::CreateTestYUVTextures(), impeller::Allocator::CreateTexture(), impeller::CreateTextureForDecompressedImage(), GetByteSizeOfBaseMipLevel(), GetBytesPerRow(), impeller::scene::Skin::GetJointsTexture(), impeller::SwapchainImageVK::GetSize(), IsValid(), operator==(), impeller::scene::SceneContext::SceneContext(), impeller::RenderTarget::SetupStencilAttachment(), impeller::testing::TEST(), impeller::testing::TEST_P(), impeller::TextureDescriptorToString(), impeller::TextureMTL::TextureMTL(), impeller::ToMTLTextureDescriptor(), impeller::UploadGlyphTextureAtlas(), impeller::SurfaceGLES::WrapFBO(), impeller::SurfaceVK::WrapSwapchainImage(), and impeller::WrapTextureWithRenderTarget().

## ◆ storage_mode

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

Definition at line 38 of file texture_descriptor.h.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::CreateGradientTexture(), impeller::RenderTarget::CreateOffscreen(), impeller::RenderTarget::CreateOffscreenMSAA(), impeller::testing::CreateTestYUVTextures(), impeller::RenderTargetCache::CreateTexture(), impeller::Playground::CreateTextureCubeForFixture(), impeller::CreateTextureForDecompressedImage(), impeller::scene::Skin::GetJointsTexture(), ImGui_ImplImpeller_Init(), operator==(), impeller::scene::SceneContext::SceneContext(), impeller::RenderTarget::SetupStencilAttachment(), impeller::testing::TEST(), impeller::testing::TEST_P(), impeller::TextureDescriptorToString(), impeller::scene::UnpackTextureFromFlatbuffer(), impeller::UploadGlyphTextureAtlas(), impeller::SurfaceGLES::WrapFBO(), impeller::SurfaceVK::WrapSwapchainImage(), and impeller::WrapTextureWithRenderTarget().

## ◆ type

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

Definition at line 39 of file texture_descriptor.h.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::SamplerGLES::ConfigureBoundTexture(), impeller::RenderTarget::CreateOffscreenMSAA(), impeller::TextureGLES::GenerateMipmap(), operator==(), SamplingOptionsAreValid(), impeller::TextureSourceVK::SetLayout(), impeller::RenderTarget::SetupStencilAttachment(), impeller::SwapchainImageVK::SwapchainImageVK(), impeller::testing::TEST(), impeller::testing::TEST_P(), impeller::TextureDescriptorToString(), impeller::ToMTLTextureDescriptor(), impeller::SurfaceGLES::WrapFBO(), impeller::SurfaceVK::WrapSwapchainImage(), and impeller::WrapTextureWithRenderTarget().

## ◆ usage

TextureUsageMask impeller::TextureDescriptor::usage

Initial value:
=
static_cast<TextureUsageMask>(TextureUsage::kShaderRead)

Definition at line 43 of file texture_descriptor.h.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::RenderTarget::CreateOffscreen(), impeller::RenderTarget::CreateOffscreenMSAA(), impeller::RenderTargetCache::CreateTexture(), impeller::GetTextureTypeFromDescriptor(), operator==(), impeller::RenderTarget::SetupStencilAttachment(), impeller::testing::TEST_P(), impeller::ToMTLTextureDescriptor(), impeller::SurfaceGLES::WrapFBO(), impeller::SurfaceVK::WrapSwapchainImage(), and impeller::WrapTextureWithRenderTarget().

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

- impeller/core/texture_descriptor.h

impeller::TextureUsageMask
uint64_t TextureUsageMask
Definition: formats.h:295
impeller::TextureDescriptor::format
PixelFormat format
Definition: texture_descriptor.h:40
impeller::TextureDescriptor::mip_count
size_t mip_count
Definition: texture_descriptor.h:42
impeller::TextureDescriptor::sample_count
SampleCount sample_count
Definition: texture_descriptor.h:45
impeller::TextureDescriptor::usage
TextureUsageMask usage
Definition: texture_descriptor.h:43
impeller::TextureDescriptor::type
TextureType type
Definition: texture_descriptor.h:39
impeller::TextureDescriptor::IsValid
constexpr bool IsValid() const
Definition: texture_descriptor.h:82
impeller::BytesPerPixelForPixelFormat
constexpr size_t BytesPerPixelForPixelFormat(PixelFormat format)
Definition: formats.h:442
impeller::TextureUsage::kShaderRead
@ kShaderRead
impeller::IsMultisampleCapable
constexpr bool IsMultisampleCapable(TextureType type)
Definition: formats.h:278
impeller::TSize::width
Type width
Definition: size.h:22
impeller::PixelFormat::kUnknown
@ kUnknown
impeller::TextureDescriptor::size
ISize size
Definition: texture_descriptor.h:41
impeller::TSize::Area
constexpr Type Area() const
Definition: size.h:102
impeller::TextureDescriptor::SamplingOptionsAreValid
constexpr bool SamplingOptionsAreValid() const
Definition: texture_descriptor.h:62
impeller::TextureDescriptor::storage_mode
StorageMode storage_mode
Definition: texture_descriptor.h:38
impeller::TSize::IsEmpty
constexpr bool IsEmpty() const
Returns true if either of the width or height are 0, negative, or NaN.
Definition: size.h:105
impeller::TextureDescriptor::compression_type
CompressionType compression_type
Definition: texture_descriptor.h:46