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/renderer/Format.h"
14 
15 #include <array>
16 #include <map>
17 #include <set>
18 #include <string>
19 #include <vector>
20 
21 namespace gl
22 {
23 
24 struct Extensions;
25 
26 struct TextureCaps
27 {
28     TextureCaps();
29     TextureCaps(const TextureCaps &other);
30     TextureCaps &operator=(const TextureCaps &other);
31 
32     ~TextureCaps();
33 
34     // Supports for basic texturing: glTexImage, glTexSubImage, etc
35     bool texturable = false;
36 
37     // Support for linear or anisotropic filtering
38     bool filterable = false;
39 
40     // Support for being used as a framebuffer attachment, i.e. glFramebufferTexture2D
41     bool textureAttachment = false;
42 
43     // Support for being used as a renderbuffer format, i.e. glFramebufferRenderbuffer
44     bool renderbuffer = false;
45 
46     // Support for blend modes while being used as a framebuffer attachment
47     bool blendable = false;
48 
49     // Set of supported sample counts, only guaranteed to be valid in ES3.
50     SupportedSampleSet sampleCounts;
51 
52     // Get the maximum number of samples supported
53     GLuint getMaxSamples() const;
54 
55     // Get the number of supported samples that is at least as many as requested.  Returns 0 if
56     // there are no sample counts available
57     GLuint getNearestSamples(GLuint requestedSamples) const;
58 };
59 
60 TextureCaps GenerateMinimumTextureCaps(GLenum internalFormat,
61                                        const Version &clientVersion,
62                                        const Extensions &extensions);
63 
64 class TextureCapsMap final : angle::NonCopyable
65 {
66   public:
67     TextureCapsMap();
68     ~TextureCapsMap();
69 
70     // These methods are deprecated. Please use angle::Format for new features.
71     void insert(GLenum internalFormat, const TextureCaps &caps);
72     const TextureCaps &get(GLenum internalFormat) const;
73 
74     void clear();
75 
76     // Prefer using angle::Format methods.
77     const TextureCaps &get(angle::FormatID formatID) const;
78     void set(angle::FormatID formatID, const TextureCaps &caps);
79 
80   private:
81     TextureCaps &get(angle::FormatID formatID);
82 
83     // Indexed by angle::FormatID
84     angle::FormatMap<TextureCaps> mFormatData;
85 };
86 
87 void InitMinimumTextureCapsMap(const Version &clientVersion,
88                                const Extensions &extensions,
89                                TextureCapsMap *capsMap);
90 
91 // Returns true if all the formats required to support GL_ANGLE_compressed_texture_etc are
92 // present. Does not determine if they are natively supported without decompression.
93 bool DetermineCompressedTextureETCSupport(const TextureCapsMap &textureCaps);
94 
95 struct Extensions
96 {
97     Extensions();
98     Extensions(const Extensions &other);
99 
100     Extensions &operator=(const Extensions &other);
101 
102     // Generate a vector of supported extension strings
103     std::vector<std::string> getStrings() const;
104 
105     // Set all texture related extension support based on the supported textures.
106     // Determines support for:
107     // GL_OES_packed_depth_stencil
108     // GL_OES_rgb8_rgba8
109     // GL_EXT_texture_format_BGRA8888
110     // GL_EXT_color_buffer_half_float,
111     // GL_OES_texture_half_float, GL_OES_texture_half_float_linear
112     // GL_OES_texture_float, GL_OES_texture_float_linear
113     // GL_EXT_texture_rg
114     // GL_EXT_texture_type_2_10_10_10_REV
115     // GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3,
116     // GL_ANGLE_texture_compression_dxt5
117     // GL_KHR_texture_compression_astc_ldr, GL_OES_texture_compression_astc.
118     //     NOTE: GL_KHR_texture_compression_astc_hdr must be enabled separately. Support for the
119     //           HDR profile cannot be determined from the format enums alone.
120     // GL_OES_compressed_ETC1_RGB8_texture
121     // GL_EXT_sRGB
122     // GL_ANGLE_depth_texture, GL_OES_depth32
123     // GL_EXT_color_buffer_float
124     // GL_EXT_texture_norm16
125     // GL_EXT_texture_compression_bptc
126     // GL_EXT_texture_compression_rgtc
127     void setTextureExtensionSupport(const TextureCapsMap &textureCaps);
128 
129     // indicate if any depth texture extension is available
depthTextureAnyExtensions130     bool depthTextureAny() const { return (depthTextureANGLE || depthTextureOES); }
131 
132     // ES2 Extension support
133 
134     // GL_OES_element_index_uint
135     bool elementIndexUintOES = false;
136 
137     // GL_OES_packed_depth_stencil
138     bool packedDepthStencilOES = false;
139 
140     // GL_NV_read_depth
141     bool readDepthNV = false;
142 
143     // GL_NV_read_stencil
144     bool readStencilNV = false;
145 
146     // GL_NV_depth_buffer_float2
147     bool depthBufferFloat2NV = false;
148 
149     // GL_OES_get_program_binary
150     bool getProgramBinaryOES = false;
151 
152     // GL_OES_rgb8_rgba8
153     // Implies that TextureCaps for GL_RGB8 and GL_RGBA8 exist
154     bool rgb8rgba8OES = false;
155 
156     // GL_EXT_texture_format_BGRA8888
157     // Implies that TextureCaps for GL_BGRA8 exist
158     bool textureFormatBGRA8888 = false;
159 
160     // GL_EXT_read_format_bgra
161     bool readFormatBGRA = false;
162 
163     // GL_NV_pixel_buffer_object
164     bool pixelBufferObjectNV = false;
165 
166     // GL_ARB_sync
167     bool glSyncARB = false;
168 
169     // GL_OES_mapbuffer and GL_EXT_map_buffer_range
170     bool mapBufferOES   = false;
171     bool mapBufferRange = false;
172 
173     // GL_EXT_color_buffer_half_float
174     // Together with GL_OES_texture_half_float in a GLES 2.0 context, implies that half-float
175     // textures are renderable.
176     bool colorBufferHalfFloat = false;
177 
178     // GL_OES_texture_half_float and GL_OES_texture_half_float_linear
179     // Implies that TextureCaps for GL_RGB16F, GL_RGBA16F, GL_ALPHA32F_EXT, GL_LUMINANCE32F_EXT and
180     // GL_LUMINANCE_ALPHA32F_EXT exist
181     bool textureHalfFloat       = false;
182     bool textureHalfFloatLinear = false;
183 
184     // GL_OES_texture_float and GL_OES_texture_float_linear
185     // Implies that TextureCaps for GL_RGB32F, GL_RGBA32F, GL_ALPHA16F_EXT, GL_LUMINANCE16F_EXT and
186     // GL_LUMINANCE_ALPHA16F_EXT exist
187     bool textureFloatOES       = false;
188     bool textureFloatLinearOES = false;
189 
190     // GL_EXT_texture_rg
191     // Implies that TextureCaps for GL_R8, GL_RG8 (and floating point R/RG texture formats if
192     // floating point extensions are also present) exist
193     bool textureRG = false;
194 
195     // GL_EXT_texture_type_2_10_10_10_REV
196     bool textureFormat2101010REV = false;
197 
198     // GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3 and
199     // GL_ANGLE_texture_compression_dxt5 Implies that TextureCaps exist for
200     // GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
201     // GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE and GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE
202     bool textureCompressionDXT1 = false;
203     bool textureCompressionDXT3 = false;
204     bool textureCompressionDXT5 = false;
205 
206     // GL_EXT_texture_compression_s3tc_srgb
207     // Implies that TextureCaps exist for GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
208     // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, and
209     // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
210     bool textureCompressionS3TCsRGB = false;
211 
212     // GL_KHR_texture_compression_astc_ldr
213     bool textureCompressionASTCLDRKHR = false;
214 
215     // GL_KHR_texture_compression_astc_hdr
216     bool textureCompressionASTCHDRKHR = false;
217 
218     // GL_OES_texture_compression_astc
219     bool textureCompressionASTCOES = false;
220 
221     // GL_KHR_texture_compression_astc_sliced_3d
222     bool textureCompressionSliced3dASTCKHR = false;
223 
224     // GL_EXT_texture_compression_bptc
225     bool textureCompressionBPTC = false;
226 
227     // GL_EXT_texture_compression_rgtc
228     bool textureCompressionRGTC = false;
229 
230     // GL_OES_compressed_ETC1_RGB8_texture
231     // Implies that TextureCaps for GL_ETC1_RGB8_OES exist
232     bool compressedETC1RGB8TextureOES = false;
233 
234     // GL_EXT_compressed_ETC1_RGB8_sub_texture
235     bool compressedETC1RGB8SubTexture = false;
236 
237     // OES_compressed_ETC2_RGB8_texture
238     bool compressedETC2RGB8TextureOES = false;
239 
240     // OES_compressed_ETC2_sRGB8_texture
241     bool compressedETC2sRGB8TextureOES = false;
242 
243     // OES_compressed_ETC2_punchthroughA_RGBA8_texture
244     bool compressedETC2PunchthroughARGB8TextureOES = false;
245 
246     // OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture
247     bool compressedETC2PunchthroughAsRGB8AlphaTextureOES = false;
248 
249     // OES_compressed_ETC2_RGBA8_texture
250     bool compressedETC2RGBA8TextureOES = false;
251 
252     // OES_compressed_ETC2_sRGB8_alpha8_texture
253     bool compressedETC2sRGB8Alpha8TextureOES = false;
254 
255     // OES_compressed_EAC_R11_unsigned_texture
256     bool compressedEACR11UnsignedTextureOES = false;
257 
258     // OES_compressed_EAC_R11_signed_texture
259     bool compressedEACR11SignedTextureOES = false;
260 
261     // OES_compressed_EAC_RG11_unsigned_texture
262     bool compressedEACRG11UnsignedTextureOES = false;
263 
264     // OES_compressed_EAC_RG11_signed_texture
265     bool compressedEACRG11SignedTextureOES = false;
266 
267     // ANGLE_compressed_texture_etc
268     // ONLY exposed if ETC texture formats are natively supported without decompression
269     // Backends should enable this extension explicitly. It is not enabled with
270     // setTextureExtensionSupport, use DetermineCompressedTextureETCSupport to check if all of the
271     // individual formats required to support this extension are available.
272     bool compressedTextureETC = false;
273 
274     // GL_IMG_texture_compression_pvrtc
275     bool compressedTexturePVRTC = false;
276 
277     // GL_EXT_pvrtc_sRGB
278     bool compressedTexturePVRTCsRGB = false;
279 
280     // GL_EXT_sRGB
281     // Implies that TextureCaps for GL_SRGB8_ALPHA8 and GL_SRGB8 exist
282     // TODO: Don't advertise this extension in ES3
283     bool sRGB = false;
284 
285     // GL_EXT_texture_sRGB_R8
286     bool sRGBR8EXT = false;
287 
288     // GL_EXT_texture_sRGB_RG8
289     bool sRGBRG8EXT = false;
290 
291     // GL_ANGLE_depth_texture
292     bool depthTextureANGLE = false;
293 
294     // OES_depth_texture
295     bool depthTextureOES = false;
296 
297     // GL_OES_depth_texture_cube_map
298     bool depthTextureCubeMapOES = false;
299 
300     // GL_OES_depth24
301     // Allows DEPTH_COMPONENT24_OES as a valid Renderbuffer format.
302     bool depth24OES = false;
303 
304     // GL_OES_depth32
305     // Allows DEPTH_COMPONENT32_OES as a valid Renderbuffer format.
306     bool depth32OES = false;
307 
308     // GL_OES_texture_3D
309     bool texture3DOES = false;
310 
311     // GL_EXT_texture_storage
312     bool textureStorage = false;
313 
314     // GL_OES_texture_npot
315     bool textureNPOTOES = false;
316 
317     // GL_EXT_draw_buffers
318     bool drawBuffers = false;
319 
320     // GL_EXT_draw_buffers_indexed
321     bool drawBuffersIndexedEXT = false;
322 
323     // GL_OES_draw_buffers_indexed
324     bool drawBuffersIndexedOES = false;
325 
326     // Any version of the draw_buffers_indexed
drawBuffersIndexedAnyExtensions327     bool drawBuffersIndexedAny() const { return (drawBuffersIndexedEXT || drawBuffersIndexedOES); }
328 
329     // GL_EXT_texture_filter_anisotropic
330     bool textureFilterAnisotropic = false;
331     GLfloat maxTextureAnisotropy  = 0.0f;
332 
333     // GL_EXT_occlusion_query_boolean
334     bool occlusionQueryBoolean = false;
335 
336     // GL_NV_fence
337     bool fenceNV = false;
338 
339     // GL_EXT_disjoint_timer_query
340     bool disjointTimerQuery            = false;
341     GLuint queryCounterBitsTimeElapsed = 0;
342     GLuint queryCounterBitsTimestamp   = 0;
343 
344     // GL_EXT_robustness
345     bool robustness = false;
346 
347     // GL_KHR_robust_buffer_access_behavior
348     bool robustBufferAccessBehavior = false;
349 
350     // GL_EXT_blend_minmax
351     bool blendMinMax = false;
352 
353     // GL_ANGLE_framebuffer_blit
354     bool framebufferBlitANGLE = false;
355     // GL_NV_framebuffer_blit
356     bool framebufferBlitNV = false;
357     // Any version of the framebuffer_blit extension
framebufferBlitAnyExtensions358     bool framebufferBlitAny() const { return (framebufferBlitANGLE || framebufferBlitNV); }
359 
360     // GL_ANGLE_framebuffer_multisample
361     bool framebufferMultisample = false;
362 
363     // GL_EXT_multisampled_render_to_texture
364     bool multisampledRenderToTexture = false;
365 
366     // GL_EXT_multisampled_render_to_texture2
367     bool multisampledRenderToTexture2 = false;
368 
369     // GL_ANGLE_instanced_arrays
370     bool instancedArraysANGLE = false;
371     // GL_EXT_instanced_arrays
372     bool instancedArraysEXT = false;
373     // Any version of the instanced arrays extension
instancedArraysAnyExtensions374     bool instancedArraysAny() const { return (instancedArraysANGLE || instancedArraysEXT); }
375 
376     // GL_ANGLE_pack_reverse_row_order
377     bool packReverseRowOrder = false;
378 
379     // GL_OES_standard_derivatives
380     bool standardDerivativesOES = false;
381 
382     // GL_EXT_shader_texture_lod
383     bool shaderTextureLOD = false;
384 
385     // GL_EXT_shader_framebuffer_fetch_non_coherent
386     bool shaderFramebufferFetchNonCoherentEXT = false;
387 
388     // GL_EXT_frag_depth
389     bool fragDepth = false;
390 
391     // OVR_multiview
392     bool multiview  = false;
393     GLuint maxViews = 1;
394 
395     // OVR_multiview2
396     bool multiview2 = false;
397 
398     // GL_ANGLE_texture_usage
399     bool textureUsage = false;
400 
401     // GL_ANGLE_translated_shader_source
402     bool translatedShaderSource = false;
403 
404     // GL_OES_fbo_render_mipmap
405     bool fboRenderMipmapOES = false;
406 
407     // GL_EXT_discard_framebuffer
408     bool discardFramebuffer = false;
409 
410     // EXT_debug_marker
411     bool debugMarker = false;
412 
413     // EXT_debug_label
414     bool debugLabel = false;
415 
416     // GL_OES_EGL_image
417     bool eglImageOES = false;
418 
419     // GL_OES_EGL_image_external
420     bool eglImageExternalOES = false;
421 
422     // GL_OES_EGL_image_external_essl3
423     bool eglImageExternalEssl3OES = false;
424 
425     // GL_EXT_EGL_image_external_wrap_modes
426     bool eglImageExternalWrapModesEXT = false;
427 
428     // GL_OES_EGL_sync
429     bool eglSyncOES = false;
430 
431     // GL_EXT_memory_object
432     bool memoryObject = false;
433 
434     // GL_EXT_memory_object_fd
435     bool memoryObjectFd = false;
436 
437     // GL_ANGLE_memory_object_flags
438     bool memoryObjectFlagsANGLE = false;
439 
440     // GL_ANGLE_memory_object_fuchsia
441     bool memoryObjectFuchsiaANGLE = false;
442 
443     // GL_EXT_semaphore
444     bool semaphore = false;
445 
446     // GL_EXT_semaphore_fd
447     bool semaphoreFd = false;
448 
449     // GL_ANGLE_semaphore_fuchsia
450     bool semaphoreFuchsiaANGLE = false;
451 
452     // NV_EGL_stream_consumer_external
453     bool eglStreamConsumerExternalNV = false;
454 
455     // EXT_unpack_subimage
456     bool unpackSubimage = false;
457 
458     // NV_pack_subimage
459     bool packSubimage = false;
460 
461     // GL_NV_shader_noperspective_interpolation
462     bool noperspectiveInterpolationNV = false;
463 
464     // GL_OES_vertex_half_float
465     bool vertexHalfFloatOES = false;
466 
467     // GL_OES_vertex_array_object
468     bool vertexArrayObjectOES = false;
469 
470     // GL_OES_vertex_type_10_10_10_2
471     bool vertexAttribType1010102OES = false;
472 
473     // GL_KHR_debug
474     bool debug                     = false;
475     GLuint maxDebugMessageLength   = 0;
476     GLuint maxDebugLoggedMessages  = 0;
477     GLuint maxDebugGroupStackDepth = 0;
478     GLuint maxLabelLength          = 0;
479 
480     // KHR_no_error
481     bool noError = false;
482 
483     // GL_ANGLE_lossy_etc_decode
484     bool lossyETCDecode = false;
485 
486     // GL_CHROMIUM_bind_uniform_location
487     bool bindUniformLocation = false;
488 
489     // GL_CHROMIUM_sync_query
490     bool syncQuery = false;
491 
492     // GL_CHROMIUM_copy_texture
493     bool copyTexture = false;
494 
495     // GL_CHROMIUM_copy_compressed_texture
496     bool copyCompressedTexture = false;
497 
498     // GL_ANGLE_copy_texture_3d
499     bool copyTexture3d = false;
500 
501     // GL_ANGLE_webgl_compatibility
502     bool webglCompatibility = false;
503 
504     // GL_ANGLE_request_extension
505     bool requestExtension = false;
506 
507     // GL_CHROMIUM_bind_generates_resource
508     bool bindGeneratesResource = false;
509 
510     // GL_ANGLE_robust_client_memory
511     bool robustClientMemory = false;
512 
513     // GL_OES_texture_border_clamp
514     bool textureBorderClampOES = false;
515 
516     // GL_EXT_texture_border_clamp
517     bool textureBorderClampEXT = false;
518 
519     // Any version of the texture border clamp extension
textureBorderClampAnyExtensions520     bool textureBorderClampAny() const { return (textureBorderClampOES || textureBorderClampEXT); }
521 
522     // GL_EXT_texture_sRGB_decode
523     bool textureSRGBDecode = false;
524 
525     // GL_EXT_texture_format_sRGB_override
526     bool textureSRGBOverride = false;
527 
528     // GL_EXT_sRGB_write_control
529     bool sRGBWriteControl = false;
530 
531     // GL_CHROMIUM_color_buffer_float_rgb
532     bool colorBufferFloatRGB = false;
533 
534     // GL_CHROMIUM_color_buffer_float_rgba
535     bool colorBufferFloatRGBA = false;
536 
537     // GL_EXT_EGL_image_array
538     bool eglImageArray = false;
539 
540     // ES3 Extension support
541 
542     // GL_EXT_color_buffer_float
543     bool colorBufferFloat = false;
544 
545     // GL_EXT_multisample_compatibility.
546     // written against ES 3.1 but can apply to earlier versions.
547     bool multisampleCompatibility = false;
548 
549     // GL_CHROMIUM_framebuffer_mixed_samples
550     bool framebufferMixedSamples = false;
551 
552     // GL_EXT_texture_norm16
553     // written against ES 3.1 but can apply to ES 3.0 as well.
554     bool textureNorm16 = false;
555 
556     // GL_OES_surfaceless_context
557     bool surfacelessContextOES = false;
558 
559     // GL_ANGLE_client_arrays
560     bool clientArrays = false;
561 
562     // GL_ANGLE_robust_resource_initialization
563     bool robustResourceInitialization = false;
564 
565     // GL_ANGLE_program_cache_control
566     bool programCacheControl = false;
567 
568     // GL_ANGLE_texture_rectangle
569     bool textureRectangle = false;
570 
571     // GL_EXT_geometry_shader
572     bool geometryShaderEXT = false;
573     // GL_OES_geometry_shader
574     bool geometryShaderOES = false;
575     // Any version of the geometry shader extension
geometryShaderAnyExtensions576     bool geometryShaderAny() const { return (geometryShaderEXT || geometryShaderOES); }
577 
578     // GLES1 emulation: GLES1 extensions
579     // GL_OES_point_size_array
580     bool pointSizeArrayOES = false;
581 
582     // GL_OES_texture_cube_map
583     bool textureCubeMapOES = false;
584 
585     // GL_OES_point_sprite
586     bool pointSpriteOES = false;
587 
588     // GL_OES_draw_texture
589     bool drawTextureOES = false;
590 
591     // GL_OES_framebuffer_object
592     bool framebufferObjectOES = false;
593 
594     // GL_KHR_parallel_shader_compile
595     bool parallelShaderCompile = false;
596 
597     // GL_EXT_separate_shader_objects
598     bool separateShaderObjects = false;
599 
600     // GL_OES_texture_storage_multisample_2d_array
601     bool textureStorageMultisample2DArrayOES = false;
602 
603     // GL_ANGLE_multiview_multisample
604     bool multiviewMultisample = false;
605 
606     // GL_KHR_blend_equation_advanced
607     bool blendEquationAdvancedKHR = false;
608 
609     // GL_EXT_blend_func_extended
610     bool blendFuncExtended          = false;
611     GLuint maxDualSourceDrawBuffers = 0;
612 
613     // GL_EXT_float_blend
614     bool floatBlend = false;
615 
616     // GL_ANGLE_memory_size
617     bool memorySize = false;
618 
619     // GL_ANGLE_texture_multisample
620     bool textureMultisample = false;
621 
622     // GL_ANGLE_multi_draw
623     bool multiDraw = false;
624 
625     // GL_ANGLE_provoking_vertex
626     bool provokingVertex = false;
627 
628     // GL_CHROMIUM_texture_filtering_hint
629     bool textureFilteringCHROMIUM = false;
630 
631     // GL_CHROMIUM_lose_context
632     bool loseContextCHROMIUM = false;
633 
634     // GL_ANGLE_texture_external_update
635     bool textureExternalUpdateANGLE = false;
636 
637     // GL_ANGLE_base_vertex_base_instance
638     bool baseVertexBaseInstance = false;
639 
640     // GL_ANGLE_get_image
641     bool getImageANGLE = false;
642 
643     // GL_OES_draw_elements_base_vertex
644     bool drawElementsBaseVertexOES = false;
645     // GL_EXT_draw_elements_base_vertex
646     bool drawElementsBaseVertexEXT = false;
647     // Any version of the base vertex extension
drawElementsBaseVertexAnyExtensions648     bool drawElementsBaseVertexAny() const
649     {
650         return (drawElementsBaseVertexOES || drawElementsBaseVertexEXT);
651     }
652 
653     // GL_EXT_shader_non_constant_global_initializers
654     bool shaderNonConstGlobalInitializersEXT = false;
655 
656     // GL_OES_shader_io_blocks
657     bool shaderIoBlocksOES = false;
658     // GL_EXT_shader_io_blocks
659     bool shaderIoBlocksEXT = false;
660     // Any version of shader io block extension
shaderIoBlocksAnyExtensions661     bool shaderIoBlocksAny() const { return (shaderIoBlocksOES || shaderIoBlocksEXT); }
662 
663     // GL_EXT_gpu_shader5
664     bool gpuShader5EXT = false;
665     // WEBGL_video_texture
666     bool webglVideoTexture = false;
667 
668     // GL_APPLE_clip_distance
669     bool clipDistanceAPPLE = false;
670 
671     // GL_EXT_clip_control
672     bool clipControlEXT = false;
673 
674     // GL_OES_texture_cube_map_array
675     bool textureCubeMapArrayOES = false;
676     // GL_EXT_texture_cube_map_array
677     bool textureCubeMapArrayEXT = false;
678     // Any version of the texture cube map array extension
textureCubeMapArrayAnyExtensions679     bool textureCubeMapArrayAny() const
680     {
681         return (textureCubeMapArrayOES || textureCubeMapArrayEXT);
682     }
683 
684     // GL_EXT_shadow_samplers
685     bool shadowSamplersEXT = false;
686 
687     // GL_EXT_buffer_storage
688     bool bufferStorageEXT = false;
689 
690     // GL_EXT_external_buffer
691     bool externalBufferEXT = false;
692 
693     // GL_OES_texture_stencil8
694     bool stencilIndex8 = false;
695 
696     // GL_OES_sample_shading
697     bool sampleShadingOES = false;
698 
699     // OES_shader_multisample_interpolation
700     bool multisampleInterpolationOES = false;
701 
702     // GL_OES_shader_image_atomic
703     bool shaderImageAtomicOES = false;
704 
705     // GL_OES_sample_variables
706     bool sampleVariablesOES = false;
707 
708     // GL_NV_robustness_video_memory_purge
709     bool robustnessVideoMemoryPurgeNV = false;
710 
711     // GL_ANGLE_get_tex_level_parameter
712     bool getTexLevelParameterANGLE = false;
713 
714     // GL_EXT_tessellation_shader
715     bool tessellationShaderEXT = false;
716 
717     // GL_EXT_copy_image
718     bool copyImageEXT = false;
719 
720     // GL_OES_texture_buffer
721     bool textureBufferOES = false;
722     // GL_EXT_texture_buffer
723     bool textureBufferEXT = false;
724     // Any version of the texture buffer extension
textureBufferAnyExtensions725     bool textureBufferAny() const { return (textureBufferOES || textureBufferEXT); }
726 
727     // GL_EXT_YUV_target
728     bool yuvTargetEXT = false;
729 
730     // GL_EXT_clip_cull_distance
731     bool clipCullDistanceEXT = false;
732 
733     // GL_ANGLE_get_serialized_context_string
734     bool getSerializedContextStringANGLE = false;
735 
736     // GL_EXT_primitive_bounding_box
737     bool primitiveBoundingBoxEXT = false;
738 
739     // GL_ANGLE_relaxed_vertex_attribute_type
740     bool relaxedVertexAttributeTypeANGLE = false;
741 
742     // GL_ANGLE_yuv_internal_format
743     bool yuvInternalFormatANGLE = false;
744 };
745 
746 // Pointer to a boolean memeber of the Extensions struct
747 using ExtensionBool = bool Extensions::*;
748 
749 struct ExtensionInfo
750 {
751     // If this extension can be enabled or disabled  with glRequestExtension
752     // (GL_ANGLE_request_extension)
753     bool Requestable = false;
754     bool Disablable  = false;
755 
756     // Pointer to a boolean member of the Extensions struct
757     ExtensionBool ExtensionsMember = nullptr;
758 };
759 
760 using ExtensionInfoMap = std::map<std::string, ExtensionInfo>;
761 const ExtensionInfoMap &GetExtensionInfoMap();
762 
763 struct Limitations
764 {
765     Limitations();
766     Limitations(const Limitations &other);
767 
768     Limitations &operator=(const Limitations &other);
769 
770     // Renderer doesn't support gl_FrontFacing in fragment shaders
771     bool noFrontFacingSupport = false;
772 
773     // Renderer doesn't support GL_SAMPLE_ALPHA_TO_COVERAGE
774     bool noSampleAlphaToCoverageSupport = false;
775 
776     // In glVertexAttribDivisorANGLE, attribute zero must have a zero divisor
777     bool attributeZeroRequiresZeroDivisorInEXT = false;
778 
779     // Unable to support different values for front and back faces for stencil refs and masks
780     bool noSeparateStencilRefsAndMasks = false;
781 
782     // Renderer doesn't support non-constant indexing loops in fragment shader
783     bool shadersRequireIndexedLoopValidation = false;
784 
785     // Renderer doesn't support Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA
786     // and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR blend functions.
787     bool noSimultaneousConstantColorAndAlphaBlendFunc = false;
788 
789     // D3D9 does not support flexible varying register packing.
790     bool noFlexibleVaryingPacking = false;
791 
792     // D3D does not support having multiple transform feedback outputs go to the same buffer.
793     bool noDoubleBoundTransformFeedbackBuffers = false;
794 
795     // D3D does not support vertex attribute aliasing
796     bool noVertexAttributeAliasing = false;
797 
798     // Renderer doesn't support GL_TEXTURE_COMPARE_MODE=GL_NONE on a shadow sampler.
799     // TODO(http://anglebug.com/5231): add validation code to front-end.
800     bool noShadowSamplerCompareModeNone = false;
801 
802     // PVRTC1 textures must be squares.
803     bool squarePvrtc1 = false;
804 
805     // ETC1 texture support is emulated.
806     bool emulatedEtc1 = false;
807 };
808 
809 struct TypePrecision
810 {
811     TypePrecision();
812     TypePrecision(const TypePrecision &other);
813 
814     TypePrecision &operator=(const TypePrecision &other);
815 
816     void setIEEEFloat();
817     void setTwosComplementInt(unsigned int bits);
818     void setSimulatedFloat(unsigned int range, unsigned int precision);
819     void setSimulatedInt(unsigned int range);
820 
821     void get(GLint *returnRange, GLint *returnPrecision) const;
822 
823     std::array<GLint, 2> range = {0, 0};
824     GLint precision            = 0;
825 };
826 
827 struct Caps
828 {
829     Caps();
830     Caps(const Caps &other);
831     Caps &operator=(const Caps &other);
832 
833     ~Caps();
834 
835     // If the values could be got by using GetIntegeri_v, they should
836     // be GLint instead of GLuint and call LimitToInt() to ensure
837     // they will not overflow.
838 
839     GLfloat minInterpolationOffset        = 0;
840     GLfloat maxInterpolationOffset        = 0;
841     GLint subPixelInterpolationOffsetBits = 0;
842 
843     // ES 3.1 (April 29, 2015) 20.39: implementation dependent values
844     GLint64 maxElementIndex       = 0;
845     GLint max3DTextureSize        = 0;
846     GLint max2DTextureSize        = 0;
847     GLint maxRectangleTextureSize = 0;
848     GLint maxArrayTextureLayers   = 0;
849     GLfloat maxLODBias            = 0.0f;
850     GLint maxCubeMapTextureSize   = 0;
851     GLint maxRenderbufferSize     = 0;
852     GLfloat minAliasedPointSize   = 1.0f;
853     GLfloat maxAliasedPointSize   = 1.0f;
854     GLfloat minAliasedLineWidth   = 0.0f;
855     GLfloat maxAliasedLineWidth   = 0.0f;
856 
857     // ES 3.1 (April 29, 2015) 20.40: implementation dependent values (cont.)
858     GLint maxDrawBuffers         = 0;
859     GLint maxFramebufferWidth    = 0;
860     GLint maxFramebufferHeight   = 0;
861     GLint maxFramebufferSamples  = 0;
862     GLint maxColorAttachments    = 0;
863     GLint maxViewportWidth       = 0;
864     GLint maxViewportHeight      = 0;
865     GLint maxSampleMaskWords     = 0;
866     GLint maxColorTextureSamples = 0;
867     GLint maxDepthTextureSamples = 0;
868     GLint maxIntegerSamples      = 0;
869     GLint64 maxServerWaitTimeout = 0;
870 
871     // ES 3.1 (April 29, 2015) Table 20.41: Implementation dependent values (cont.)
872     GLint maxVertexAttribRelativeOffset = 0;
873     GLint maxVertexAttribBindings       = 0;
874     GLint maxVertexAttribStride         = 0;
875     GLint maxElementsIndices            = 0;
876     GLint maxElementsVertices           = 0;
877     std::vector<GLenum> compressedTextureFormats;
878     std::vector<GLenum> programBinaryFormats;
879     std::vector<GLenum> shaderBinaryFormats;
880     TypePrecision vertexHighpFloat;
881     TypePrecision vertexMediumpFloat;
882     TypePrecision vertexLowpFloat;
883     TypePrecision vertexHighpInt;
884     TypePrecision vertexMediumpInt;
885     TypePrecision vertexLowpInt;
886     TypePrecision fragmentHighpFloat;
887     TypePrecision fragmentMediumpFloat;
888     TypePrecision fragmentLowpFloat;
889     TypePrecision fragmentHighpInt;
890     TypePrecision fragmentMediumpInt;
891     TypePrecision fragmentLowpInt;
892 
893     // Implementation dependent limits required on all shader types.
894     // TODO(jiawei.shao@intel.com): organize all such limits into ShaderMap.
895     // ES 3.1 (April 29, 2015) Table 20.43: Implementation dependent Vertex shader limits
896     // ES 3.1 (April 29, 2015) Table 20.44: Implementation dependent Fragment shader limits
897     // ES 3.1 (April 29, 2015) Table 20.45: implementation dependent compute shader limits
898     // GL_EXT_geometry_shader (May 31, 2016) Table 20.43gs: Implementation dependent geometry shader
899     // limits
900     // GL_EXT_geometry_shader (May 31, 2016) Table 20.46: Implementation dependent aggregate shader
901     // limits
902     ShaderMap<GLint> maxShaderUniformBlocks        = {};
903     ShaderMap<GLint> maxShaderTextureImageUnits    = {};
904     ShaderMap<GLint> maxShaderStorageBlocks        = {};
905     ShaderMap<GLint> maxShaderUniformComponents    = {};
906     ShaderMap<GLint> maxShaderAtomicCounterBuffers = {};
907     ShaderMap<GLint> maxShaderAtomicCounters       = {};
908     ShaderMap<GLint> maxShaderImageUniforms        = {};
909     // Note that we can query MAX_COMPUTE_UNIFORM_COMPONENTS and MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT
910     // by GetIntegerv, but we can only use GetInteger64v on MAX_VERTEX_UNIFORM_COMPONENTS and
911     // MAX_FRAGMENT_UNIFORM_COMPONENTS. Currently we use GLuint64 to store all these values so that
912     // we can put them together into one ShaderMap.
913     ShaderMap<GLint64> maxCombinedShaderUniformComponents = {};
914 
915     // ES 3.1 (April 29, 2015) Table 20.43: Implementation dependent Vertex shader limits
916     GLint maxVertexAttributes       = 0;
917     GLint maxVertexUniformVectors   = 0;
918     GLint maxVertexOutputComponents = 0;
919 
920     // ES 3.1 (April 29, 2015) Table 20.44: Implementation dependent Fragment shader limits
921     GLint maxFragmentUniformVectors     = 0;
922     GLint maxFragmentInputComponents    = 0;
923     GLint minProgramTextureGatherOffset = 0;
924     GLint maxProgramTextureGatherOffset = 0;
925     GLint minProgramTexelOffset         = 0;
926     GLint maxProgramTexelOffset         = 0;
927 
928     // ES 3.1 (April 29, 2015) Table 20.45: implementation dependent compute shader limits
929     std::array<GLint, 3> maxComputeWorkGroupCount = {0, 0, 0};
930     std::array<GLint, 3> maxComputeWorkGroupSize  = {0, 0, 0};
931     GLint maxComputeWorkGroupInvocations          = 0;
932     GLint maxComputeSharedMemorySize              = 0;
933 
934     // ES 3.1 (April 29, 2015) Table 20.46: implementation dependent aggregate shader limits
935     GLint maxUniformBufferBindings         = 0;
936     GLint64 maxUniformBlockSize            = 0;
937     GLint uniformBufferOffsetAlignment     = 0;
938     GLint maxCombinedUniformBlocks         = 0;
939     GLint maxVaryingComponents             = 0;
940     GLint maxVaryingVectors                = 0;
941     GLint maxCombinedTextureImageUnits     = 0;
942     GLint maxCombinedShaderOutputResources = 0;
943 
944     // ES 3.1 (April 29, 2015) Table 20.47: implementation dependent aggregate shader limits (cont.)
945     GLint maxUniformLocations                = 0;
946     GLint maxAtomicCounterBufferBindings     = 0;
947     GLint maxAtomicCounterBufferSize         = 0;
948     GLint maxCombinedAtomicCounterBuffers    = 0;
949     GLint maxCombinedAtomicCounters          = 0;
950     GLint maxImageUnits                      = 0;
951     GLint maxCombinedImageUniforms           = 0;
952     GLint maxShaderStorageBufferBindings     = 0;
953     GLint64 maxShaderStorageBlockSize        = 0;
954     GLint maxCombinedShaderStorageBlocks     = 0;
955     GLint shaderStorageBufferOffsetAlignment = 0;
956 
957     // ES 3.1 (April 29, 2015) Table 20.48: implementation dependent transform feedback limits
958     GLint maxTransformFeedbackInterleavedComponents = 0;
959     GLint maxTransformFeedbackSeparateAttributes    = 0;
960     GLint maxTransformFeedbackSeparateComponents    = 0;
961 
962     // ES 3.1 (April 29, 2015) Table 20.49: Framebuffer Dependent Values
963     GLint maxSamples = 0;
964 
965     // GL_EXT_geometry_shader (May 31, 2016) Table 20.40: Implementation-Dependent Values (cont.)
966     GLint maxFramebufferLayers = 0;
967     GLint layerProvokingVertex = 0;
968 
969     // GL_EXT_geometry_shader (May 31, 2016) Table 20.43gs: Implementation dependent geometry shader
970     // limits
971     GLint maxGeometryInputComponents       = 0;
972     GLint maxGeometryOutputComponents      = 0;
973     GLint maxGeometryOutputVertices        = 0;
974     GLint maxGeometryTotalOutputComponents = 0;
975     GLint maxGeometryShaderInvocations     = 0;
976 
977     // GL_EXT_tessellation_shader
978     GLint maxTessControlInputComponents       = 0;
979     GLint maxTessControlOutputComponents      = 0;
980     GLint maxTessControlTotalOutputComponents = 0;
981 
982     GLint maxTessPatchComponents = 0;
983     GLint maxPatchVertices       = 0;
984     GLint maxTessGenLevel        = 0;
985 
986     GLint maxTessEvaluationInputComponents  = 0;
987     GLint maxTessEvaluationOutputComponents = 0;
988 
989     GLuint subPixelBits = 4;
990 
991     // GL_APPLE_clip_distance/GL_EXT_clip_cull_distance
992     GLuint maxClipDistances                = 0;
993     GLuint maxCullDistances                = 0;
994     GLuint maxCombinedClipAndCullDistances = 0;
995 
996     // GLES1 emulation: Caps for ES 1.1. Taken from Table 6.20 / 6.22 in the OpenGL ES 1.1 spec.
997     GLuint maxMultitextureUnits                 = 0;
998     GLuint maxClipPlanes                        = 0;
999     GLuint maxLights                            = 0;
1000     static constexpr int GlobalMatrixStackDepth = 16;
1001     GLuint maxModelviewMatrixStackDepth         = 0;
1002     GLuint maxProjectionMatrixStackDepth        = 0;
1003     GLuint maxTextureMatrixStackDepth           = 0;
1004     GLfloat minSmoothPointSize                  = 0.0f;
1005     GLfloat maxSmoothPointSize                  = 0.0f;
1006     GLfloat minSmoothLineWidth                  = 0.0f;
1007     GLfloat maxSmoothLineWidth                  = 0.0f;
1008 
1009     // ES 3.2 Table 20.41: Implementation Dependent Values (cont.)
1010     GLint maxTextureBufferSize         = 0;
1011     GLint textureBufferOffsetAlignment = 0;
1012 
1013     // Direct-to-metal constants:
1014     GLuint driverUniformsBindingIndex    = 0;
1015     GLuint defaultUniformsBindingIndex   = 0;
1016     GLuint UBOArgumentBufferBindingIndex = 0;
1017 };
1018 
1019 Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensions);
1020 }  // namespace gl
1021 
1022 namespace egl
1023 {
1024 
1025 struct Caps
1026 {
1027     Caps();
1028 
1029     // Support for NPOT surfaces
1030     bool textureNPOT;
1031 
1032     // Support for Stencil8 configs
1033     bool stencil8;
1034 };
1035 
1036 struct DisplayExtensions
1037 {
1038     DisplayExtensions();
1039 
1040     // Generate a vector of supported extension strings
1041     std::vector<std::string> getStrings() const;
1042 
1043     // EGL_EXT_create_context_robustness
1044     bool createContextRobustness = false;
1045 
1046     // EGL_ANGLE_d3d_share_handle_client_buffer
1047     bool d3dShareHandleClientBuffer = false;
1048 
1049     // EGL_ANGLE_d3d_texture_client_buffer
1050     bool d3dTextureClientBuffer = false;
1051 
1052     // EGL_ANGLE_surface_d3d_texture_2d_share_handle
1053     bool surfaceD3DTexture2DShareHandle = false;
1054 
1055     // EGL_ANGLE_query_surface_pointer
1056     bool querySurfacePointer = false;
1057 
1058     // EGL_ANGLE_window_fixed_size
1059     bool windowFixedSize = false;
1060 
1061     // EGL_ANGLE_keyed_mutex
1062     bool keyedMutex = false;
1063 
1064     // EGL_ANGLE_surface_orientation
1065     bool surfaceOrientation = false;
1066 
1067     // EGL_NV_post_sub_buffer
1068     bool postSubBuffer = false;
1069 
1070     // EGL_KHR_create_context
1071     bool createContext = false;
1072 
1073     // EGL_KHR_image
1074     bool image = false;
1075 
1076     // EGL_KHR_image_base
1077     bool imageBase = false;
1078 
1079     // EGL_KHR_image_pixmap
1080     bool imagePixmap = false;
1081 
1082     // EGL_KHR_gl_texture_2D_image
1083     bool glTexture2DImage = false;
1084 
1085     // EGL_KHR_gl_texture_cubemap_image
1086     bool glTextureCubemapImage = false;
1087 
1088     // EGL_KHR_gl_texture_3D_image
1089     bool glTexture3DImage = false;
1090 
1091     // EGL_KHR_gl_renderbuffer_image
1092     bool glRenderbufferImage = false;
1093 
1094     // EGL_KHR_get_all_proc_addresses
1095     bool getAllProcAddresses = false;
1096 
1097     // EGL_ANGLE_flexible_surface_compatibility
1098     bool flexibleSurfaceCompatibility = false;
1099 
1100     // EGL_ANGLE_direct_composition
1101     bool directComposition = false;
1102 
1103     // EGL_ANGLE_windows_ui_composition
1104     bool windowsUIComposition = false;
1105 
1106     // KHR_create_context_no_error
1107     bool createContextNoError = false;
1108 
1109     // EGL_KHR_stream
1110     bool stream = false;
1111 
1112     // EGL_KHR_stream_consumer_gltexture
1113     bool streamConsumerGLTexture = false;
1114 
1115     // EGL_NV_stream_consumer_gltexture_yuv
1116     bool streamConsumerGLTextureYUV = false;
1117 
1118     // EGL_ANGLE_stream_producer_d3d_texture
1119     bool streamProducerD3DTexture = false;
1120 
1121     // EGL_KHR_fence_sync
1122     bool fenceSync = false;
1123 
1124     // EGL_KHR_wait_sync
1125     bool waitSync = false;
1126 
1127     // EGL_ANGLE_create_context_webgl_compatibility
1128     bool createContextWebGLCompatibility = false;
1129 
1130     // EGL_CHROMIUM_create_context_bind_generates_resource
1131     bool createContextBindGeneratesResource = false;
1132 
1133     // EGL_CHROMIUM_sync_control
1134     bool syncControlCHROMIUM = false;
1135 
1136     // EGL_ANGLE_sync_control_rate
1137     bool syncControlRateANGLE = false;
1138 
1139     // EGL_KHR_swap_buffers_with_damage
1140     bool swapBuffersWithDamage = false;
1141 
1142     // EGL_EXT_pixel_format_float
1143     bool pixelFormatFloat = false;
1144 
1145     // EGL_KHR_surfaceless_context
1146     bool surfacelessContext = false;
1147 
1148     // EGL_ANGLE_display_texture_share_group
1149     bool displayTextureShareGroup = false;
1150 
1151     // EGL_ANGLE_display_semaphore_share_group
1152     bool displaySemaphoreShareGroup = false;
1153 
1154     // EGL_ANGLE_create_context_client_arrays
1155     bool createContextClientArrays = false;
1156 
1157     // EGL_ANGLE_program_cache_control
1158     bool programCacheControl = false;
1159 
1160     // EGL_ANGLE_robust_resource_initialization
1161     bool robustResourceInitialization = false;
1162 
1163     // EGL_ANGLE_iosurface_client_buffer
1164     bool iosurfaceClientBuffer = false;
1165 
1166     // EGL_ANGLE_metal_texture_client_buffer
1167     bool mtlTextureClientBuffer = false;
1168 
1169     // EGL_ANGLE_create_context_extensions_enabled
1170     bool createContextExtensionsEnabled = false;
1171 
1172     // EGL_ANDROID_presentation_time
1173     bool presentationTime = false;
1174 
1175     // EGL_ANDROID_blob_cache
1176     bool blobCache = false;
1177 
1178     // EGL_ANDROID_image_native_buffer
1179     bool imageNativeBuffer = false;
1180 
1181     // EGL_ANDROID_get_frame_timestamps
1182     bool getFrameTimestamps = false;
1183 
1184     // EGL_ANDROID_recordable
1185     bool recordable = false;
1186 
1187     // EGL_ANGLE_power_preference
1188     bool powerPreference = false;
1189 
1190     // EGL_ANGLE_image_d3d11_texture
1191     bool imageD3D11Texture = false;
1192 
1193     // EGL_ANDROID_get_native_client_buffer
1194     bool getNativeClientBufferANDROID = false;
1195 
1196     // EGL_ANDROID_create_native_client_buffer
1197     bool createNativeClientBufferANDROID = false;
1198 
1199     // EGL_ANDROID_native_fence_sync
1200     bool nativeFenceSyncANDROID = false;
1201 
1202     // EGL_ANGLE_create_context_backwards_compatible
1203     bool createContextBackwardsCompatible = false;
1204 
1205     // EGL_KHR_no_config_context
1206     bool noConfigContext = false;
1207 
1208     // EGL_IMG_context_priority
1209     bool contextPriority = false;
1210 
1211     // EGL_ANGLE_ggp_stream_descriptor
1212     bool ggpStreamDescriptor = false;
1213 
1214     // EGL_ANGLE_swap_with_frame_token
1215     bool swapWithFrameToken = false;
1216 
1217     // EGL_KHR_gl_colorspace
1218     bool glColorspace = false;
1219 
1220     // EGL_EXT_gl_colorspace_display_p3_linear
1221     bool glColorspaceDisplayP3Linear = false;
1222 
1223     // EGL_EXT_gl_colorspace_display_p3
1224     bool glColorspaceDisplayP3 = false;
1225 
1226     // EGL_EXT_gl_colorspace_scrgb
1227     bool glColorspaceScrgb = false;
1228 
1229     // EGL_EXT_gl_colorspace_scrgb_linear
1230     bool glColorspaceScrgbLinear = false;
1231 
1232     // EGL_EXT_gl_colorspace_display_p3_passthrough
1233     bool glColorspaceDisplayP3Passthrough = false;
1234 
1235     // EGL_ANDROID_framebuffer_target
1236     bool framebufferTargetANDROID = false;
1237 
1238     // EGL_EXT_image_gl_colorspace
1239     bool imageGlColorspace = false;
1240 
1241     // EGL_EXT_image_dma_buf_import
1242     bool imageDmaBufImportEXT = false;
1243 
1244     // EGL_EXT_image_dma_buf_import_modifiers
1245     bool imageDmaBufImportModifiersEXT = false;
1246 
1247     // EGL_NOK_texture_from_pixmap
1248     bool textureFromPixmapNOK = false;
1249 
1250     // EGL_NV_robustness_video_memory_purge
1251     bool robustnessVideoMemoryPurgeNV = false;
1252 
1253     // EGL_KHR_reusable_sync
1254     bool reusableSyncKHR = false;
1255 
1256     // EGL_ANGLE_external_context_and_surface
1257     bool externalContextAndSurface = false;
1258 
1259     // EGL_EXT_buffer_age
1260     bool bufferAgeEXT = false;
1261 
1262     // EGL_KHR_mutable_render_buffer
1263     bool mutableRenderBufferKHR = false;
1264 
1265     // EGL_EXT_protected_content
1266     bool protectedContentEXT = false;
1267 };
1268 
1269 struct DeviceExtensions
1270 {
1271     DeviceExtensions();
1272 
1273     // Generate a vector of supported extension strings
1274     std::vector<std::string> getStrings() const;
1275 
1276     // EGL_ANGLE_device_d3d
1277     bool deviceD3D = false;
1278 
1279     // EGL_ANGLE_device_cgl
1280     bool deviceCGL = false;
1281 
1282     // EGL_ANGLE_device_eagl
1283     bool deviceEAGL = false;
1284 
1285     // EGL_ANGLE_device_metal
1286     bool deviceMetal = false;
1287 };
1288 
1289 struct ClientExtensions
1290 {
1291     ClientExtensions();
1292     ClientExtensions(const ClientExtensions &other);
1293 
1294     // Generate a vector of supported extension strings
1295     std::vector<std::string> getStrings() const;
1296 
1297     // EGL_EXT_client_extensions
1298     bool clientExtensions = false;
1299 
1300     // EGL_EXT_platform_base
1301     bool platformBase = false;
1302 
1303     // EGL_EXT_platform_device
1304     bool platformDevice = false;
1305 
1306     // EGL_ANGLE_platform_angle
1307     bool platformANGLE = false;
1308 
1309     // EGL_ANGLE_platform_angle_d3d
1310     bool platformANGLED3D = false;
1311 
1312     // EGL_ANGLE_platform_angle_d3d11on12
1313     bool platformANGLED3D11ON12 = false;
1314 
1315     // EGL_ANGLE_platform_angle_opengl
1316     bool platformANGLEOpenGL = false;
1317 
1318     // EGL_ANGLE_platform_angle_null
1319     bool platformANGLENULL = false;
1320 
1321     // EGL_ANGLE_platform_angle_vulkan
1322     bool platformANGLEVulkan = false;
1323 
1324     // EGL_ANGLE_platform_angle_metal
1325     bool platformANGLEMetal = false;
1326 
1327     // EGL_ANGLE_platform_angle_context_virtualization
1328     bool platformANGLEContextVirtualization = false;
1329 
1330     // EGL_ANGLE_platform_angle_device_context_volatile_eagl
1331     bool platformANGLEDeviceContextVolatileEagl = false;
1332 
1333     // EGL_ANGLE_platform_angle_device_context_volatile_cgl
1334     bool platformANGLEDeviceContextVolatileCgl = false;
1335 
1336     // EGL_ANGLE_device_creation
1337     bool deviceCreation = false;
1338 
1339     // EGL_ANGLE_device_creation_d3d11
1340     bool deviceCreationD3D11 = false;
1341 
1342     // EGL_ANGLE_x11_visual
1343     bool x11Visual = false;
1344 
1345     // EGL_ANGLE_experimental_present_path
1346     bool experimentalPresentPath = false;
1347 
1348     // EGL_KHR_client_get_all_proc_addresses
1349     bool clientGetAllProcAddresses = false;
1350 
1351     // EGL_KHR_debug
1352     bool debug = false;
1353 
1354     // EGL_ANGLE_feature_control
1355     bool featureControlANGLE = false;
1356 
1357     // EGL_ANGLE_platform_angle_device_type_swiftshader
1358     bool platformANGLEDeviceTypeSwiftShader = false;
1359 
1360     // EGL_ANGLE_platform_angle_device_type_egl_angle
1361     bool platformANGLEDeviceTypeEGLANGLE = false;
1362 
1363     // EGL_EXT_device_query
1364     bool deviceQueryEXT = false;
1365 };
1366 
1367 }  // namespace egl
1368 
1369 #endif  // LIBANGLE_CAPS_H_
1370