• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2014 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 #ifndef LIBANGLE_CAPS_H_
8 #define LIBANGLE_CAPS_H_
9 
10 #include "angle_gl.h"
11 #include "libANGLE/Version.h"
12 #include "libANGLE/angletypes.h"
13 #include "libANGLE/gles_extensions_autogen.h"
14 #include "libANGLE/renderer/Format.h"
15 
16 #include <array>
17 #include <map>
18 #include <set>
19 #include <string>
20 #include <vector>
21 
22 namespace gl
23 {
24 struct TextureCaps
25 {
26     TextureCaps();
27     TextureCaps(const TextureCaps &other);
28     TextureCaps &operator=(const TextureCaps &other);
29 
30     ~TextureCaps();
31 
32     // Supports for basic texturing: glTexImage, glTexSubImage, etc
33     bool texturable = false;
34 
35     // Support for linear or anisotropic filtering
36     bool filterable = false;
37 
38     // Support for being used as a framebuffer attachment, i.e. glFramebufferTexture2D
39     bool textureAttachment = false;
40 
41     // Support for being used as a renderbuffer format, i.e. glFramebufferRenderbuffer
42     bool renderbuffer = false;
43 
44     // Support for blend modes while being used as a framebuffer attachment
45     bool blendable = false;
46 
47     // Set of supported sample counts, only guaranteed to be valid in ES3.
48     SupportedSampleSet sampleCounts;
49 
50     // Get the maximum number of samples supported
51     GLuint getMaxSamples() const;
52 
53     // Get the number of supported samples that is at least as many as requested.  Returns 0 if
54     // there are no sample counts available
55     GLuint getNearestSamples(GLuint requestedSamples) const;
56 };
57 
58 TextureCaps GenerateMinimumTextureCaps(GLenum internalFormat,
59                                        const Version &clientVersion,
60                                        const Extensions &extensions);
61 
62 class TextureCapsMap final : angle::NonCopyable
63 {
64   public:
65     TextureCapsMap();
66     ~TextureCapsMap();
67 
68     // These methods are deprecated. Please use angle::Format for new features.
69     void insert(GLenum internalFormat, const TextureCaps &caps);
70     const TextureCaps &get(GLenum internalFormat) const;
71 
72     void clear();
73 
74     // Prefer using angle::Format methods.
75     const TextureCaps &get(angle::FormatID formatID) const;
76     void set(angle::FormatID formatID, const TextureCaps &caps);
77 
78   private:
79     TextureCaps &get(angle::FormatID formatID);
80 
81     // Indexed by angle::FormatID
82     angle::FormatMap<TextureCaps> mFormatData;
83 };
84 
85 void InitMinimumTextureCapsMap(const Version &clientVersion,
86                                const Extensions &extensions,
87                                TextureCapsMap *capsMap);
88 
89 // Returns true if all the formats required to support GL_ANGLE_compressed_texture_etc are
90 // present. Does not determine if they are natively supported without decompression.
91 bool DetermineCompressedTextureETCSupport(const TextureCapsMap &textureCaps);
92 
93 // Pointer to a boolean member of the Extensions struct
94 using ExtensionBool = bool Extensions::*;
95 
96 struct ExtensionInfo
97 {
98     // If this extension can be enabled or disabled  with glRequestExtension
99     // (GL_ANGLE_request_extension)
100     bool Requestable = false;
101     bool Disablable  = false;
102 
103     // Pointer to a boolean member of the Extensions struct
104     ExtensionBool ExtensionsMember = nullptr;
105 };
106 
107 using ExtensionInfoMap = std::map<std::string, ExtensionInfo>;
108 const ExtensionInfoMap &GetExtensionInfoMap();
109 
110 struct Limitations
111 {
112     Limitations();
113     Limitations(const Limitations &other);
114 
115     Limitations &operator=(const Limitations &other);
116 
117     // Renderer doesn't support gl_FrontFacing in fragment shaders
118     bool noFrontFacingSupport = false;
119 
120     // Renderer doesn't support GL_SAMPLE_ALPHA_TO_COVERAGE
121     bool noSampleAlphaToCoverageSupport = false;
122 
123     // In glVertexAttribDivisorANGLE, attribute zero must have a zero divisor
124     bool attributeZeroRequiresZeroDivisorInEXT = false;
125 
126     // Unable to support different values for front and back faces for stencil refs and masks
127     bool noSeparateStencilRefsAndMasks = false;
128 
129     // Renderer doesn't support non-constant indexing loops in fragment shader
130     bool shadersRequireIndexedLoopValidation = false;
131 
132     // Renderer doesn't support Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA
133     // and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR blend functions.
134     bool noSimultaneousConstantColorAndAlphaBlendFunc = false;
135 
136     // Renderer always clamps constant blend color.
137     bool noUnclampedBlendColor = false;
138 
139     // D3D9 does not support flexible varying register packing.
140     bool noFlexibleVaryingPacking = false;
141 
142     // D3D does not support having multiple transform feedback outputs go to the same buffer.
143     bool noDoubleBoundTransformFeedbackBuffers = false;
144 
145     // D3D does not support vertex attribute aliasing
146     bool noVertexAttributeAliasing = false;
147 
148     // Renderer doesn't support GL_TEXTURE_COMPARE_MODE=GL_NONE on a shadow sampler.
149     // TODO(http://anglebug.com/5231): add validation code to front-end.
150     bool noShadowSamplerCompareModeNone = false;
151 
152     // PVRTC1 textures must be squares.
153     bool squarePvrtc1 = false;
154 
155     // ETC1 texture support is emulated.
156     bool emulatedEtc1 = false;
157 
158     // ASTC texture support is emulated.
159     bool emulatedAstc = false;
160 
161     // No compressed TEXTURE_3D support.
162     bool noCompressedTexture3D = false;
163 
164     // D3D does not support compressed textures where the base mip level is not a multiple of 4
165     bool compressedBaseMipLevelMultipleOfFour = false;
166 
167     bool limitWebglMaxTextureSizeTo4096 = false;
168 };
169 
170 struct TypePrecision
171 {
172     TypePrecision();
173     TypePrecision(const TypePrecision &other);
174 
175     TypePrecision &operator=(const TypePrecision &other);
176 
177     void setIEEEFloat();
178     void setIEEEHalfFloat();
179     void setTwosComplementInt(unsigned int bits);
180     void setSimulatedFloat(unsigned int range, unsigned int precision);
181     void setSimulatedInt(unsigned int range);
182 
183     void get(GLint *returnRange, GLint *returnPrecision) const;
184 
185     std::array<GLint, 2> range = {0, 0};
186     GLint precision            = 0;
187 };
188 
189 struct Caps
190 {
191     Caps();
192     Caps(const Caps &other);
193     Caps &operator=(const Caps &other);
194 
195     ~Caps();
196 
197     // If the values could be got by using GetIntegeri_v, they should
198     // be GLint instead of GLuint and call LimitToInt() to ensure
199     // they will not overflow.
200 
201     GLfloat minInterpolationOffset        = 0;
202     GLfloat maxInterpolationOffset        = 0;
203     GLint subPixelInterpolationOffsetBits = 0;
204 
205     // ES 3.1 (April 29, 2015) 20.39: implementation dependent values
206     GLint64 maxElementIndex       = 0;
207     GLint max3DTextureSize        = 0;
208     GLint max2DTextureSize        = 0;
209     GLint maxRectangleTextureSize = 0;
210     GLint maxArrayTextureLayers   = 0;
211     GLfloat maxLODBias            = 0.0f;
212     GLint maxCubeMapTextureSize   = 0;
213     GLint maxRenderbufferSize     = 0;
214     GLfloat minAliasedPointSize   = 1.0f;
215     GLfloat maxAliasedPointSize   = 1.0f;
216     GLfloat minAliasedLineWidth   = 0.0f;
217     GLfloat maxAliasedLineWidth   = 0.0f;
218 
219     // ES 3.1 (April 29, 2015) 20.40: implementation dependent values (cont.)
220     GLint maxDrawBuffers         = 0;
221     GLint maxFramebufferWidth    = 0;
222     GLint maxFramebufferHeight   = 0;
223     GLint maxFramebufferSamples  = 0;
224     GLint maxColorAttachments    = 0;
225     GLint maxViewportWidth       = 0;
226     GLint maxViewportHeight      = 0;
227     GLint maxSampleMaskWords     = 0;
228     GLint maxColorTextureSamples = 0;
229     GLint maxDepthTextureSamples = 0;
230     GLint maxIntegerSamples      = 0;
231     GLint64 maxServerWaitTimeout = 0;
232 
233     // ES 3.1 (April 29, 2015) Table 20.41: Implementation dependent values (cont.)
234     GLint maxVertexAttribRelativeOffset = 0;
235     GLint maxVertexAttribBindings       = 0;
236     GLint maxVertexAttribStride         = 0;
237     GLint maxElementsIndices            = 0;
238     GLint maxElementsVertices           = 0;
239     std::vector<GLenum> compressedTextureFormats;
240     std::vector<GLenum> programBinaryFormats;
241     std::vector<GLenum> shaderBinaryFormats;
242     TypePrecision vertexHighpFloat;
243     TypePrecision vertexMediumpFloat;
244     TypePrecision vertexLowpFloat;
245     TypePrecision vertexHighpInt;
246     TypePrecision vertexMediumpInt;
247     TypePrecision vertexLowpInt;
248     TypePrecision fragmentHighpFloat;
249     TypePrecision fragmentMediumpFloat;
250     TypePrecision fragmentLowpFloat;
251     TypePrecision fragmentHighpInt;
252     TypePrecision fragmentMediumpInt;
253     TypePrecision fragmentLowpInt;
254 
255     // Implementation dependent limits required on all shader types.
256     // TODO(jiawei.shao@intel.com): organize all such limits into ShaderMap.
257     // ES 3.1 (April 29, 2015) Table 20.43: Implementation dependent Vertex shader limits
258     // ES 3.1 (April 29, 2015) Table 20.44: Implementation dependent Fragment shader limits
259     // ES 3.1 (April 29, 2015) Table 20.45: implementation dependent compute shader limits
260     // GL_EXT_geometry_shader (May 31, 2016) Table 20.43gs: Implementation dependent geometry shader
261     // limits
262     // GL_EXT_geometry_shader (May 31, 2016) Table 20.46: Implementation dependent aggregate shader
263     // limits
264     ShaderMap<GLint> maxShaderUniformBlocks        = {};
265     ShaderMap<GLint> maxShaderTextureImageUnits    = {};
266     ShaderMap<GLint> maxShaderStorageBlocks        = {};
267     ShaderMap<GLint> maxShaderUniformComponents    = {};
268     ShaderMap<GLint> maxShaderAtomicCounterBuffers = {};
269     ShaderMap<GLint> maxShaderAtomicCounters       = {};
270     ShaderMap<GLint> maxShaderImageUniforms        = {};
271     // Note that we can query MAX_COMPUTE_UNIFORM_COMPONENTS and MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT
272     // by GetIntegerv, but we can only use GetInteger64v on MAX_VERTEX_UNIFORM_COMPONENTS and
273     // MAX_FRAGMENT_UNIFORM_COMPONENTS. Currently we use GLuint64 to store all these values so that
274     // we can put them together into one ShaderMap.
275     ShaderMap<GLint64> maxCombinedShaderUniformComponents = {};
276 
277     // ES 3.1 (April 29, 2015) Table 20.43: Implementation dependent Vertex shader limits
278     GLint maxVertexAttributes       = 0;
279     GLint maxVertexUniformVectors   = 0;
280     GLint maxVertexOutputComponents = 0;
281 
282     // ES 3.1 (April 29, 2015) Table 20.44: Implementation dependent Fragment shader limits
283     GLint maxFragmentUniformVectors     = 0;
284     GLint maxFragmentInputComponents    = 0;
285     GLint minProgramTextureGatherOffset = 0;
286     GLint maxProgramTextureGatherOffset = 0;
287     GLint minProgramTexelOffset         = 0;
288     GLint maxProgramTexelOffset         = 0;
289 
290     // ES 3.1 (April 29, 2015) Table 20.45: implementation dependent compute shader limits
291     std::array<GLint, 3> maxComputeWorkGroupCount = {0, 0, 0};
292     std::array<GLint, 3> maxComputeWorkGroupSize  = {0, 0, 0};
293     GLint maxComputeWorkGroupInvocations          = 0;
294     GLint maxComputeSharedMemorySize              = 0;
295 
296     // ES 3.1 (April 29, 2015) Table 20.46: implementation dependent aggregate shader limits
297     GLint maxUniformBufferBindings         = 0;
298     GLint64 maxUniformBlockSize            = 0;
299     GLint uniformBufferOffsetAlignment     = 0;
300     GLint maxCombinedUniformBlocks         = 0;
301     GLint maxVaryingComponents             = 0;
302     GLint maxVaryingVectors                = 0;
303     GLint maxCombinedTextureImageUnits     = 0;
304     GLint maxCombinedShaderOutputResources = 0;
305 
306     // ES 3.1 (April 29, 2015) Table 20.47: implementation dependent aggregate shader limits (cont.)
307     GLint maxUniformLocations                = 0;
308     GLint maxAtomicCounterBufferBindings     = 0;
309     GLint maxAtomicCounterBufferSize         = 0;
310     GLint maxCombinedAtomicCounterBuffers    = 0;
311     GLint maxCombinedAtomicCounters          = 0;
312     GLint maxImageUnits                      = 0;
313     GLint maxCombinedImageUniforms           = 0;
314     GLint maxShaderStorageBufferBindings     = 0;
315     GLint64 maxShaderStorageBlockSize        = 0;
316     GLint maxCombinedShaderStorageBlocks     = 0;
317     GLint shaderStorageBufferOffsetAlignment = 0;
318 
319     // ES 3.1 (April 29, 2015) Table 20.48: implementation dependent transform feedback limits
320     GLint maxTransformFeedbackInterleavedComponents = 0;
321     GLint maxTransformFeedbackSeparateAttributes    = 0;
322     GLint maxTransformFeedbackSeparateComponents    = 0;
323 
324     // ES 3.1 (April 29, 2015) Table 20.49: Framebuffer Dependent Values
325     GLint maxSamples = 0;
326 
327     // GL_EXT_geometry_shader (May 31, 2016) Table 20.40: Implementation-Dependent Values (cont.)
328     GLint maxFramebufferLayers = 0;
329     GLint layerProvokingVertex = 0;
330 
331     // GL_EXT_geometry_shader (May 31, 2016) Table 20.43gs: Implementation dependent geometry shader
332     // limits
333     GLint maxGeometryInputComponents       = 0;
334     GLint maxGeometryOutputComponents      = 0;
335     GLint maxGeometryOutputVertices        = 0;
336     GLint maxGeometryTotalOutputComponents = 0;
337     GLint maxGeometryShaderInvocations     = 0;
338 
339     // GL_EXT_tessellation_shader
340     GLint maxTessControlInputComponents       = 0;
341     GLint maxTessControlOutputComponents      = 0;
342     GLint maxTessControlTotalOutputComponents = 0;
343 
344     GLint maxTessPatchComponents = 0;
345     GLint maxPatchVertices       = 0;
346     GLint maxTessGenLevel        = 0;
347 
348     GLint maxTessEvaluationInputComponents  = 0;
349     GLint maxTessEvaluationOutputComponents = 0;
350 
351     GLuint subPixelBits = 4;
352 
353     // GL_EXT_blend_func_extended
354     GLuint maxDualSourceDrawBuffers = 0;
355 
356     // GL_EXT_texture_filter_anisotropic
357     GLfloat maxTextureAnisotropy = 0.0f;
358 
359     // GL_EXT_disjoint_timer_query
360     GLuint queryCounterBitsTimeElapsed = 0;
361     GLuint queryCounterBitsTimestamp   = 0;
362 
363     // OVR_multiview
364     GLuint maxViews = 1;
365 
366     // GL_KHR_debug
367     GLuint maxDebugMessageLength   = 0;
368     GLuint maxDebugLoggedMessages  = 0;
369     GLuint maxDebugGroupStackDepth = 0;
370     GLuint maxLabelLength          = 0;
371 
372     // GL_APPLE_clip_distance / GL_EXT_clip_cull_distance / GL_ANGLE_clip_cull_distance
373     GLuint maxClipDistances                = 0;
374     GLuint maxCullDistances                = 0;
375     GLuint maxCombinedClipAndCullDistances = 0;
376 
377     // GL_ANGLE_shader_pixel_local_storage
378     GLuint maxPixelLocalStoragePlanes                       = 0;
379     GLuint maxColorAttachmentsWithActivePixelLocalStorage   = 0;
380     GLuint maxCombinedDrawBuffersAndPixelLocalStoragePlanes = 0;
381 
382     // GL_EXT_shader_pixel_local_storage.
383     GLuint maxShaderPixelLocalStorageFastSizeEXT = 0;
384 
385     // GLES1 emulation: Caps for ES 1.1. Taken from Table 6.20 / 6.22 in the OpenGL ES 1.1 spec.
386     GLuint maxMultitextureUnits                 = 0;
387     GLuint maxClipPlanes                        = 0;
388     GLuint maxLights                            = 0;
389     static constexpr int GlobalMatrixStackDepth = 16;
390     GLuint maxModelviewMatrixStackDepth         = 0;
391     GLuint maxProjectionMatrixStackDepth        = 0;
392     GLuint maxTextureMatrixStackDepth           = 0;
393     GLfloat minSmoothPointSize                  = 0.0f;
394     GLfloat maxSmoothPointSize                  = 0.0f;
395     GLfloat minSmoothLineWidth                  = 0.0f;
396     GLfloat maxSmoothLineWidth                  = 0.0f;
397 
398     // ES 3.2 Table 20.41: Implementation Dependent Values (cont.)
399     GLint maxTextureBufferSize         = 0;
400     GLint textureBufferOffsetAlignment = 0;
401 
402     // GL_ARM_shader_framebuffer_fetch
403     bool fragmentShaderFramebufferFetchMRT = false;
404 };
405 
406 Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensions);
407 }  // namespace gl
408 
409 namespace egl
410 {
411 
412 struct Caps
413 {
414     Caps();
415 
416     // Support for NPOT surfaces
417     bool textureNPOT = false;
418 
419     // Support for Stencil8 configs
420     bool stencil8 = false;
421 };
422 
423 struct DisplayExtensions
424 {
425     DisplayExtensions();
426 
427     // Generate a vector of supported extension strings
428     std::vector<std::string> getStrings() const;
429 
430     // EGL_EXT_create_context_robustness
431     bool createContextRobustness = false;
432 
433     // EGL_ANGLE_d3d_share_handle_client_buffer
434     bool d3dShareHandleClientBuffer = false;
435 
436     // EGL_ANGLE_d3d_texture_client_buffer
437     bool d3dTextureClientBuffer = false;
438 
439     // EGL_ANGLE_surface_d3d_texture_2d_share_handle
440     bool surfaceD3DTexture2DShareHandle = false;
441 
442     // EGL_ANGLE_query_surface_pointer
443     bool querySurfacePointer = false;
444 
445     // EGL_ANGLE_window_fixed_size
446     bool windowFixedSize = false;
447 
448     // EGL_ANGLE_keyed_mutex
449     bool keyedMutex = false;
450 
451     // EGL_ANGLE_surface_orientation
452     bool surfaceOrientation = false;
453 
454     // EGL_NV_post_sub_buffer
455     bool postSubBuffer = false;
456 
457     // EGL_KHR_create_context
458     bool createContext = false;
459 
460     // EGL_KHR_image
461     bool image = false;
462 
463     // EGL_KHR_image_base
464     bool imageBase = false;
465 
466     // EGL_KHR_image_pixmap
467     bool imagePixmap = false;
468 
469     // EGL_KHR_gl_texture_2D_image
470     bool glTexture2DImage = false;
471 
472     // EGL_KHR_gl_texture_cubemap_image
473     bool glTextureCubemapImage = false;
474 
475     // EGL_KHR_gl_texture_3D_image
476     bool glTexture3DImage = false;
477 
478     // EGL_KHR_gl_renderbuffer_image
479     bool glRenderbufferImage = false;
480 
481     // EGL_KHR_get_all_proc_addresses
482     bool getAllProcAddresses = false;
483 
484     // EGL_ANGLE_direct_composition
485     bool directComposition = false;
486 
487     // EGL_ANGLE_windows_ui_composition
488     bool windowsUIComposition = false;
489 
490     // KHR_create_context_no_error
491     bool createContextNoError = false;
492 
493     // EGL_KHR_stream
494     bool stream = false;
495 
496     // EGL_KHR_stream_consumer_gltexture
497     bool streamConsumerGLTexture = false;
498 
499     // EGL_NV_stream_consumer_gltexture_yuv
500     bool streamConsumerGLTextureYUV = false;
501 
502     // EGL_ANGLE_stream_producer_d3d_texture
503     bool streamProducerD3DTexture = false;
504 
505     // EGL_KHR_fence_sync
506     bool fenceSync = false;
507 
508     // EGL_KHR_wait_sync
509     bool waitSync = false;
510 
511     // EGL_ANGLE_create_context_webgl_compatibility
512     bool createContextWebGLCompatibility = false;
513 
514     // EGL_CHROMIUM_create_context_bind_generates_resource
515     bool createContextBindGeneratesResource = false;
516 
517     // EGL_CHROMIUM_sync_control
518     bool syncControlCHROMIUM = false;
519 
520     // EGL_ANGLE_sync_control_rate
521     bool syncControlRateANGLE = false;
522 
523     // EGL_KHR_swap_buffers_with_damage
524     bool swapBuffersWithDamage = false;
525 
526     // EGL_EXT_pixel_format_float
527     bool pixelFormatFloat = false;
528 
529     // EGL_KHR_surfaceless_context
530     bool surfacelessContext = false;
531 
532     // EGL_ANGLE_display_texture_share_group
533     bool displayTextureShareGroup = false;
534 
535     // EGL_ANGLE_display_semaphore_share_group
536     bool displaySemaphoreShareGroup = false;
537 
538     // EGL_ANGLE_create_context_client_arrays
539     bool createContextClientArrays = false;
540 
541     // EGL_ANGLE_program_cache_control
542     bool programCacheControlANGLE = false;
543 
544     // EGL_ANGLE_robust_resource_initialization
545     bool robustResourceInitializationANGLE = false;
546 
547     // EGL_ANGLE_iosurface_client_buffer
548     bool iosurfaceClientBuffer = false;
549 
550     // EGL_ANGLE_metal_texture_client_buffer
551     bool mtlTextureClientBuffer = false;
552 
553     // EGL_ANGLE_create_context_extensions_enabled
554     bool createContextExtensionsEnabled = false;
555 
556     // EGL_ANDROID_presentation_time
557     bool presentationTime = false;
558 
559     // EGL_ANDROID_blob_cache
560     bool blobCache = false;
561 
562     // EGL_ANDROID_image_native_buffer
563     bool imageNativeBuffer = false;
564 
565     // EGL_ANDROID_get_frame_timestamps
566     bool getFrameTimestamps = false;
567 
568     // EGL_ANGLE_timestamp_surface_attribute
569     bool timestampSurfaceAttributeANGLE = false;
570 
571     // EGL_ANDROID_recordable
572     bool recordable = false;
573 
574     // EGL_ANGLE_power_preference
575     bool powerPreference = false;
576 
577     // EGL_ANGLE_wait_until_work_scheduled
578     bool waitUntilWorkScheduled = false;
579 
580     // EGL_ANGLE_image_d3d11_texture
581     bool imageD3D11Texture = false;
582 
583     // EGL_ANDROID_get_native_client_buffer
584     bool getNativeClientBufferANDROID = false;
585 
586     // EGL_ANDROID_create_native_client_buffer
587     bool createNativeClientBufferANDROID = false;
588 
589     // EGL_ANDROID_native_fence_sync
590     bool nativeFenceSyncANDROID = false;
591 
592     // EGL_ANGLE_create_context_backwards_compatible
593     bool createContextBackwardsCompatible = false;
594 
595     // EGL_KHR_no_config_context
596     bool noConfigContext = false;
597 
598     // EGL_IMG_context_priority
599     bool contextPriority = false;
600 
601     // EGL_ANGLE_ggp_stream_descriptor
602     bool ggpStreamDescriptor = false;
603 
604     // EGL_ANGLE_swap_with_frame_token
605     bool swapWithFrameToken = false;
606 
607     // EGL_KHR_gl_colorspace
608     bool glColorspace = false;
609 
610     // EGL_EXT_gl_colorspace_display_p3_linear
611     bool glColorspaceDisplayP3Linear = false;
612 
613     // EGL_EXT_gl_colorspace_display_p3
614     bool glColorspaceDisplayP3 = false;
615 
616     // EGL_EXT_gl_colorspace_scrgb
617     bool glColorspaceScrgb = false;
618 
619     // EGL_EXT_gl_colorspace_scrgb_linear
620     bool glColorspaceScrgbLinear = false;
621 
622     // EGL_EXT_gl_colorspace_display_p3_passthrough
623     bool glColorspaceDisplayP3Passthrough = false;
624 
625     // EGL_ANGLE_colorspace_attribute_passthrough
626     bool eglColorspaceAttributePassthroughANGLE = false;
627 
628     // EGL_ANDROID_framebuffer_target
629     bool framebufferTargetANDROID = false;
630 
631     // EGL_EXT_image_gl_colorspace
632     bool imageGlColorspace = false;
633 
634     // EGL_EXT_image_dma_buf_import
635     bool imageDmaBufImportEXT = false;
636 
637     // EGL_EXT_image_dma_buf_import_modifiers
638     bool imageDmaBufImportModifiersEXT = false;
639 
640     // EGL_NOK_texture_from_pixmap
641     bool textureFromPixmapNOK = false;
642 
643     // EGL_NV_robustness_video_memory_purge
644     bool robustnessVideoMemoryPurgeNV = false;
645 
646     // EGL_KHR_reusable_sync
647     bool reusableSyncKHR = false;
648 
649     // EGL_ANGLE_external_context_and_surface
650     bool externalContextAndSurface = false;
651 
652     // EGL_EXT_buffer_age
653     bool bufferAgeEXT = false;
654 
655     // EGL_KHR_mutable_render_buffer
656     bool mutableRenderBufferKHR = false;
657 
658     // EGL_EXT_protected_content
659     bool protectedContentEXT = false;
660 
661     // EGL_ANGLE_create_surface_swap_interval
662     bool createSurfaceSwapIntervalANGLE = false;
663 
664     // EGL_ANGLE_context_virtualization
665     bool contextVirtualizationANGLE = false;
666 
667     // EGL_KHR_lock_surface3
668     bool lockSurface3KHR = false;
669 
670     // EGL_ANGLE_vulkan_image
671     bool vulkanImageANGLE = false;
672 
673     // EGL_ANGLE_metal_create_context_ownership_identity
674     bool metalCreateContextOwnershipIdentityANGLE = false;
675 
676     // EGL_KHR_partial_update
677     bool partialUpdateKHR = false;
678 
679     // EGL_ANGLE_sync_mtl_shared_event
680     bool mtlSyncSharedEventANGLE = false;
681 };
682 
683 struct DeviceExtensions
684 {
685     DeviceExtensions();
686 
687     // Generate a vector of supported extension strings
688     std::vector<std::string> getStrings() const;
689 
690     // EGL_ANGLE_device_d3d
691     bool deviceD3D = false;
692 
693     // EGL_ANGLE_device_cgl
694     bool deviceCGL = false;
695 
696     // EGL_ANGLE_device_eagl
697     bool deviceEAGL = false;
698 
699     // EGL_ANGLE_device_metal
700     bool deviceMetal = false;
701 
702     // EGL_ANGLE_device_vulkan
703     bool deviceVulkan = false;
704 
705     // EGL_EXT_device_drm
706     bool deviceDrmEXT = false;
707 
708     // EGL_EXT_device_drm_render_node
709     bool deviceDrmRenderNodeEXT = false;
710 };
711 
712 struct ClientExtensions
713 {
714     ClientExtensions();
715     ClientExtensions(const ClientExtensions &other);
716 
717     // Generate a vector of supported extension strings
718     std::vector<std::string> getStrings() const;
719 
720     // EGL_EXT_client_extensions
721     bool clientExtensions = false;
722 
723     // EGL_EXT_platform_base
724     bool platformBase = false;
725 
726     // EGL_EXT_platform_device
727     bool platformDevice = false;
728 
729     // EGL_KHR_platform_gbm
730     bool platformGbmKHR = false;
731 
732     // EGL_EXT_platform_wayland
733     bool platformWaylandEXT = false;
734 
735     // EGL_ANGLE_platform_angle
736     bool platformANGLE = false;
737 
738     // EGL_ANGLE_platform_angle_d3d
739     bool platformANGLED3D = false;
740 
741     // EGL_ANGLE_platform_angle_d3d11on12
742     bool platformANGLED3D11ON12 = false;
743 
744     // EGL_ANGLE_platform_angle_opengl
745     bool platformANGLEOpenGL = false;
746 
747     // EGL_ANGLE_platform_angle_null
748     bool platformANGLENULL = false;
749 
750     // EGL_ANGLE_platform_angle_vulkan
751     bool platformANGLEVulkan = false;
752 
753     // EGL_ANGLE_platform_angle_metal
754     bool platformANGLEMetal = false;
755 
756     // EGL_ANGLE_platform_angle_device_context_volatile_eagl
757     bool platformANGLEDeviceContextVolatileEagl = false;
758 
759     // EGL_ANGLE_platform_angle_device_context_volatile_cgl
760     bool platformANGLEDeviceContextVolatileCgl = false;
761 
762     // EGL_ANGLE_platform_angle_device_id
763     bool platformANGLEDeviceId = false;
764 
765     // EGL_ANGLE_device_creation
766     bool deviceCreation = false;
767 
768     // EGL_ANGLE_device_creation_d3d11
769     bool deviceCreationD3D11 = false;
770 
771     // EGL_ANGLE_x11_visual
772     bool x11Visual = false;
773 
774     // EGL_ANGLE_experimental_present_path
775     bool experimentalPresentPath = false;
776 
777     // EGL_KHR_client_get_all_proc_addresses
778     bool clientGetAllProcAddresses = false;
779 
780     // EGL_KHR_debug
781     bool debug = false;
782 
783     // EGL_ANGLE_feature_control
784     bool featureControlANGLE = false;
785 
786     // EGL_ANGLE_platform_angle_device_type_swiftshader
787     bool platformANGLEDeviceTypeSwiftShader = false;
788 
789     // EGL_ANGLE_platform_angle_device_type_egl_angle
790     bool platformANGLEDeviceTypeEGLANGLE = false;
791 
792     // EGL_EXT_device_query
793     bool deviceQueryEXT = false;
794 
795     // EGL_ANGLE_display_power_preference
796     bool displayPowerPreferenceANGLE = false;
797 };
798 
799 }  // namespace egl
800 
801 #endif  // LIBANGLE_CAPS_H_
802