Flutter Impeller
impeller::CapabilitiesGLES Class Referencefinal

The Vulkan layers and extensions wrangler. More...

#include <capabilities_gles.h>

Inheritance diagram for impeller::CapabilitiesGLES:
impeller::Capabilities impeller::BackendCast< CapabilitiesGLES, Capabilities >

Public Member Functions

 CapabilitiesGLES (const ProcTableGLES &gl)
 
 CapabilitiesGLES (const CapabilitiesGLES &)=delete
 
 CapabilitiesGLES (CapabilitiesGLES &&)=delete
 
CapabilitiesGLESoperator= (const CapabilitiesGLES &)=delete
 
CapabilitiesGLESoperator= (CapabilitiesGLES &&)=delete
 
size_t GetMaxTextureUnits (ShaderStage stage) const
 
bool IsANGLE () const
 
bool IsES () const
 Whether this is an ES GL variant or (if false) desktop GL. More...
 
bool SupportsOffscreenMSAA () const override
 Whether the context backend supports attaching offscreen MSAA color/stencil textures. More...
 
bool SupportsImplicitResolvingMSAA () const override
 Whether the context backend supports multisampled rendering to the on-screen surface without requiring an explicit resolve of the MSAA color attachment. More...
 
bool SupportsSSBO () const override
 Whether the context backend supports binding Shader Storage Buffer Objects (SSBOs) to pipelines. More...
 
bool SupportsTextureToTextureBlits () const override
 Whether the context backend supports blitting from one texture region to another texture region (via the relevant BlitPass::AddCopy overloads). More...
 
bool SupportsFramebufferFetch () const override
 Whether the context backend is able to support pipelines with shaders that read from the framebuffer (i.e. pixels that have been written by previous draw calls in the current render pass). More...
 
bool SupportsCompute () const override
 Whether the context backend supports ComputePass. More...
 
bool SupportsComputeSubgroups () const override
 Whether the context backend supports configuring ComputePass command subgroups. More...
 
bool SupportsReadFromResolve () const override
 Whether the context backend supports binding the current RenderPass attachments. This is supported if the backend can guarantee that attachment textures will not be mutated until the render pass has fully completed. More...
 
bool SupportsDecalSamplerAddressMode () const override
 Whether the context backend supports SamplerAddressMode::Decal. More...
 
bool SupportsDeviceTransientTextures () const override
 Whether the context backend supports allocating StorageMode::kDeviceTransient (aka "memoryless") textures, which are temporary textures kept in tile memory for the duration of the RenderPass it's attached to. More...
 
bool SupportsTriangleFan () const override
 Whether the primitive type TriangleFan is supported by the backend. More...
 
bool SupportsPrimitiveRestart () const override
 Whether primitive restart is supported. More...
 
bool Supports32BitPrimitiveIndices () const override
 Whether 32-bit values are supported in index buffers used to draw primitives. More...
 
bool SupportsExtendedRangeFormats () const override
 Whether the XR formats are supported on this device. More...
 
PixelFormat GetDefaultColorFormat () const override
 Returns a supported PixelFormat for textures that store 4-channel colors (red/green/blue/alpha). More...
 
PixelFormat GetDefaultStencilFormat () const override
 Returns a supported PixelFormat for textures that store stencil information. May include a depth channel if a stencil-only format is not available. More...
 
PixelFormat GetDefaultDepthStencilFormat () const override
 Returns a supported PixelFormat for textures that store both a stencil and depth component. This will never return a depth-only or stencil-only texture. Returns PixelFormat::kUnknown if no suitable depth+stencil format was found. More...
 
PixelFormat GetDefaultGlyphAtlasFormat () const override
 Returns the default pixel format for the alpha bitmap glyph atlas. More...
 
ISize GetMaximumRenderPassAttachmentSize () const override
 Return the maximum size of a render pass attachment. More...
 
size_t GetMinimumUniformAlignment () const override
 The minimum alignment of uniform value offsets in bytes. More...
 
