Flutter Engine
The Flutter Engine
capabilities_gles.cc
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
6
9
10namespace impeller {
11
12// https://registry.khronos.org/OpenGL/extensions/EXT/EXT_shader_framebuffer_fetch.txt
13static const constexpr char* kFramebufferFetchExt =
14 "GL_EXT_shader_framebuffer_fetch";
15
16static const constexpr char* kTextureBorderClampExt =
17 "GL_EXT_texture_border_clamp";
18static const constexpr char* kNvidiaTextureBorderClampExt =
19 "GL_NV_texture_border_clamp";
20
21// https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_multisampled_render_to_texture.txt
22static const constexpr char* kMultisampledRenderToTextureExt =
23 "GL_EXT_multisampled_render_to_texture";
24
26 {
27 GLint value = 0;
28 gl.GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &value);
30 }
31
32 {
33 GLint value = 0;
34 gl.GetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &value);
36 }
37
38 auto const desc = gl.GetDescription();
39
40 if (desc->IsES()) {
41 GLint value = 0;
42 gl.GetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &value);
44 }
45
46 {
47 GLint value = 0;
48 gl.GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &value);
50 }
51
52 {
53 GLint value = 0;
54 gl.GetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &value);
56 }
57
58 {
59 GLint value = 0;
60 gl.GetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
62 }
63
64 if (desc->IsES()) {
65 GLint value = 0;
66 gl.GetIntegerv(GL_MAX_VARYING_VECTORS, &value);
68 }
69
70 {
71 GLint value = 0;
72 gl.GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &value);
74 }
75
76 {
77 GLint value = 0;
78 gl.GetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &value);
80 }
81
82 if (desc->IsES()) {
83 GLint value = 0;
84 gl.GetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &value);
86 }
87
88 {
89 GLint values[2] = {};
90 gl.GetIntegerv(GL_MAX_VIEWPORT_DIMS, values);
92 }
93
94 {
95 GLint value = 0;
96 gl.GetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &value);
98 }
99
100 if (desc->IsES()) {
101 GLint value = 0;
102 gl.GetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &value);
104 }
105
106 if (desc->IsES()) {
107 default_glyph_atlas_format_ = PixelFormat::kA8UNormInt;
108 } else {
109 default_glyph_atlas_format_ = PixelFormat::kR8UNormInt;
110 }
111
112 supports_framebuffer_fetch_ = desc->HasExtension(kFramebufferFetchExt);
113
114 if (desc->HasExtension(kTextureBorderClampExt) ||
115 desc->HasExtension(kNvidiaTextureBorderClampExt)) {
116 supports_decal_sampler_address_mode_ = true;
117 }
118
119 if (desc->HasExtension(kMultisampledRenderToTextureExt)) {
120 supports_implicit_msaa_ = true;
121
122 // We hard-code 4x MSAA, so let's make sure it's supported.
123 GLint value = 0;
124 gl.GetIntegerv(GL_MAX_SAMPLES_EXT, &value);
125 supports_offscreen_msaa_ = value >= 4;
126 }
127
128 is_angle_ = desc->IsANGLE();
129}
130
132 switch (stage) {
139 return 0u;
140 }
142}
143
145 return supports_offscreen_msaa_;
146}
147
149 return supports_implicit_msaa_;
150}
151
153 return false;
154}
155
157 return false;
158}
159
161 return supports_framebuffer_fetch_;
162}
163
165 return false;
166}
167
169 return false;
170}
171
173 return false;
174}
175
177 return supports_decal_sampler_address_mode_;
178}
179
181 return false;
182}
183
186}
187
190}
191
194}
195
197 return is_angle_;
198}
199
201 return default_glyph_atlas_format_;
202}
203
204} // namespace impeller
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....
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 ...
CapabilitiesGLES(const ProcTableGLES &gl)
size_t GetMaxTextureUnits(ShaderStage stage) const
bool SupportsOffscreenMSAA() const override
Whether the context backend supports attaching offscreen MSAA color/stencil textures.
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...
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 SupportsCompute() const override
Whether the context backend supports ComputePass.
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 ...
uint8_t value
#define FML_UNREACHABLE()
Definition: logging.h:109
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:99
static const constexpr char * kMultisampledRenderToTextureExt
static const constexpr char * kTextureBorderClampExt
static const constexpr char * kNvidiaTextureBorderClampExt
static const constexpr char * kFramebufferFetchExt
gl
Definition: malisc.py:41