Flutter Impeller
capabilities_gles.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_CAPABILITIES_GLES_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_CAPABILITIES_GLES_H_
7 
8 #include <cstddef>
9 
11 #include "impeller/core/formats.h"
13 #include "impeller/geometry/size.h"
15 
16 namespace impeller {
17 
18 class ProcTableGLES;
19 
20 //------------------------------------------------------------------------------
21 /// @brief The Vulkan layers and extensions wrangler.
22 ///
23 class CapabilitiesGLES final
24  : public Capabilities,
25  public BackendCast<CapabilitiesGLES, Capabilities> {
26  public:
27  explicit CapabilitiesGLES(const ProcTableGLES& gl);
28 
30 
32 
34 
36 
37  // Must be at least 8.
39 
40  // Must be at least 16.
42 
43  // Must be at least 16.
45 
46  // Must be at least 1.
48 
49  // Must be at least 8.
51 
52  // Must be at least 64.
54 
55  // Must be at least 8.
56  size_t max_varying_vectors = 8;
57 
58  // Must be at least 8.
59  size_t max_vertex_attribs = 8;
60 
61  // May be 0.
63 
64  // Must be at least 128.
66 
67  // Must be at least display size.
69 
70  // May be 0.
72 
73  // May be 0.
75 
76  size_t GetMaxTextureUnits(ShaderStage stage) const;
77 
78  bool IsANGLE() const;
79 
80  /// @brief Whether this is an ES GL variant or (if false) desktop GL.
81  bool IsES() const;
82 
83  // |Capabilities|
84  /// Always false. Rendering into a non-zero mip level is not yet implemented
85  /// on the GLES backend; see SupportsFramebufferRenderMipmap in the .cc file.
86  bool SupportsFramebufferRenderMipmap() const override;
87 
88  /// @brief Whether GL_TEXTURE_MAX_LEVEL can be set to bound a texture's
89  /// sampled
90  /// mip range. Core on desktop GL and ES 3.0+; on ES 2.0 it requires
91  /// the GL_APPLE_texture_max_level extension. Without it a partial mip
92  /// chain cannot be made mipmap complete and samples as black.
93  bool SupportsTextureMaxLevel() const;
94 
95  // |Capabilities|
96  bool SupportsOffscreenMSAA() const override;
97 
98  // |Capabilities|
99  bool SupportsImplicitResolvingMSAA() const override;
100 
101  // |Capabilities|
102  bool SupportsSSBO() const override;
103 
104  // |Capabilities|
105  bool SupportsTextureToTextureBlits() const override;
106 
107  // |Capabilities|
108  bool SupportsFramebufferFetch() const override;
109 
110  // |Capabilities|
111  bool SupportsCompute() const override;
112 
113  // |Capabilities|
114  bool SupportsComputeSubgroups() const override;
115 
116  // |Capabilities|
117  bool SupportsReadFromResolve() const override;
118 
119  // |Capabilities|
120  bool SupportsDecalSamplerAddressMode() const override;
121 
122  // |Capabilities|
123  bool SupportsDeviceTransientTextures() const override;
124 
125  // |Capabilities|
126  bool SupportsTriangleFan() const override;
127 
128  // |Capabilities|
129  bool SupportsPrimitiveRestart() const override;
130 
131  // |Capabilities|
132  bool Supports32BitPrimitiveIndices() const override;
133 
134  // |Capabilities|
135  bool SupportsManuallyMippedTextures() const override;
136 
137  // |Capabilities|
138  bool SupportsExtendedRangeFormats() const override;
139 
140  // |Capabilities|
142  CompressedTextureFamily family) const override;
143 
144  // |Capabilities|
145  PixelFormat GetDefaultColorFormat() const override;
146 
147  // |Capabilities|
148  PixelFormat GetDefaultStencilFormat() const override;
149 
150  // |Capabilities|
151  PixelFormat GetDefaultDepthStencilFormat() const override;
152 
153  // |Capabilities|
154  PixelFormat GetDefaultGlyphAtlasFormat() const override;
155 
156  // |Capabilities|
157  ISize GetMaximumRenderPassAttachmentSize() const override;
158 
159  // |Capabilities|
160  uint32_t GetMaxSamplerAnisotropy() const override;
161 
162  // |Capabilities|
163  size_t GetMinimumUniformAlignment() const override;
164 
165  // |Capabilities|
166  bool NeedsPartitionedHostBuffer() const override;
167 
168  private:
169  bool supports_texture_to_texture_blits_ = false;
170  bool supports_framebuffer_fetch_ = false;
171  bool supports_decal_sampler_address_mode_ = false;
172  bool supports_offscreen_msaa_ = false;
173  bool supports_implicit_msaa_ = false;
174  bool supports_32bit_primitive_indices_ = false;
175  bool supports_texture_max_level_ = false;
176  bool is_angle_ = false;
177  bool is_es_ = false;
178  bool supports_texture_compression_bc_ = false;
179  bool supports_texture_compression_etc2_ = false;
180  bool supports_texture_compression_astc_ = false;
181  bool supports_texture_compression_astc_hdr_ = false;
182  uint32_t max_sampler_anisotropy_ = 1;
183  PixelFormat default_glyph_atlas_format_ = PixelFormat::kUnknown;
184 };
185 
186 } // namespace impeller
187 
188 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_CAPABILITIES_GLES_H_
The Vulkan layers and extensions wrangler.
bool IsES() const
Whether this is an ES GL variant or (if false) desktop GL.
bool SupportsImplicitResolvingMSAA() const override
Whether the context backend supports multisampled rendering to the on-screen surface without requirin...
PixelFormat GetDefaultDepthStencilFormat() const override
Returns a supported PixelFormat for textures that store both a stencil and depth component....
CapabilitiesGLES & operator=(const CapabilitiesGLES &)=delete
PixelFormat GetDefaultColorFormat() const override
Returns a supported PixelFormat for textures that store 4-channel colors (red/green/blue/alpha).
bool SupportsSSBO() const override
Whether the context backend supports binding Shader Storage Buffer Objects (SSBOs) to pipelines.
bool SupportsTextureToTextureBlits() const override
Whether the context backend supports blitting from one texture region to another texture region (via ...
ISize GetMaximumRenderPassAttachmentSize() const override
Return the maximum size of a render pass attachment.
bool SupportsFramebufferRenderMipmap() const override
CapabilitiesGLES(const CapabilitiesGLES &)=delete
CapabilitiesGLES(const ProcTableGLES &gl)
bool SupportsPrimitiveRestart() const override
Whether primitive restart is supported.
size_t GetMaxTextureUnits(ShaderStage stage) const
bool NeedsPartitionedHostBuffer() const override
Whether the host buffer should use separate device buffers for indexes from other data.
bool SupportsTriangleFan() const override
Whether the primitive type TriangleFan is supported by the backend.
bool Supports32BitPrimitiveIndices() const override
Whether 32-bit values are supported in index buffers used to draw primitives.
CapabilitiesGLES(CapabilitiesGLES &&)=delete
uint32_t GetMaxSamplerAnisotropy() const override
The maximum anisotropy clamp supported by device samplers.
bool SupportsTextureCompression(CompressedTextureFamily family) const override
Whether the given family of block-compressed texture formats is supported by this device....
bool SupportsTextureMaxLevel() const
Whether GL_TEXTURE_MAX_LEVEL can be set to bound a texture's sampled mip range. Core on desktop GL an...
bool SupportsOffscreenMSAA() const override
Whether the context backend supports attaching offscreen MSAA color/stencil textures.
size_t GetMinimumUniformAlignment() const override
The minimum alignment of uniform value offsets in bytes.
PixelFormat GetDefaultStencilFormat() const override
Returns a supported PixelFormat for textures that store stencil information. May include a depth chan...
bool SupportsReadFromResolve() const override
Whether the context backend supports binding the current RenderPass attachments. This is supported if...
CapabilitiesGLES & operator=(CapabilitiesGLES &&)=delete
bool SupportsDeviceTransientTextures() const override
Whether the context backend supports allocating StorageMode::kDeviceTransient (aka "memoryless") text...
bool SupportsDecalSamplerAddressMode() const override
Whether the context backend supports SamplerAddressMode::Decal.
PixelFormat GetDefaultGlyphAtlasFormat() const override
Returns the default pixel format for the alpha bitmap glyph atlas.
bool SupportsExtendedRangeFormats() const override
Whether the XR formats are supported on this device.
bool SupportsCompute() const override
Whether the context backend supports ComputePass.
bool SupportsManuallyMippedTextures() const override
Whether a texture whose mip levels were uploaded by hand (rather than produced by BlitPass::GenerateM...
bool SupportsComputeSubgroups() const override
Whether the context backend supports configuring ComputePass command subgroups.
bool SupportsFramebufferFetch() const override
Whether the context backend is able to support pipelines with shaders that read from the framebuffer ...
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:99
CompressedTextureFamily
The family of a block-compressed pixel format. GPUs support compressed formats on a per-family basis,...
Definition: formats.h:146