bool NeedsPartitionedHostBuffer () const override
 Whether the host buffer should use separate device buffers for indexes from other data. More...
 
- Public Member Functions inherited from impeller::Capabilities
virtual ~Capabilities ()
 
virtual size_t GetMinimumStorageBufferAlignment () const
 The minimum alignment of storage buffer value offsets in bytes. More...
 

Public Attributes

size_t max_combined_texture_image_units = 8
 
size_t max_cube_map_texture_size = 16
 
size_t max_fragment_uniform_vectors = 16
 
size_t max_renderbuffer_size = 1
 
size_t max_texture_image_units = 8
 
ISize max_texture_size = ISize{64, 64}
 
size_t max_varying_vectors = 8
 
size_t max_vertex_attribs = 8
 
size_t max_vertex_texture_image_units = 0
 
size_t max_vertex_uniform_vectors = 128
 
ISize max_viewport_dims
 
size_t num_compressed_texture_formats = 0
 
size_t num_shader_binary_formats = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from impeller::BackendCast< CapabilitiesGLES, Capabilities >
static CapabilitiesGLESCast (Capabilities &base)
 
static const CapabilitiesGLESCast (const Capabilities &base)
 
static CapabilitiesGLESCast (Capabilities *base)
 
static const CapabilitiesGLESCast (const Capabilities *base)
 
- Protected Member Functions inherited from impeller::Capabilities
 Capabilities ()
 
 Capabilities (const Capabilities &)=delete
 
Capabilitiesoperator= (const Capabilities &)=delete
 

Detailed Description

The Vulkan layers and extensions wrangler.

Definition at line 23 of file capabilities_gles.h.

Constructor & Destructor Documentation

◆ CapabilitiesGLES() [1/3]

impeller::CapabilitiesGLES::CapabilitiesGLES ( const ProcTableGLES gl)
explicit

Definition at line 32 of file capabilities_gles.cc.

32  {
33  {
34  GLint value = 0;
35  gl.GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &value);
37  }
38 
39  {
40  GLint value = 0;
41  gl.GetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &value);
43  }
44 
45  auto const desc = gl.GetDescription();
46 
47  if (desc->IsES()) {
48  GLint value = 0;
49  gl.GetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &value);
51  }
52 
53  {
54  GLint value = 0;
55  gl.GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &value);
57  }
58 
59  {
60  GLint value = 0;
61  gl.GetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &value);
63  }
64 
65  {
66  GLint value = 0;
67  gl.GetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
69  }
70 
71  if (desc->IsES()) {
72  GLint value = 0;
73  gl.GetIntegerv(GL_MAX_VARYING_VECTORS, &value);
75  }
76 
77  {
78  GLint value = 0;
79  gl.GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &value);
81  }
82 
83  {
84  GLint value = 0;
85  gl.GetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &value);
87  }
88 
89  if (desc->IsES()) {
90  GLint value = 0;
91  gl.GetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &value);
93  }
94 
95  {
96  GLint values[2] = {};
97  gl.GetIntegerv(GL_MAX_VIEWPORT_DIMS, values);
98  max_viewport_dims = ISize{values[0], values[1]};
99  }
100 
101  {
102  GLint value = 0;
103  gl.GetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &value);
105  }
106 
107  if (desc->IsES()) {
108  GLint value = 0;
109  gl.GetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &value);
111  }
112 
113  if (desc->IsES()) {
114  default_glyph_atlas_format_ = PixelFormat::kA8UNormInt;
115  } else {
116  default_glyph_atlas_format_ = PixelFormat::kR8UNormInt;
117  }
118 
119  if (desc->GetGlVersion().major_version >= 3) {
120  supports_texture_to_texture_blits_ = true;
121  }
122 
123  supports_framebuffer_fetch_ = desc->HasExtension(kFramebufferFetchExt);
124 
125  if (desc->HasExtension(kTextureBorderClampExt) ||
126  desc->HasExtension(kNvidiaTextureBorderClampExt)) {
127  supports_decal_sampler_address_mode_ = true;
128  }
129 
130  if (desc->HasExtension(kElementIndexUintExt)) {
131  supports_32bit_primitive_indices_ = true;
132  }
133 
134  if (desc->HasExtension(kMultisampledRenderToTextureExt)) {
135  supports_implicit_msaa_ = true;
136 
137  if (desc->HasExtension(kMultisampledRenderToTexture2Ext)) {
138  // We hard-code 4x MSAA, so let's make sure it's supported.
139  GLint value = 0;
140  gl.GetIntegerv(GL_MAX_SAMPLES_EXT, &value);
141  supports_offscreen_msaa_ = value >= 4;
142  }
143  } else if (desc->GetGlVersion().major_version >= 3 && desc->IsES()) {
144  GLint value = 0;
145  gl.GetIntegerv(GL_MAX_SAMPLES, &value);
146  supports_offscreen_msaa_ = value >= 4;
147  }
148  is_es_ = desc->IsES();
149  is_angle_ = desc->IsANGLE();
150 }
int32_t value
static constexpr const char * kTextureBorderClampExt
static constexpr const char * kMultisampledRenderToTexture2Ext
static constexpr const char * kNvidiaTextureBorderClampExt
static constexpr const char * kFramebufferFetchExt
static constexpr const char * kElementIndexUintExt
ISize64 ISize
Definition: size.h:162
static constexpr const char * kMultisampledRenderToTextureExt

