| 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 119 of file texture_gles.cc.

## Constructor & Destructor Documentation

## ◆ TexImage2DData() [1/2]

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

Definition at line 125 of file texture_gles.cc.

125 {
126 switch (pixel_format) {
127 case PixelFormat::kA8UNormInt:
128 internal_format = GL_ALPHA;
129 external_format = GL_ALPHA;
130 type = GL_UNSIGNED_BYTE;
131 break;
132 case PixelFormat::kR8UNormInt:
133 internal_format = GL_RED;
134 external_format = GL_RED;
135 type = GL_UNSIGNED_BYTE;
136 break;
137 case PixelFormat::kR8G8B8A8UNormInt:
138 case PixelFormat::kB8G8R8A8UNormInt:
139 case PixelFormat::kR8G8B8A8UNormIntSRGB:
140 case PixelFormat::kB8G8R8A8UNormIntSRGB:
141 internal_format = GL_RGBA;
142 external_format = GL_RGBA;
143 type = GL_UNSIGNED_BYTE;
144 break;
145 case PixelFormat::kR32G32B32A32Float:
146 internal_format = GL_RGBA;
147 external_format = GL_RGBA;
148 type = GL_FLOAT;
149 break;
150 case PixelFormat::kR16G16B16A16Float:
151 internal_format = GL_RGBA;
152 external_format = GL_RGBA;
153 type = GL_HALF_FLOAT;
154 break;
155 case PixelFormat::kS8UInt:
156 // Pure stencil textures are only available in OpenGL 4.4+, which is
157 // ~0% of mobile devices. Instead, we use a depth-stencil texture and
158 // only use the stencil component.
159 //
160 // https://registry.khronos.org/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml
161 case PixelFormat::kD24UnormS8Uint:
162 internal_format = GL_DEPTH_STENCIL;
163 external_format = GL_DEPTH_STENCIL;
164 type = GL_UNSIGNED_INT_24_8;
165 break;
166 case PixelFormat::kUnknown:
167 case PixelFormat::kD32FloatS8UInt:
168 case PixelFormat::kR8G8UNormInt:
169 case PixelFormat::kB10G10R10XRSRGB:
170 case PixelFormat::kB10G10R10XR:
171 case PixelFormat::kB10G10R10A10XR:
172 return;
173 }
174 is_valid_ = true;
175 }

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 177 of file texture_gles.cc.

179 : TexImage2DData(pixel_format) {
180 data = std::move(mapping);
181 }

References data.

## Member Function Documentation

## ◆ IsValid()

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

Definition at line 183 of file texture_gles.cc.

183 { return is_valid_; }

## Member Data Documentation

## ◆ data

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

Definition at line 123 of file texture_gles.cc.

Referenced by TexImage2DData().

## ◆ external_format

GLenum impeller::TexImage2DData::external_format = GL_NONE

Definition at line 121 of file texture_gles.cc.

Referenced by TexImage2DData().

## ◆ internal_format

GLint impeller::TexImage2DData::internal_format = 0

Definition at line 120 of file texture_gles.cc.

Referenced by TexImage2DData().

## ◆ type

GLenum impeller::TexImage2DData::type = GL_NONE

Definition at line 122 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:125
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:120
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:122
impeller::PixelFormat::kB10G10R10XRSRGB
@ kB10G10R10XRSRGB
impeller::PixelFormat::kB8G8R8A8UNormInt
@ kB8G8R8A8UNormInt
impeller::TexImage2DData::data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:123
impeller::TexImage2DData::external_format
GLenum external_format
Definition: texture_gles.cc:121