| Flutter Impeller |

Public Member Functions | Public Attributes | List of all members
impeller::TexImage2DData Struct Reference

## Public Member Functions
| TexImage2DData (PixelFormat pixel_format)
| TexImage2DData (PixelFormat pixel_format, std::shared_ptr< const fml::Mapping > mapping)
bool | IsValid () const

## Public Attributes
GLint | internal_format = 0
GLenum | external_format = GL_NONE
GLenum | type = GL_NONE
std::shared_ptr< const fml::Mapping > | data

## Detailed Description

Definition at line 95 of file texture_gles.cc.

## Constructor & Destructor Documentation

## ◆ TexImage2DData() [1/2]

impeller::TexImage2DData::TexImage2DData | ( | PixelFormat | pixel_format | ) |
| inline explicit

Definition at line 101 of file texture_gles.cc.

101 {
102 switch (pixel_format) {
103 case PixelFormat::kA8UNormInt:
104 internal_format = GL_ALPHA;
105 external_format = GL_ALPHA;
106 type = GL_UNSIGNED_BYTE;
107 break;
108 case PixelFormat::kR8G8B8A8UNormInt:
109 case PixelFormat::kB8G8R8A8UNormInt:
110 case PixelFormat::kR8G8B8A8UNormIntSRGB:
111 case PixelFormat::kB8G8R8A8UNormIntSRGB:
112 internal_format = GL_RGBA;
113 external_format = GL_RGBA;
114 type = GL_UNSIGNED_BYTE;
115 break;
116 case PixelFormat::kR32G32B32A32Float:
117 internal_format = GL_RGBA;
118 external_format = GL_RGBA;
119 type = GL_FLOAT;
120 break;
121 case PixelFormat::kR16G16B16A16Float:
122 internal_format = GL_RGBA;
123 external_format = GL_RGBA;
124 type = GL_HALF_FLOAT;
125 break;
126 case PixelFormat::kS8UInt:
127 // Pure stencil textures are only available in OpenGL 4.4+, which is
128 // ~0% of mobile devices. Instead, we use a depth-stencil texture and
129 // only use the stencil component.
130 //
131 // https://registry.khronos.org/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml
132 internal_format = GL_DEPTH_STENCIL;
133 external_format = GL_DEPTH_STENCIL;
134 type = GL_UNSIGNED_INT_24_8;
135 break;
136 case PixelFormat::kUnknown:
137 case PixelFormat::kD24UnormS8Uint:
138 case PixelFormat::kD32FloatS8UInt:
139 case PixelFormat::kR8UNormInt:
140 case PixelFormat::kR8G8UNormInt:
141 case PixelFormat::kB10G10R10XRSRGB:
142 case PixelFormat::kB10G10R10XR:
143 case PixelFormat::kB10G10R10A10XR:
144 return;
145 }
146 is_valid_ = true;
147 }

References external_format, internal_format, impeller::kA8UNormInt, impeller::kB10G10R10A10XR, impeller::kB10G10R10XR, impeller::kB10G10R10XRSRGB, impeller::kB8G8R8A8UNormInt, impeller::kB8G8R8A8UNormIntSRGB, impeller::kD24UnormS8Uint, impeller::kD32FloatS8UInt, impeller::kR16G16B16A16Float, impeller::kR32G32B32A32Float, impeller::kR8G8B8A8UNormInt, impeller::kR8G8B8A8UNormIntSRGB, impeller::kR8G8UNormInt, impeller::kR8UNormInt, impeller::kS8UInt, impeller::kUnknown, and type.

## ◆ TexImage2DData() [2/2]

impeller::TexImage2DData::TexImage2DData | ( | PixelFormat | pixel_format,
|  | std::shared_ptr< const fml::Mapping > | mapping
| ) |  |
| inline

Definition at line 149 of file texture_gles.cc.

151 : TexImage2DData(pixel_format) {
152 data = std::move(mapping);
153 }

References data.

## Member Function Documentation

## ◆ IsValid()

bool impeller::TexImage2DData::IsValid | ( |  | ) | const
| inline

Definition at line 155 of file texture_gles.cc.

155 { return is_valid_; }

## Member Data Documentation

## ◆ data

std::shared_ptr<const fml::Mapping> impeller::TexImage2DData::data

Definition at line 99 of file texture_gles.cc.

Referenced by TexImage2DData().

## ◆ external_format

GLenum impeller::TexImage2DData::external_format = GL_NONE

Definition at line 97 of file texture_gles.cc.

Referenced by TexImage2DData().

## ◆ internal_format

GLint impeller::TexImage2DData::internal_format = 0

Definition at line 96 of file texture_gles.cc.

Referenced by TexImage2DData().

## ◆ type

GLenum impeller::TexImage2DData::type = GL_NONE

Definition at line 98 of file texture_gles.cc.

Referenced by TexImage2DData().

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

- impeller/renderer/backend/gles/texture_gles.cc

impeller::PixelFormat::kS8UInt
@ kS8UInt
impeller::TexImage2DData::TexImage2DData
TexImage2DData(PixelFormat pixel_format)
Definition: texture_gles.cc:101
impeller::PixelFormat::kB10G10R10A10XR
@ kB10G10R10A10XR
impeller::PixelFormat::kB8G8R8A8UNormIntSRGB
@ kB8G8R8A8UNormIntSRGB
impeller::PixelFormat::kA8UNormInt
@ kA8UNormInt
impeller::PixelFormat::kR8UNormInt
@ kR8UNormInt
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::TexImage2DData::internal_format
GLint internal_format
Definition: texture_gles.cc:96
impeller::PixelFormat::kD32FloatS8UInt
@ kD32FloatS8UInt
impeller::PixelFormat::kR8G8UNormInt
@ kR8G8UNormInt
impeller::PixelFormat::kB10G10R10XR
@ kB10G10R10XR
impeller::PixelFormat::kD24UnormS8Uint
@ kD24UnormS8Uint
impeller::PixelFormat::kR16G16B16A16Float
@ kR16G16B16A16Float
impeller::PixelFormat::kR32G32B32A32Float
@ kR32G32B32A32Float
impeller::PixelFormat::kUnknown
@ kUnknown
impeller::PixelFormat::kR8G8B8A8UNormIntSRGB
@ kR8G8B8A8UNormIntSRGB
impeller::TexImage2DData::type
GLenum type
Definition: texture_gles.cc:98
impeller::PixelFormat::kB10G10R10XRSRGB
@ kB10G10R10XRSRGB
impeller::PixelFormat::kB8G8R8A8UNormInt
@ kB8G8R8A8UNormInt
impeller::TexImage2DData::data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:99
impeller::TexImage2DData::external_format
GLenum external_format
Definition: texture_gles.cc:97