References impeller::ProcTableGLES::GetDescription(), impeller::kA8UNormInt, impeller::kElementIndexUintExt, impeller::kFramebufferFetchExt, impeller::kMultisampledRenderToTexture2Ext, impeller::kMultisampledRenderToTextureExt, impeller::kNvidiaTextureBorderClampExt, impeller::kR8UNormInt, impeller::kTextureBorderClampExt, max_combined_texture_image_units, max_cube_map_texture_size, max_fragment_uniform_vectors, max_renderbuffer_size, max_texture_image_units, max_texture_size, max_varying_vectors, max_vertex_attribs, max_vertex_texture_image_units, max_vertex_uniform_vectors, max_viewport_dims, num_compressed_texture_formats, num_shader_binary_formats, and value.

◆ CapabilitiesGLES() [2/3]

impeller::CapabilitiesGLES::CapabilitiesGLES ( const CapabilitiesGLES )
delete

◆ CapabilitiesGLES() [3/3]

impeller::CapabilitiesGLES::CapabilitiesGLES ( CapabilitiesGLES &&  )
delete

Member Function Documentation

◆ GetDefaultColorFormat()

PixelFormat impeller::CapabilitiesGLES::GetDefaultColorFormat ( ) const
overridevirtual

Returns a supported PixelFormat for textures that store 4-channel colors (red/green/blue/alpha).

Implements impeller::Capabilities.

Definition at line 213 of file capabilities_gles.cc.

213  {
215 }

References impeller::kR8G8B8A8UNormInt.

◆ GetDefaultDepthStencilFormat()

PixelFormat impeller::CapabilitiesGLES::GetDefaultDepthStencilFormat ( ) const
overridevirtual

Returns a supported PixelFormat for textures that store both a stencil and depth component. This will never return a depth-only or stencil-only texture. Returns PixelFormat::kUnknown if no suitable depth+stencil format was found.

Implements impeller::Capabilities.

Definition at line 221 of file capabilities_gles.cc.

221  {
223 }

References impeller::kD24UnormS8Uint.

◆ GetDefaultGlyphAtlasFormat()

PixelFormat impeller::CapabilitiesGLES::GetDefaultGlyphAtlasFormat ( ) const
overridevirtual

Returns the default pixel format for the alpha bitmap glyph atlas.

   Some backends may use Red channel while others use grey. This
   should not have any impact 

Implements impeller::Capabilities.

Definition at line 241 of file capabilities_gles.cc.

