1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
|
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef LIBANGLE_CAPS_H_
#define LIBANGLE_CAPS_H_
#include "angle_gl.h"
#include "libANGLE/angletypes.h"
#include <map>
#include <set>
#include <string>
#include <vector>
#include <array>
namespace gl
{
typedef std::set<GLuint> SupportedSampleSet;
struct TextureCaps
{
TextureCaps();
// Supports for basic texturing: glTexImage, glTexSubImage, etc
bool texturable;
// Support for linear or anisotropic filtering
bool filterable;
// Support for being used as a framebuffer attachment or renderbuffer format
bool renderable;
// Set of supported sample counts, only guaranteed to be valid in ES3.
SupportedSampleSet sampleCounts;
// Get the maximum number of samples supported
GLuint getMaxSamples() const;
// Get the number of supported samples that is at least as many as requested. Returns 0 if
// there are no sample counts available
GLuint getNearestSamples(GLuint requestedSamples) const;
};
class TextureCapsMap
{
public:
typedef std::map<GLenum, TextureCaps>::const_iterator const_iterator;
void insert(GLenum internalFormat, const TextureCaps &caps);
void remove(GLenum internalFormat);
const TextureCaps &get(GLenum internalFormat) const;
const_iterator begin() const;
const_iterator end() const;
size_t size() const;
private:
typedef std::map<GLenum, TextureCaps> InternalFormatToCapsMap;
InternalFormatToCapsMap mCapsMap;
};
struct Extensions
{
Extensions();
// Generate a vector of supported extension strings
std::vector<std::string> getStrings() const;
// Set all texture related extension support based on the supported textures.
// Determines support for:
// GL_OES_packed_depth_stencil
// GL_OES_rgb8_rgba8
// GL_EXT_texture_format_BGRA8888
// GL_EXT_color_buffer_half_float,
// GL_OES_texture_half_float, GL_OES_texture_half_float_linear
// GL_OES_texture_float, GL_OES_texture_float_linear
// GL_EXT_texture_rg
// GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3,
// GL_ANGLE_texture_compression_dxt5
// GL_KHR_texture_compression_astc_hdr, GL_KHR_texture_compression_astc_ldr
// GL_OES_compressed_ETC1_RGB8_texture
// GL_EXT_sRGB
// GL_ANGLE_depth_texture, GL_OES_depth32
// GL_EXT_color_buffer_float
// GL_EXT_texture_norm16
void setTextureExtensionSupport(const TextureCapsMap &textureCaps);
// ES2 Extension support
// GL_OES_element_index_uint
bool elementIndexUint;
// GL_OES_packed_depth_stencil
bool packedDepthStencil;
// GL_OES_get_program_binary
bool getProgramBinary;
// GL_OES_rgb8_rgba8
// Implies that TextureCaps for GL_RGB8 and GL_RGBA8 exist
bool rgb8rgba8;
// GL_EXT_texture_format_BGRA8888
// Implies that TextureCaps for GL_BGRA8 exist
bool textureFormatBGRA8888;
// GL_EXT_read_format_bgra
bool readFormatBGRA;
// GL_NV_pixel_buffer_object
bool pixelBufferObject;
// GL_OES_mapbuffer and GL_EXT_map_buffer_range
bool mapBuffer;
bool mapBufferRange;
// GL_EXT_color_buffer_half_float
// Together with GL_OES_texture_half_float in a GLES 2.0 context, implies that half-float
// textures are renderable.
bool colorBufferHalfFloat;
// GL_OES_texture_half_float and GL_OES_texture_half_float_linear
// Implies that TextureCaps for GL_RGB16F, GL_RGBA16F, GL_ALPHA32F_EXT, GL_LUMINANCE32F_EXT and
// GL_LUMINANCE_ALPHA32F_EXT exist
bool textureHalfFloat;
bool textureHalfFloatLinear;
// GL_OES_texture_float and GL_OES_texture_float_linear
// Implies that TextureCaps for GL_RGB32F, GL_RGBA32F, GL_ALPHA16F_EXT, GL_LUMINANCE16F_EXT and
// GL_LUMINANCE_ALPHA16F_EXT exist
bool textureFloat;
bool textureFloatLinear;
// GL_EXT_texture_rg
// Implies that TextureCaps for GL_R8, GL_RG8 (and floating point R/RG texture formats if floating point extensions
// are also present) exist
bool textureRG;
// GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3 and GL_ANGLE_texture_compression_dxt5
// Implies that TextureCaps for GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
// GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE and GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE
bool textureCompressionDXT1;
bool textureCompressionDXT3;
bool textureCompressionDXT5;
// GL_KHR_texture_compression_astc_hdr
bool textureCompressionASTCHDR;
// GL_KHR_texture_compression_astc_ldr
bool textureCompressionASTCLDR;
// GL_OES_compressed_ETC1_RGB8_texture
// Implies that TextureCaps for GL_ETC1_RGB8_OES exist
bool compressedETC1RGB8Texture;
// GL_EXT_sRGB
// Implies that TextureCaps for GL_SRGB8_ALPHA8 and GL_SRGB8 exist
// TODO: Don't advertise this extension in ES3
bool sRGB;
// GL_ANGLE_depth_texture
bool depthTextures;
// GL_OES_depth32
// Allows DEPTH_COMPONENT32_OES as a valid Renderbuffer format.
bool depth32;
// GL_EXT_texture_storage
bool textureStorage;
// GL_OES_texture_npot
bool textureNPOT;
// GL_EXT_draw_buffers
bool drawBuffers;
// GL_EXT_texture_filter_anisotropic
bool textureFilterAnisotropic;
GLfloat maxTextureAnisotropy;
// GL_EXT_occlusion_query_boolean
bool occlusionQueryBoolean;
// GL_NV_fence
bool fence;
// GL_ANGLE_timer_query
bool timerQuery;
// GL_EXT_disjoint_timer_query
bool disjointTimerQuery;
GLuint queryCounterBitsTimeElapsed;
GLuint queryCounterBitsTimestamp;
// GL_EXT_robustness
bool robustness;
// GL_EXT_blend_minmax
bool blendMinMax;
// GL_ANGLE_framebuffer_blit
bool framebufferBlit;
// GL_ANGLE_framebuffer_multisample
bool framebufferMultisample;
// GL_ANGLE_instanced_arrays
bool instancedArrays;
// GL_ANGLE_pack_reverse_row_order
bool packReverseRowOrder;
// GL_OES_standard_derivatives
bool standardDerivatives;
// GL_EXT_shader_texture_lod
bool shaderTextureLOD;
// GL_EXT_shader_framebuffer_fetch
bool shaderFramebufferFetch;
// GL_ARM_shader_framebuffer_fetch
bool ARMshaderFramebufferFetch;
// GL_NV_shader_framebuffer_fetch
bool NVshaderFramebufferFetch;
// GL_EXT_frag_depth
bool fragDepth;
// GL_ANGLE_texture_usage
bool textureUsage;
// GL_ANGLE_translated_shader_source
bool translatedShaderSource;
// GL_OES_fbo_render_mipmap
bool fboRenderMipmap;
// GL_EXT_discard_framebuffer
bool discardFramebuffer;
// EXT_debug_marker
bool debugMarker;
// GL_OES_EGL_image
bool eglImage;
// GL_OES_EGL_image_external
bool eglImageExternal;
// GL_OES_EGL_image_external_essl3
bool eglImageExternalEssl3;
// NV_EGL_stream_consumer_external
bool eglStreamConsumerExternal;
// EXT_unpack_subimage
bool unpackSubimage;
// NV_pack_subimage
bool packSubimage;
// GL_OES_vertex_array_object
bool vertexArrayObject;
// GL_KHR_debug
bool debug;
GLuint maxDebugMessageLength;
GLuint maxDebugLoggedMessages;
GLuint maxDebugGroupStackDepth;
GLuint maxLabelLength;
// KHR_no_error
bool noError;
// GL_ANGLE_lossy_etc_decode
bool lossyETCDecode;
// GL_CHROMIUM_bind_uniform_location
bool bindUniformLocation;
// GL_CHROMIUM_sync_query
bool syncQuery;
// GL_CHROMIUM_copy_texture
bool copyTexture;
// ES3 Extension support
// GL_EXT_color_buffer_float
bool colorBufferFloat;
// GL_EXT_multisample_compatibility.
// written against ES 3.1 but can apply to earlier versions.
bool multisampleCompatibility;
// GL_CHROMIUM_framebuffer_mixed_samples
bool framebufferMixedSamples;
// GL_EXT_texture_norm16
// written against ES 3.1 but can apply to ES 3.0 as well.
bool textureNorm16;
// GL_CHROMIUM_path_rendering
bool pathRendering;
};
struct Limitations
{
Limitations();
// Renderer doesn't support gl_FrontFacing in fragment shaders
bool noFrontFacingSupport;
// Renderer doesn't support GL_SAMPLE_ALPHA_TO_COVERAGE
bool noSampleAlphaToCoverageSupport;
// In glVertexAttribDivisorANGLE, attribute zero must have a zero divisor
bool attributeZeroRequiresZeroDivisorInEXT;
// Unable to support different values for front and back faces for stencil refs and masks
bool noSeparateStencilRefsAndMasks;
// Renderer doesn't support non-constant indexing loops in fragment shader
bool shadersRequireIndexedLoopValidation;
// Renderer doesn't support Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA
// and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR blend functions.
bool noSimultaneousConstantColorAndAlphaBlendFunc;
};
struct TypePrecision
{
TypePrecision();
void setIEEEFloat();
void setTwosComplementInt(unsigned int bits);
void setSimulatedInt(unsigned int range);
void get(GLint *returnRange, GLint *returnPrecision) const;
GLint range[2];
GLint precision;
};
struct Caps
{
Caps();
// ES 3.1 (April 29, 2015) 20.39: implementation dependent values
GLuint64 maxElementIndex;
GLuint max3DTextureSize;
GLuint max2DTextureSize;
GLuint maxArrayTextureLayers;
GLfloat maxLODBias;
GLuint maxCubeMapTextureSize;
GLuint maxRenderbufferSize;
GLfloat minAliasedPointSize;
GLfloat maxAliasedPointSize;
GLfloat minAliasedLineWidth;
GLfloat maxAliasedLineWidth;
// ES 3.1 (April 29, 2015) 20.40: implementation dependent values (cont.)
GLuint maxDrawBuffers;
GLuint maxFramebufferWidth;
GLuint maxFramebufferHeight;
GLuint maxFramebufferSamples;
GLuint maxColorAttachments;
GLuint maxViewportWidth;
GLuint maxViewportHeight;
GLuint maxSampleMaskWords;
GLuint maxColorTextureSamples;
GLuint maxDepthTextureSamples;
GLuint maxIntegerSamples;
GLuint64 maxServerWaitTimeout;
// ES 3.1 (April 29, 2015) Table 20.41: Implementation dependent values (cont.)
GLint maxVertexAttribRelativeOffset;
GLint maxVertexAttribBindings;
GLint maxVertexAttribStride;
GLuint maxElementsIndices;
GLuint maxElementsVertices;
std::vector<GLenum> compressedTextureFormats;
std::vector<GLenum> programBinaryFormats;
std::vector<GLenum> shaderBinaryFormats;
TypePrecision vertexHighpFloat;
TypePrecision vertexMediumpFloat;
TypePrecision vertexLowpFloat;
TypePrecision vertexHighpInt;
TypePrecision vertexMediumpInt;
TypePrecision vertexLowpInt;
TypePrecision fragmentHighpFloat;
TypePrecision fragmentMediumpFloat;
TypePrecision fragmentLowpFloat;
TypePrecision fragmentHighpInt;
TypePrecision fragmentMediumpInt;
TypePrecision fragmentLowpInt;
// ES 3.1 (April 29, 2015) Table 20.43: Implementation dependent Vertex shader limits
GLuint maxVertexAttributes;
GLuint maxVertexUniformComponents;
GLuint maxVertexUniformVectors;
GLuint maxVertexUniformBlocks;
GLuint maxVertexOutputComponents;
GLuint maxVertexTextureImageUnits;
GLuint maxVertexAtomicCounterBuffers;
GLuint maxVertexAtomicCounters;
GLuint maxVertexImageUniforms;
GLuint maxVertexShaderStorageBlocks;
// ES 3.1 (April 29, 2015) Table 20.44: Implementation dependent Fragment shader limits
GLuint maxFragmentUniformComponents;
GLuint maxFragmentUniformVectors;
GLuint maxFragmentUniformBlocks;
GLuint maxFragmentInputComponents;
GLuint maxTextureImageUnits;
GLuint maxFragmentAtomicCounterBuffers;
GLuint maxFragmentAtomicCounters;
GLuint maxFragmentImageUniforms;
GLuint maxFragmentShaderStorageBlocks;
GLint minProgramTextureGatherOffset;
GLuint maxProgramTextureGatherOffset;
GLint minProgramTexelOffset;
GLint maxProgramTexelOffset;
// ES 3.1 (April 29, 2015) Table 20.45: implementation dependent compute shader limits
std::array<GLuint, 3> maxComputeWorkGroupCount;
std::array<GLuint, 3> maxComputeWorkGroupSize;
GLuint maxComputeWorkGroupInvocations;
GLuint maxComputeUniformBlocks;
GLuint maxComputeTextureImageUnits;
GLuint maxComputeSharedMemorySize;
GLuint maxComputeUniformComponents;
GLuint maxComputeAtomicCounterBuffers;
GLuint maxComputeAtomicCounters;
GLuint maxComputeImageUniforms;
GLuint maxCombinedComputeUniformComponents;
GLuint maxComputeShaderStorageBlocks;
// ES 3.1 (April 29, 2015) Table 20.46: implementation dependent aggregate shader limits
GLuint maxUniformBufferBindings;
GLuint64 maxUniformBlockSize;
GLuint uniformBufferOffsetAlignment;
GLuint maxCombinedUniformBlocks;
GLuint64 maxCombinedVertexUniformComponents;
GLuint64 maxCombinedFragmentUniformComponents;
GLuint maxVaryingComponents;
GLuint maxVaryingVectors;
GLuint maxCombinedTextureImageUnits;
GLuint maxCombinedShaderOutputResources;
// ES 3.1 (April 29, 2015) Table 20.47: implementation dependent aggregate shader limits (cont.)
GLuint maxUniformLocations;
GLuint maxAtomicCounterBufferBindings;
GLuint maxAtomicCounterBufferSize;
GLuint maxCombinedAtomicCounterBuffers;
GLuint maxCombinedAtomicCounters;
GLuint maxImageUnits;
GLuint maxCombinedImageUniforms;
GLuint maxShaderStorageBufferBindings;
GLuint64 maxShaderStorageBlockSize;
GLuint maxCombinedShaderStorageBlocks;
GLuint shaderStorageBufferOffsetAlignment;
// ES 3.1 (April 29, 2015) Table 20.48: implementation dependent transform feedback limits
GLuint maxTransformFeedbackInterleavedComponents;
GLuint maxTransformFeedbackSeparateAttributes;
GLuint maxTransformFeedbackSeparateComponents;
// ES 3.1 (April 29, 2015) Table 20.49: Framebuffer Dependent Values
GLuint maxSamples;
};
}
namespace egl
{
struct Caps
{
Caps();
// Support for NPOT surfaces
bool textureNPOT;
};
struct DisplayExtensions
{
DisplayExtensions();
// Generate a vector of supported extension strings
std::vector<std::string> getStrings() const;
// EGL_EXT_create_context_robustness
bool createContextRobustness;
// EGL_ANGLE_d3d_share_handle_client_buffer
bool d3dShareHandleClientBuffer;
// EGL_ANGLE_surface_d3d_texture_2d_share_handle
bool surfaceD3DTexture2DShareHandle;
// EGL_ANGLE_query_surface_pointer
bool querySurfacePointer;
// EGL_ANGLE_window_fixed_size
bool windowFixedSize;
// EGL_ANGLE_keyed_mutex
bool keyedMutex;
// EGL_ANGLE_surface_orientation
bool surfaceOrientation;
// EGL_NV_post_sub_buffer
bool postSubBuffer;
// EGL_KHR_create_context
bool createContext;
// EGL_EXT_device_query
bool deviceQuery;
// EGL_KHR_image
bool image;
// EGL_KHR_image_base
bool imageBase;
// EGL_KHR_image_pixmap
bool imagePixmap;
// EGL_KHR_gl_texture_2D_image
bool glTexture2DImage;
// EGL_KHR_gl_texture_cubemap_image
bool glTextureCubemapImage;
// EGL_KHR_gl_texture_3D_image
bool glTexture3DImage;
// EGL_KHR_gl_renderbuffer_image
bool glRenderbufferImage;
// EGL_KHR_get_all_proc_addresses
bool getAllProcAddresses;
// EGL_ANGLE_flexible_surface_compatibility
bool flexibleSurfaceCompatibility;
// EGL_ANGLE_direct_composition
bool directComposition;
// KHR_create_context_no_error
bool createContextNoError;
// EGL_KHR_stream
bool stream;
// EGL_KHR_stream_consumer_gltexture
bool streamConsumerGLTexture;
// EGL_NV_stream_consumer_gltexture_yuv
bool streamConsumerGLTextureYUV;
// EGL_ANGLE_stream_producer_d3d_texture_nv12
bool streamProducerD3DTextureNV12;
};
struct DeviceExtensions
{
DeviceExtensions();
// Generate a vector of supported extension strings
std::vector<std::string> getStrings() const;
// EGL_ANGLE_device_d3d
bool deviceD3D;
};
struct ClientExtensions
{
ClientExtensions();
// Generate a vector of supported extension strings
std::vector<std::string> getStrings() const;
// EGL_EXT_client_extensions
bool clientExtensions;
// EGL_EXT_platform_base
bool platformBase;
// EGL_EXT_platform_device
bool platformDevice;
// EGL_ANGLE_platform_angle
bool platformANGLE;
// EGL_ANGLE_platform_angle_d3d
bool platformANGLED3D;
// EGL_ANGLE_platform_angle_opengl
bool platformANGLEOpenGL;
// EGL_ANGLE_device_creation
bool deviceCreation;
// EGL_ANGLE_device_creation_d3d11
bool deviceCreationD3D11;
// EGL_ANGLE_x11_visual
bool x11Visual;
// EGL_ANGLE_experimental_present_path
bool experimentalPresentPath;
// EGL_KHR_client_get_all_proc_addresses
bool clientGetAllProcAddresses;
};
}
#endif // LIBANGLE_CAPS_H_
|