241  {
242  return default_glyph_atlas_format_;
243 }

◆ GetDefaultStencilFormat()

PixelFormat impeller::CapabilitiesGLES::GetDefaultStencilFormat ( ) const
overridevirtual

Returns a supported PixelFormat for textures that store stencil information. May include a depth channel if a stencil-only format is not available.

Implements impeller::Capabilities.

Definition at line 217 of file capabilities_gles.cc.

217  {
218  return PixelFormat::kS8UInt;
219 }

References impeller::kS8UInt.

◆ GetMaximumRenderPassAttachmentSize()

ISize impeller::CapabilitiesGLES::GetMaximumRenderPassAttachmentSize ( ) const
overridevirtual

Return the maximum size of a render pass attachment.

Note that this may be smaller than the maximum allocatable texture size.

Implements impeller::Capabilities.

Definition at line 245 of file capabilities_gles.cc.

245  {
246  return max_texture_size;
247 }

References max_texture_size.

◆ GetMaxTextureUnits()

size_t impeller::CapabilitiesGLES::GetMaxTextureUnits ( ShaderStage  stage) const

◆ GetMinimumUniformAlignment()

size_t impeller::CapabilitiesGLES::GetMinimumUniformAlignment ( ) const
overridevirtual

The minimum alignment of uniform value offsets in bytes.

Implements impeller::Capabilities.

Definition at line 249 of file capabilities_gles.cc.

249  {
250  return 256;
251 }

◆ IsANGLE()

bool impeller::CapabilitiesGLES::IsANGLE ( ) const

Definition at line 225 of file capabilities_gles.cc.

225  {
226  return is_angle_;
227 }

◆ IsES()

bool impeller::CapabilitiesGLES::IsES ( ) const

Whether this is an ES GL variant or (if false) desktop GL.

Definition at line 152 of file capabilities_gles.cc.

152  {
153  return is_es_;
154 }

◆ NeedsPartitionedHostBuffer()

bool impeller::CapabilitiesGLES::NeedsPartitionedHostBuffer ( ) const
overridevirtual

Whether the host buffer should use separate device buffers for indexes from other data.

Implements impeller::Capabilities.

Definition at line 253 of file capabilities_gles.cc.

253  {
254 #ifdef FML_OS_EMSCRIPTEN
255  // WebGL has special requirements here to keep indexes and other data
256  // separate. See
257  // https://registry.khronos.org/webgl/specs/latest/2.0/#BUFFER_OBJECT_BINDING
258  return true;
259 #else
260  return false;
261 #endif
262 }

◆ operator=() [1/2]

CapabilitiesGLES& impeller::CapabilitiesGLES::operator= ( CapabilitiesGLES &&  )
delete

◆ operator=() [2/2]

CapabilitiesGLES& impeller::CapabilitiesGLES::operator= ( const CapabilitiesGLES )
delete

◆ Supports32BitPrimitiveIndices()

bool impeller::CapabilitiesGLES::Supports32BitPrimitiveIndices ( ) const
overridevirtual

Whether 32-bit values are supported in index buffers used to draw primitives.

Implements impeller::Capabilities.

Definition at line 233 of file capabilities_gles.cc.

233  {
234  return supports_32bit_primitive_indices_;
235 }

◆ SupportsCompute()

bool impeller::CapabilitiesGLES::SupportsCompute ( ) const
overridevirtual

Whether the context backend supports ComputePass.

Implements impeller::Capabilities.

Definition at line 189 of file capabilities_gles.cc.

189  {
190  return false;
191 }

◆ SupportsComputeSubgroups()

bool impeller::CapabilitiesGLES::SupportsComputeSubgroups ( ) const
overridevirtual

Whether the context backend supports configuring ComputePass command subgroups.

Implements impeller::Capabilities.

Definition at line 193 of file capabilities_gles.cc.

193  {
194  return false;
195 }

◆ SupportsDecalSamplerAddressMode()

bool impeller::CapabilitiesGLES::SupportsDecalSamplerAddressMode ( ) const
overridevirtual

Whether the context backend supports SamplerAddressMode::Decal.

Implements impeller::Capabilities.

Definition at line 201 of file capabilities_gles.cc.

201  {
202  return supports_decal_sampler_address_mode_;
203 }

◆ SupportsDeviceTransientTextures()

bool impeller::CapabilitiesGLES::SupportsDeviceTransientTextures ( ) const
overridevirtual

Whether the context backend supports allocating StorageMode::kDeviceTransient (aka "memoryless") textures, which are temporary textures kept in tile memory for the duration of the RenderPass it's attached to.

This feature is especially useful for MSAA and stencils.

Implements impeller::Capabilities.

Definition at line 205 of file capabilities_gles.cc.

205  {
206  return false;
207 }

◆ SupportsExtendedRangeFormats()

bool impeller::CapabilitiesGLES::SupportsExtendedRangeFormats ( ) const
overridevirtual

Whether the XR formats are supported on this device.

This is only ever true for iOS and macOS devices. We may need to revisit this API when approaching wide gamut rendering for Vulkan and GLES.

Implements impeller::Capabilities.

Definition at line 237 of file capabilities_gles.cc.

237  {
238  return false;
239 }

◆ SupportsFramebufferFetch()

bool impeller::CapabilitiesGLES::SupportsFramebufferFetch ( ) const
overridevirtual

Whether the context backend is able to support pipelines with shaders that read from the framebuffer (i.e. pixels that have been written by previous draw calls in the current render pass).

Example of reading from the first color attachment in a GLSL shader: ``` uniform subpassInput subpass_input;

out vec4 frag_color;

void main() { vec4 color = subpassLoad(subpass_input); // Invert the colors drawn to the framebuffer. frag_color = vec4(vec3(1) - color.rgb, color.a); } ```

Implements impeller::Capabilities.

Definition at line 185 of file capabilities_gles.cc.

185  {
186  return supports_framebuffer_fetch_;
187 }

◆ SupportsImplicitResolvingMSAA()

bool impeller::CapabilitiesGLES::SupportsImplicitResolvingMSAA ( ) const
overridevirtual

Whether the context backend supports multisampled rendering to the on-screen surface without requiring an explicit resolve of the MSAA color attachment.

Implements impeller::Capabilities.

Definition at line 173 of file capabilities_gles.cc.

173  {
174  return supports_implicit_msaa_;
175 }

◆ SupportsOffscreenMSAA()

bool impeller::CapabilitiesGLES::SupportsOffscreenMSAA ( ) const
overridevirtual

Whether the context backend supports attaching offscreen MSAA color/stencil textures.

Implements impeller::Capabilities.

Definition at line 169 of file capabilities_gles.cc.

169  {
170  return supports_offscreen_msaa_;
171 }

◆ SupportsPrimitiveRestart()

bool impeller::CapabilitiesGLES::SupportsPrimitiveRestart ( ) const
overridevirtual

Whether primitive restart is supported.

Implements impeller::Capabilities.

Definition at line 229 of file capabilities_gles.cc.

229  {
230  return false;
231 }

◆ SupportsReadFromResolve()

bool impeller::CapabilitiesGLES::SupportsReadFromResolve ( ) const
overridevirtual

Whether the context backend supports binding the current RenderPass attachments. This is supported if the backend can guarantee that attachment textures will not be mutated until the render pass has fully completed.

This is possible because many mobile graphics cards track RenderPass attachment state in intermediary tile memory prior to Storing the pass in the heap allocated attachments on DRAM. Metal's hazard tracking and Vulkan's barriers are granular enough to allow for safely accessing attachment textures prior to storage in the same RenderPass.

Implements impeller::Capabilities.

Definition at line 197 of file capabilities_gles.cc.

197  {
198  return false;
199 }

◆ SupportsSSBO()

bool impeller::CapabilitiesGLES::SupportsSSBO ( ) const
overridevirtual

Whether the context backend supports binding Shader Storage Buffer Objects (SSBOs) to pipelines.

Implements impeller::Capabilities.

Definition at line 177 of file capabilities_gles.cc.

177  {
178  return false;
179 }

◆ SupportsTextureToTextureBlits()

bool impeller::CapabilitiesGLES::SupportsTextureToTextureBlits ( ) const
overridevirtual

Whether the context backend supports blitting from one texture region to another texture region (via the relevant BlitPass::AddCopy overloads).

Implements impeller::Capabilities.

Definition at line 181 of file capabilities_gles.cc.

181  {
182  return supports_texture_to_texture_blits_;
183 }

◆ SupportsTriangleFan()

bool impeller::CapabilitiesGLES::SupportsTriangleFan ( ) const
overridevirtual

Whether the primitive type TriangleFan is supported by the backend.

Implements impeller::Capabilities.

Definition at line 209 of file capabilities_gles.cc.

209  {
210  return true;
211 }

Member Data Documentation

◆ max_combined_texture_image_units

size_t impeller::CapabilitiesGLES::max_combined_texture_image_units = 8

Definition at line 38 of file capabilities_gles.h.

Referenced by CapabilitiesGLES().

◆ max_cube_map_texture_size

size_t impeller::CapabilitiesGLES::max_cube_map_texture_size = 16

Definition at line 41 of file capabilities_gles.h.

Referenced by CapabilitiesGLES().

◆ max_fragment_uniform_vectors

size_t impeller::CapabilitiesGLES::max_fragment_uniform_vectors = 16

Definition at line 44 of file capabilities_gles.h.

Referenced by CapabilitiesGLES().

◆ max_renderbuffer_size

size_t impeller::CapabilitiesGLES::max_renderbuffer_size = 1

Definition at line 47 of file capabilities_gles.h.

Referenced by CapabilitiesGLES().

◆ max_texture_image_units

size_t impeller::CapabilitiesGLES::max_texture_image_units = 8

Definition at line 50 of file capabilities_gles.h.

Referenced by CapabilitiesGLES(), and GetMaxTextureUnits().

◆ max_texture_size

ISize impeller::CapabilitiesGLES::max_texture_size = ISize{64, 64}

Definition at line 53 of file capabilities_gles.h.

Referenced by CapabilitiesGLES(), and GetMaximumRenderPassAttachmentSize().

◆ max_varying_vectors

size_t impeller::CapabilitiesGLES::max_varying_vectors = 8

Definition at line 56 of file capabilities_gles.h.

Referenced by CapabilitiesGLES().

◆ max_vertex_attribs

size_t impeller::CapabilitiesGLES::max_vertex_attribs = 8

Definition at line 59 of file capabilities_gles.h.

Referenced by CapabilitiesGLES().

◆ max_vertex_texture_image_units

size_t impeller::CapabilitiesGLES::max_vertex_texture_image_units = 0

Definition at line 62 of file capabilities_gles.h.

Referenced by CapabilitiesGLES(), and GetMaxTextureUnits().

◆ max_vertex_uniform_vectors

size_t impeller::CapabilitiesGLES::max_vertex_uniform_vectors = 128

Definition at line 65 of file capabilities_gles.h.

Referenced by CapabilitiesGLES().

◆ max_viewport_dims

ISize impeller::CapabilitiesGLES::max_viewport_dims

Definition at line 68 of file capabilities_gles.h.

Referenced by CapabilitiesGLES().

◆ num_compressed_texture_formats

size_t impeller::CapabilitiesGLES::num_compressed_texture_formats = 0

Definition at line 71 of file capabilities_gles.h.

Referenced by CapabilitiesGLES().

◆ num_shader_binary_formats

size_t impeller::CapabilitiesGLES::num_shader_binary_formats = 0

Definition at line 74 of file capabilities_gles.h.

Referenced by CapabilitiesGLES().


The documentation for this class was generated from the following files: