xref: /third_party/mesa3d/src/mesa/main/consts_exts.h (revision bf215546)
1/*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
5 * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26/**
27 * \file consts_exts.h
28 * Mesa Constants and GL Extensions data structures.
29 */
30
31#ifndef __CONSTS_EXTS_H__
32#define __CONSTS_EXTS_H__
33
34#include "main/glheader.h"
35#include "compiler/shader_enums.h"
36#include "compiler/shader_info.h"
37
38struct nir_shader_compiler_options;
39
40/**
41 * Enable flag for each OpenGL extension.  Different device drivers will
42 * enable different extensions at runtime.
43 */
44struct gl_extensions
45{
46   GLboolean dummy;  /* don't remove this! */
47   GLboolean dummy_true;  /* Set true by _mesa_init_extensions(). */
48   GLboolean ANGLE_texture_compression_dxt;
49   GLboolean ARB_ES2_compatibility;
50   GLboolean ARB_ES3_compatibility;
51   GLboolean ARB_ES3_1_compatibility;
52   GLboolean ARB_ES3_2_compatibility;
53   GLboolean ARB_arrays_of_arrays;
54   GLboolean ARB_base_instance;
55   GLboolean ARB_bindless_texture;
56   GLboolean ARB_blend_func_extended;
57   GLboolean ARB_buffer_storage;
58   GLboolean ARB_clear_texture;
59   GLboolean ARB_clip_control;
60   GLboolean ARB_color_buffer_float;
61   GLboolean ARB_compatibility;
62   GLboolean ARB_compute_shader;
63   GLboolean ARB_compute_variable_group_size;
64   GLboolean ARB_conditional_render_inverted;
65   GLboolean ARB_conservative_depth;
66   GLboolean ARB_copy_image;
67   GLboolean ARB_cull_distance;
68   GLboolean EXT_color_buffer_half_float;
69   GLboolean ARB_depth_buffer_float;
70   GLboolean ARB_depth_clamp;
71   GLboolean ARB_derivative_control;
72   GLboolean ARB_draw_buffers_blend;
73   GLboolean ARB_draw_elements_base_vertex;
74   GLboolean ARB_draw_indirect;
75   GLboolean ARB_draw_instanced;
76   GLboolean ARB_fragment_coord_conventions;
77   GLboolean ARB_fragment_layer_viewport;
78   GLboolean ARB_fragment_program;
79   GLboolean ARB_fragment_program_shadow;
80   GLboolean ARB_fragment_shader;
81   GLboolean ARB_framebuffer_no_attachments;
82   GLboolean ARB_framebuffer_object;
83   GLboolean ARB_fragment_shader_interlock;
84   GLboolean ARB_enhanced_layouts;
85   GLboolean ARB_explicit_attrib_location;
86   GLboolean ARB_explicit_uniform_location;
87   GLboolean ARB_gl_spirv;
88   GLboolean ARB_gpu_shader5;
89   GLboolean ARB_gpu_shader_fp64;
90   GLboolean ARB_gpu_shader_int64;
91   GLboolean ARB_half_float_vertex;
92   GLboolean ARB_indirect_parameters;
93   GLboolean ARB_instanced_arrays;
94   GLboolean ARB_internalformat_query;
95   GLboolean ARB_internalformat_query2;
96   GLboolean ARB_map_buffer_range;
97   GLboolean ARB_occlusion_query;
98   GLboolean ARB_occlusion_query2;
99   GLboolean ARB_pipeline_statistics_query;
100   GLboolean ARB_point_sprite;
101   GLboolean ARB_polygon_offset_clamp;
102   GLboolean ARB_post_depth_coverage;
103   GLboolean ARB_query_buffer_object;
104   GLboolean ARB_robust_buffer_access_behavior;
105   GLboolean ARB_sample_locations;
106   GLboolean ARB_sample_shading;
107   GLboolean ARB_seamless_cube_map;
108   GLboolean ARB_shader_atomic_counter_ops;
109   GLboolean ARB_shader_atomic_counters;
110   GLboolean ARB_shader_ballot;
111   GLboolean ARB_shader_bit_encoding;
112   GLboolean ARB_shader_clock;
113   GLboolean ARB_shader_draw_parameters;
114   GLboolean ARB_shader_group_vote;
115   GLboolean ARB_shader_image_load_store;
116   GLboolean ARB_shader_image_size;
117   GLboolean ARB_shader_precision;
118   GLboolean ARB_shader_stencil_export;
119   GLboolean ARB_shader_storage_buffer_object;
120   GLboolean ARB_shader_texture_image_samples;
121   GLboolean ARB_shader_texture_lod;
122   GLboolean ARB_shader_viewport_layer_array;
123   GLboolean ARB_shading_language_packing;
124   GLboolean ARB_shading_language_420pack;
125   GLboolean ARB_shadow;
126   GLboolean ARB_sparse_buffer;
127   GLboolean ARB_sparse_texture;
128   GLboolean ARB_sparse_texture2;
129   GLboolean ARB_sparse_texture_clamp;
130   GLboolean ARB_stencil_texturing;
131   GLboolean ARB_spirv_extensions;
132   GLboolean ARB_sync;
133   GLboolean ARB_tessellation_shader;
134   GLboolean ARB_texture_buffer_object;
135   GLboolean ARB_texture_buffer_object_rgb32;
136   GLboolean ARB_texture_buffer_range;
137   GLboolean ARB_texture_compression_bptc;
138   GLboolean ARB_texture_compression_rgtc;
139   GLboolean ARB_texture_cube_map_array;
140   GLboolean ARB_texture_filter_anisotropic;
141   GLboolean ARB_texture_filter_minmax;
142   GLboolean ARB_texture_float;
143   GLboolean ARB_texture_gather;
144   GLboolean ARB_texture_mirror_clamp_to_edge;
145   GLboolean ARB_texture_multisample;
146   GLboolean ARB_texture_non_power_of_two;
147   GLboolean ARB_texture_stencil8;
148   GLboolean ARB_texture_query_levels;
149   GLboolean ARB_texture_query_lod;
150   GLboolean ARB_texture_rg;
151   GLboolean ARB_texture_rgb10_a2ui;
152   GLboolean ARB_texture_view;
153   GLboolean ARB_timer_query;
154   GLboolean ARB_transform_feedback2;
155   GLboolean ARB_transform_feedback3;
156   GLboolean ARB_transform_feedback_instanced;
157   GLboolean ARB_transform_feedback_overflow_query;
158   GLboolean ARB_uniform_buffer_object;
159   GLboolean ARB_vertex_attrib_64bit;
160   GLboolean ARB_vertex_program;
161   GLboolean ARB_vertex_shader;
162   GLboolean ARB_vertex_type_10f_11f_11f_rev;
163   GLboolean ARB_vertex_type_2_10_10_10_rev;
164   GLboolean ARB_viewport_array;
165   GLboolean EXT_blend_equation_separate;
166   GLboolean EXT_demote_to_helper_invocation;
167   GLboolean EXT_depth_bounds_test;
168   GLboolean EXT_disjoint_timer_query;
169   GLboolean EXT_draw_buffers2;
170   GLboolean EXT_EGL_image_storage;
171   GLboolean EXT_float_blend;
172   GLboolean EXT_framebuffer_multisample;
173   GLboolean EXT_framebuffer_multisample_blit_scaled;
174   GLboolean EXT_framebuffer_sRGB;
175   GLboolean EXT_gpu_program_parameters;
176   GLboolean EXT_gpu_shader4;
177   GLboolean EXT_memory_object;
178   GLboolean EXT_memory_object_fd;
179   GLboolean EXT_memory_object_win32;
180   GLboolean EXT_multisampled_render_to_texture;
181   GLboolean EXT_packed_float;
182   GLboolean EXT_pixel_buffer_object;
183   GLboolean EXT_provoking_vertex;
184   GLboolean EXT_render_snorm;
185   GLboolean EXT_semaphore;
186   GLboolean EXT_semaphore_fd;
187   GLboolean EXT_semaphore_win32;
188   GLboolean EXT_shader_image_load_formatted;
189   GLboolean EXT_shader_image_load_store;
190   GLboolean EXT_shader_integer_mix;
191   GLboolean EXT_shader_samples_identical;
192   GLboolean EXT_sRGB;
193   GLboolean EXT_stencil_two_side;
194   GLboolean EXT_texture_array;
195   GLboolean EXT_texture_buffer_object;
196   GLboolean EXT_texture_compression_latc;
197   GLboolean EXT_texture_compression_s3tc;
198   GLboolean EXT_texture_compression_s3tc_srgb;
199   GLboolean EXT_texture_env_dot3;
200   GLboolean EXT_texture_filter_anisotropic;
201   GLboolean EXT_texture_filter_minmax;
202   GLboolean EXT_texture_integer;
203   GLboolean EXT_texture_mirror_clamp;
204   GLboolean EXT_texture_norm16;
205   GLboolean EXT_texture_shadow_lod;
206   GLboolean EXT_texture_shared_exponent;
207   GLboolean EXT_texture_snorm;
208   GLboolean EXT_texture_sRGB;
209   GLboolean EXT_texture_sRGB_R8;
210   GLboolean EXT_texture_sRGB_RG8;
211   GLboolean EXT_texture_sRGB_decode;
212   GLboolean EXT_texture_swizzle;
213   GLboolean EXT_texture_type_2_10_10_10_REV;
214   GLboolean EXT_transform_feedback;
215   GLboolean EXT_timer_query;
216   GLboolean EXT_vertex_array_bgra;
217   GLboolean EXT_window_rectangles;
218   GLboolean OES_copy_image;
219   GLboolean OES_primitive_bounding_box;
220   GLboolean OES_sample_variables;
221   GLboolean OES_standard_derivatives;
222   GLboolean OES_texture_buffer;
223   GLboolean OES_texture_cube_map_array;
224   GLboolean OES_texture_view;
225   GLboolean OES_viewport_array;
226   /* vendor extensions */
227   GLboolean AMD_compressed_ATC_texture;
228   GLboolean AMD_framebuffer_multisample_advanced;
229   GLboolean AMD_depth_clamp_separate;
230   GLboolean AMD_performance_monitor;
231   GLboolean AMD_pinned_memory;
232   GLboolean AMD_seamless_cubemap_per_texture;
233   GLboolean AMD_vertex_shader_layer;
234   GLboolean AMD_vertex_shader_viewport_index;
235   GLboolean ANDROID_extension_pack_es31a;
236   GLboolean ARM_shader_framebuffer_fetch_depth_stencil;
237   GLboolean ATI_meminfo;
238   GLboolean ATI_texture_compression_3dc;
239   GLboolean ATI_texture_mirror_once;
240   GLboolean ATI_texture_env_combine3;
241   GLboolean ATI_fragment_shader;
242   GLboolean GREMEDY_string_marker;
243   GLboolean INTEL_blackhole_render;
244   GLboolean INTEL_conservative_rasterization;
245   GLboolean INTEL_performance_query;
246   GLboolean INTEL_shader_atomic_float_minmax;
247   GLboolean INTEL_shader_integer_functions2;
248   GLboolean KHR_blend_equation_advanced;
249   GLboolean KHR_blend_equation_advanced_coherent;
250   GLboolean KHR_robustness;
251   GLboolean KHR_texture_compression_astc_hdr;
252   GLboolean KHR_texture_compression_astc_ldr;
253   GLboolean KHR_texture_compression_astc_sliced_3d;
254   GLboolean MESA_framebuffer_flip_y;
255   GLboolean MESA_pack_invert;
256   GLboolean MESA_tile_raster_order;
257   GLboolean EXT_shader_framebuffer_fetch;
258   GLboolean EXT_shader_framebuffer_fetch_non_coherent;
259   GLboolean MESA_shader_integer_functions;
260   GLboolean MESA_window_pos;
261   GLboolean MESA_ycbcr_texture;
262   GLboolean NV_alpha_to_coverage_dither_control;
263   GLboolean NV_compute_shader_derivatives;
264   GLboolean NV_conditional_render;
265   GLboolean NV_copy_depth_to_color;
266   GLboolean NV_copy_image;
267   GLboolean NV_fill_rectangle;
268   GLboolean NV_fog_distance;
269   GLboolean NV_primitive_restart;
270   GLboolean NV_shader_atomic_float;
271   GLboolean NV_shader_atomic_int64;
272   GLboolean NV_texture_barrier;
273   GLboolean NV_texture_env_combine4;
274   GLboolean NV_texture_rectangle;
275   GLboolean NV_vdpau_interop;
276   GLboolean NV_conservative_raster;
277   GLboolean NV_conservative_raster_dilate;
278   GLboolean NV_conservative_raster_pre_snap_triangles;
279   GLboolean NV_conservative_raster_pre_snap;
280   GLboolean NV_viewport_array2;
281   GLboolean NV_viewport_swizzle;
282   GLboolean NVX_gpu_memory_info;
283   GLboolean TDFX_texture_compression_FXT1;
284   GLboolean OES_EGL_image;
285   GLboolean OES_draw_texture;
286   GLboolean OES_depth_texture_cube_map;
287   GLboolean OES_EGL_image_external;
288   GLboolean OES_texture_3D;
289   GLboolean OES_texture_float;
290   GLboolean OES_texture_float_linear;
291   GLboolean OES_texture_half_float;
292   GLboolean OES_texture_half_float_linear;
293   GLboolean OES_compressed_ETC1_RGB8_texture;
294   GLboolean OES_geometry_shader;
295   GLboolean OES_texture_compression_astc;
296   GLboolean extension_sentinel;
297   /** The extension string */
298   const GLubyte *String;
299   /** Number of supported extensions */
300   GLuint Count;
301   /**
302    * The context version which extension helper functions compare against.
303    * By default, the value is equal to ctx->Version. This changes to ~0
304    * while meta is in progress.
305    */
306   GLubyte Version;
307};
308
309/**
310 * Compiler options for a single GLSL shaders type
311 */
312struct gl_shader_compiler_options
313{
314   /** Driver-selectable options: */
315   GLboolean EmitNoCont;                  /**< Emit CONT opcode? */
316   GLboolean EmitNoMainReturn;            /**< Emit CONT/RET opcodes? */
317   GLboolean LowerCombinedClipCullDistance; /** Lower gl_ClipDistance and
318                                              * gl_CullDistance together from
319                                              * float[8] to vec4[2]
320                                              **/
321   GLbitfield LowerBuiltinVariablesXfb;   /**< Which builtin variables should
322                                           * be lowered for transform feedback
323                                           **/
324
325   /**
326    * If we can lower the precision of variables based on precision
327    * qualifiers
328    */
329   GLboolean LowerPrecisionFloat16;
330   GLboolean LowerPrecisionInt16;
331   GLboolean LowerPrecisionDerivatives;
332   GLboolean LowerPrecisionFloat16Uniforms;
333
334   /**
335    * This enables lowering of 16b constants.  Some drivers may not
336    * to lower constants to 16b (ie. if the hw can do automatic
337    * narrowing on constant load)
338    */
339   GLboolean LowerPrecisionConstants;
340
341   /**
342    * \name Forms of indirect addressing the driver cannot do.
343    */
344   /*@{*/
345   GLboolean EmitNoIndirectInput;   /**< No indirect addressing of inputs */
346   GLboolean EmitNoIndirectOutput;  /**< No indirect addressing of outputs */
347   GLboolean EmitNoIndirectTemp;    /**< No indirect addressing of temps */
348   GLboolean EmitNoIndirectUniform; /**< No indirect addressing of constants */
349   /*@}*/
350
351   GLuint MaxIfDepth;               /**< Maximum nested IF blocks */
352
353   /**
354    * Optimize code for array of structures backends.
355    *
356    * This is a proxy for:
357    *   - preferring DP4 instructions (rather than MUL/MAD) for
358    *     matrix * vector operations, such as position transformation.
359    */
360   GLboolean OptimizeForAOS;
361
362   /** Clamp UBO and SSBO block indices so they don't go out-of-bounds. */
363   GLboolean ClampBlockIndicesToArrayBounds;
364
365   /** (driconf) Force gl_Position to be considered invariant */
366   GLboolean PositionAlwaysInvariant;
367
368   /** (driconf) Force gl_Position to be considered precise */
369   GLboolean PositionAlwaysPrecise;
370
371   const struct nir_shader_compiler_options *NirOptions;
372};
373
374/**
375 * Precision info for shader datatypes.  See glGetShaderPrecisionFormat().
376 */
377struct gl_precision
378{
379   GLushort RangeMin;   /**< min value exponent */
380   GLushort RangeMax;   /**< max value exponent */
381   GLushort Precision;  /**< number of mantissa bits */
382};
383
384/**
385 * Limits for vertex, geometry and fragment programs/shaders.
386 */
387struct gl_program_constants
388{
389   /* logical limits */
390   GLuint MaxInstructions;
391   GLuint MaxAluInstructions;
392   GLuint MaxTexInstructions;
393   GLuint MaxTexIndirections;
394   GLuint MaxAttribs;
395   GLuint MaxTemps;
396   GLuint MaxAddressRegs;
397   GLuint MaxAddressOffset;  /**< [-MaxAddressOffset, MaxAddressOffset-1] */
398   GLuint MaxParameters;
399   GLuint MaxLocalParams;
400   GLuint MaxEnvParams;
401   /* native/hardware limits */
402   GLuint MaxNativeInstructions;
403   GLuint MaxNativeAluInstructions;
404   GLuint MaxNativeTexInstructions;
405   GLuint MaxNativeTexIndirections;
406   GLuint MaxNativeAttribs;
407   GLuint MaxNativeTemps;
408   GLuint MaxNativeAddressRegs;
409   GLuint MaxNativeParameters;
410   /* For shaders */
411   GLuint MaxUniformComponents;  /**< Usually == MaxParameters * 4 */
412
413   /**
414    * \name Per-stage input / output limits
415    *
416    * Previous to OpenGL 3.2, the intrastage data limits were advertised with
417    * a single value: GL_MAX_VARYING_COMPONENTS (GL_MAX_VARYING_VECTORS in
418    * ES).  This is stored as \c gl_constants::MaxVarying.
419    *
420    * Starting with OpenGL 3.2, the limits are advertised with per-stage
421    * variables.  Each stage as a certain number of outputs that it can feed
422    * to the next stage and a certain number inputs that it can consume from
423    * the previous stage.
424    *
425    * Vertex shader inputs do not participate this in this accounting.
426    * These are tracked exclusively by \c gl_program_constants::MaxAttribs.
427    *
428    * Fragment shader outputs do not participate this in this accounting.
429    * These are tracked exclusively by \c gl_constants::MaxDrawBuffers.
430    */
431   /*@{*/
432   GLuint MaxInputComponents;
433   GLuint MaxOutputComponents;
434   /*@}*/
435
436   /* ES 2.0 and GL_ARB_ES2_compatibility */
437   struct gl_precision LowFloat, MediumFloat, HighFloat;
438   struct gl_precision LowInt, MediumInt, HighInt;
439   /* GL_ARB_uniform_buffer_object */
440   GLuint MaxUniformBlocks;
441   uint64_t MaxCombinedUniformComponents;
442   GLuint MaxTextureImageUnits;
443
444   /* GL_ARB_shader_atomic_counters */
445   GLuint MaxAtomicBuffers;
446   GLuint MaxAtomicCounters;
447
448   /* GL_ARB_shader_image_load_store */
449   GLuint MaxImageUniforms;
450
451   /* GL_ARB_shader_storage_buffer_object */
452   GLuint MaxShaderStorageBlocks;
453};
454
455/**
456 * Constants which may be overridden by device driver during context creation
457 * but are never changed after that.
458 */
459struct gl_constants
460{
461   /**
462    * Bitmask of valid primitive types supported by the driver,
463    */
464   GLbitfield DriverSupportedPrimMask;
465
466   GLuint MaxTextureMbytes;      /**< Max memory per image, in MB */
467   GLuint MaxTextureSize;        /**< Max 1D/2D texture size, in pixels*/
468   GLuint Max3DTextureLevels;    /**< Max mipmap levels for 3D textures */
469   GLuint MaxCubeTextureLevels;  /**< Max mipmap levels for cube textures */
470   GLuint MaxArrayTextureLayers; /**< Max layers in array textures */
471   GLuint MaxTextureRectSize;    /**< Max rectangle texture size, in pixes */
472   GLuint MaxTextureCoordUnits;
473   GLuint MaxCombinedTextureImageUnits;
474   GLuint MaxTextureUnits; /**< = MIN(CoordUnits, FragmentProgram.ImageUnits) */
475   GLfloat MaxTextureMaxAnisotropy;  /**< GL_EXT_texture_filter_anisotropic */
476   GLfloat MaxTextureLodBias;        /**< GL_EXT_texture_lod_bias */
477   GLuint MaxTextureBufferSize;      /**< GL_ARB_texture_buffer_object */
478
479   GLuint TextureBufferOffsetAlignment; /**< GL_ARB_texture_buffer_range */
480
481   GLuint MaxArrayLockSize;
482
483   GLint SubPixelBits;
484
485   GLfloat MinPointSize, MaxPointSize;	     /**< aliased */
486   GLfloat MinPointSizeAA, MaxPointSizeAA;   /**< antialiased */
487   GLfloat PointSizeGranularity;
488   GLfloat MinLineWidth, MaxLineWidth;       /**< aliased */
489   GLfloat MinLineWidthAA, MaxLineWidthAA;   /**< antialiased */
490   GLfloat LineWidthGranularity;
491
492   GLuint MaxClipPlanes;
493   GLuint MaxLights;
494   GLfloat MaxShininess;                     /**< GL_NV_light_max_exponent */
495   GLfloat MaxSpotExponent;                  /**< GL_NV_light_max_exponent */
496
497   GLuint MaxViewportWidth, MaxViewportHeight;
498   GLuint MaxViewports;                      /**< GL_ARB_viewport_array */
499   GLuint ViewportSubpixelBits;              /**< GL_ARB_viewport_array */
500   struct {
501      GLfloat Min;
502      GLfloat Max;
503   } ViewportBounds;                         /**< GL_ARB_viewport_array */
504   GLuint MaxWindowRectangles;               /**< GL_EXT_window_rectangles */
505
506   struct gl_program_constants Program[MESA_SHADER_STAGES];
507   GLuint MaxProgramMatrices;
508   GLuint MaxProgramMatrixStackDepth;
509
510   struct {
511      GLuint SamplesPassed;
512      GLuint TimeElapsed;
513      GLuint Timestamp;
514      GLuint PrimitivesGenerated;
515      GLuint PrimitivesWritten;
516      GLuint VerticesSubmitted;
517      GLuint PrimitivesSubmitted;
518      GLuint VsInvocations;
519      GLuint TessPatches;
520      GLuint TessInvocations;
521      GLuint GsInvocations;
522      GLuint GsPrimitives;
523      GLuint FsInvocations;
524      GLuint ComputeInvocations;
525      GLuint ClInPrimitives;
526      GLuint ClOutPrimitives;
527   } QueryCounterBits;
528
529   GLuint MaxDrawBuffers;    /**< GL_ARB_draw_buffers */
530
531   GLuint MaxColorAttachments;   /**< GL_EXT_framebuffer_object */
532   GLuint MaxRenderbufferSize;   /**< GL_EXT_framebuffer_object */
533   GLuint MaxSamples;            /**< GL_ARB_framebuffer_object */
534
535   /**
536    * GL_ARB_framebuffer_no_attachments
537    */
538   GLuint MaxFramebufferWidth;
539   GLuint MaxFramebufferHeight;
540   GLuint MaxFramebufferLayers;
541   GLuint MaxFramebufferSamples;
542
543   /** Number of varying vectors between any two shader stages. */
544   GLuint MaxVarying;
545
546   /** @{
547    * GL_ARB_uniform_buffer_object
548    */
549   GLuint MaxCombinedUniformBlocks;
550   GLuint MaxUniformBufferBindings;
551   GLuint MaxUniformBlockSize;
552   GLuint UniformBufferOffsetAlignment;
553   /** @} */
554
555   /** @{
556    * GL_ARB_shader_storage_buffer_object
557    */
558   GLuint MaxCombinedShaderStorageBlocks;
559   GLuint MaxShaderStorageBufferBindings;
560   GLuint MaxShaderStorageBlockSize;
561   GLuint ShaderStorageBufferOffsetAlignment;
562   /** @} */
563
564   /**
565    * GL_ARB_explicit_uniform_location
566    */
567   GLuint MaxUserAssignableUniformLocations;
568
569   /** geometry shader */
570   GLuint MaxGeometryOutputVertices;
571   GLuint MaxGeometryTotalOutputComponents;
572   GLuint MaxGeometryShaderInvocations;
573
574   GLuint GLSLVersion;  /**< Desktop GLSL version supported (ex: 120 = 1.20) */
575   GLuint GLSLVersionCompat;  /**< Desktop compat GLSL version supported  */
576
577   /**
578    * Changes default GLSL extension behavior from "error" to "warn".  It's out
579    * of spec, but it can make some apps work that otherwise wouldn't.
580    */
581   GLboolean ForceGLSLExtensionsWarn;
582
583   /**
584    * Force all shaders to behave as if they were declared with the
585    * compatibility token.
586    */
587   GLboolean ForceCompatShaders;
588
589   /**
590    * If non-zero, forces GLSL shaders to behave as if they began
591    * with "#version ForceGLSLVersion".
592    */
593   GLuint ForceGLSLVersion;
594
595   /**
596    * Allow GLSL #extension directives in the middle of shaders.
597    */
598   GLboolean AllowGLSLExtensionDirectiveMidShader;
599
600   /**
601    * Allow a subset of GLSL 1.20 in GLSL 1.10 as needed by SPECviewperf13.
602    */
603   GLboolean AllowGLSL120SubsetIn110;
604
605   /**
606    * Allow builtins as part of constant expressions. This was not allowed
607    * until GLSL 1.20 this allows it everywhere.
608    */
609   GLboolean AllowGLSLBuiltinConstantExpression;
610
611   /**
612    * Allow some relaxation of GLSL ES shader restrictions. This encompasses
613    * a number of relaxations to the ES shader rules.
614    */
615   GLboolean AllowGLSLRelaxedES;
616
617   /**
618    * Allow GLSL built-in variables to be redeclared verbatim
619    */
620   GLboolean AllowGLSLBuiltinVariableRedeclaration;
621
622   /**
623    * Allow GLSL interpolation qualifier mismatch across shader stages.
624    */
625   GLboolean AllowGLSLCrossStageInterpolationMismatch;
626
627   /**
628    * Allow creating a higher compat profile (version 3.1+) for apps that
629    * request it. Be careful when adding that driconf option because some
630    * features are unimplemented and might not work correctly.
631    */
632   GLboolean AllowHigherCompatVersion;
633
634   /**
635    * Allow GLSL shaders with the compatibility version directive
636    * in non-compatibility profiles. (for shader-db)
637    */
638   GLboolean AllowGLSLCompatShaders;
639
640   /**
641    * Allow extra tokens at end of preprocessor directives. The CTS now tests
642    * to make sure these are not allowed. However, previously drivers would
643    * allow them to exist and just issue a warning so some old applications
644    * depend on this.
645    */
646   GLboolean AllowExtraPPTokens;
647
648   /**
649    * The spec forbids a shader to "statically write both gl_ClipVertex
650    * and gl_ClipDistance".
651    * This option adds a tolerance for shader that statically writes to
652    * both but at least one of the write can be removed by a dead code
653    * elimination pass.
654    */
655   GLboolean DoDCEBeforeClipCullAnalysis;
656
657   /**
658    * Force computing the absolute value for sqrt() and inversesqrt() to follow
659    * D3D9 when apps rely on this behaviour.
660    */
661   GLboolean ForceGLSLAbsSqrt;
662
663   /**
664    * Forces the GLSL compiler to ignore writes to readonly vars rather than
665    * throwing an error.
666    */
667   GLboolean GLSLIgnoreWriteToReadonlyVar;
668
669   /**
670    * Types of variable to default initialized to zero. Supported values are:
671    *   - 0: no zero initialization
672    *   - 1: all shader variables and gl_FragColor are initialiazed to 0
673    *   - 2: same as 1, but shader out variables are *not* initialized, while
674    *        function out variables are now initialized.
675    */
676   GLchar GLSLZeroInit;
677
678   /**
679    * Force GL names reuse. Needed by SPECviewperf13.
680    */
681   GLboolean ForceGLNamesReuse;
682
683   /**
684    * Treat integer textures using GL_LINEAR filters as GL_NEAREST.
685    */
686   GLboolean ForceIntegerTexNearest;
687
688   /**
689    * Does the driver support real 32-bit integers?  (Otherwise, integers are
690    * simulated via floats.)
691    */
692   GLboolean NativeIntegers;
693
694   /**
695    * Does VertexID count from zero or from base vertex?
696    *
697    * \note
698    * If desktop GLSL 1.30 or GLSL ES 3.00 are not supported, this field is
699    * ignored and need not be set.
700    */
701   bool VertexID_is_zero_based;
702
703   /**
704    * If the driver supports real 32-bit integers, what integer value should be
705    * used for boolean true in uniform uploads?  (Usually 1 or ~0.)
706    */
707   GLuint UniformBooleanTrue;
708
709   /**
710    * Maximum amount of time, measured in nanseconds, that the server can wait.
711    */
712   GLuint64 MaxServerWaitTimeout;
713
714   /** GL_EXT_provoking_vertex */
715   GLboolean QuadsFollowProvokingVertexConvention;
716
717   /** GL_ARB_viewport_array */
718   GLenum16 LayerAndVPIndexProvokingVertex;
719
720   /** OpenGL version 3.0 */
721   GLbitfield ContextFlags;  /**< Ex: GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */
722
723   /** OpenGL version 3.2 */
724   GLbitfield ProfileMask;   /**< Mask of CONTEXT_x_PROFILE_BIT */
725
726   /** OpenGL version 4.4 */
727   GLuint MaxVertexAttribStride;
728
729   /** GL_EXT_transform_feedback */
730   GLuint MaxTransformFeedbackBuffers;
731   GLuint MaxTransformFeedbackSeparateComponents;
732   GLuint MaxTransformFeedbackInterleavedComponents;
733   GLuint MaxVertexStreams;
734
735   /** GL_EXT_gpu_shader4 */
736   GLint MinProgramTexelOffset, MaxProgramTexelOffset;
737
738   /** GL_ARB_texture_gather */
739   GLuint MinProgramTextureGatherOffset;
740   GLuint MaxProgramTextureGatherOffset;
741   GLuint MaxProgramTextureGatherComponents;
742
743   /* GL_ARB_robustness */
744   GLenum16 ResetStrategy;
745
746   /* GL_KHR_robustness */
747   GLboolean RobustAccess;
748
749   /* GL_ARB_blend_func_extended */
750   GLuint MaxDualSourceDrawBuffers;
751
752   /**
753    * For drivers which can do a better job at eliminating unused uniforms
754    * than the GLSL compiler.
755    *
756    * XXX Remove these as soon as a better solution is available.
757    */
758   GLboolean GLSLSkipStrictMaxUniformLimitCheck;
759
760   /**
761    * Whether gl_FragCoord, gl_PointCoord and gl_FrontFacing
762    * are system values.
763    **/
764   bool GLSLFragCoordIsSysVal;
765   bool GLSLPointCoordIsSysVal;
766   bool GLSLFrontFacingIsSysVal;
767
768   /**
769    * Whether to call lower_const_arrays_to_uniforms() during linking.
770    */
771   bool GLSLLowerConstArrays;
772
773   /**
774    * True if gl_TessLevelInner/Outer[] in the TES should be inputs
775    * (otherwise, they're system values).
776    */
777   bool GLSLTessLevelsAsInputs;
778
779   /** GL_ARB_map_buffer_alignment */
780   GLuint MinMapBufferAlignment;
781
782   /**
783    * Disable varying packing.  This is out of spec, but potentially useful
784    * for older platforms that supports a limited number of texture
785    * indirections--on these platforms, unpacking the varyings in the fragment
786    * shader increases the number of texture indirections by 1, which might
787    * make some shaders not executable at all.
788    *
789    * Drivers that support transform feedback must set this value to GL_FALSE.
790    */
791   GLboolean DisableVaryingPacking;
792
793   /**
794    * Disable varying packing if used for transform feedback.  This is needed
795    * for some drivers (e.g. Panfrost) where transform feedback requires
796    * unpacked varyings.
797    *
798    * This variable is mutually exlusive with DisableVaryingPacking.
799    */
800   GLboolean DisableTransformFeedbackPacking;
801
802   /**
803    * Align varyings to POT in a slot
804    *
805    * Drivers that prefer varyings to be aligned to POT must set this value to GL_TRUE
806    */
807   GLboolean PreferPOTAlignedVaryings;
808
809
810   /**
811    * UBOs and SSBOs can be packed tightly by the OpenGL implementation when
812    * layout is set as shared (the default) or packed. However most Mesa drivers
813    * just use STD140 for these layouts. This flag allows drivers to use STD430
814    * for packed and shared layouts which allows arrays to be packed more
815    * tightly.
816    */
817   bool UseSTD430AsDefaultPacking;
818
819   /**
820    * Should meaningful names be generated for compiler temporary variables?
821    *
822    * Generally, it is not useful to have the compiler generate "meaningful"
823    * names for temporary variables that it creates.  This can, however, be a
824    * useful debugging aid.  In Mesa debug builds or release builds when
825    * MESA_GLSL is set at run-time, meaningful names will be generated.
826    * Drivers can also force names to be generated by setting this field.
827    * For example, the i965 driver may set it when INTEL_DEBUG=vs (to dump
828    * vertex shader assembly) is set at run-time.
829    */
830   bool GenerateTemporaryNames;
831
832   /*
833    * Maximum value supported for an index in DrawElements and friends.
834    *
835    * This must be at least (1ull<<24)-1.  The default value is
836    * (1ull<<32)-1.
837    *
838    * \since ES 3.0 or GL_ARB_ES3_compatibility
839    * \sa _mesa_init_constants
840    */
841   GLuint64 MaxElementIndex;
842
843   /**
844    * Disable interpretation of line continuations (lines ending with a
845    * backslash character ('\') in GLSL source.
846    */
847   GLboolean DisableGLSLLineContinuations;
848
849   /** GL_ARB_texture_multisample */
850   GLint MaxColorTextureSamples;
851   GLint MaxDepthTextureSamples;
852   GLint MaxIntegerSamples;
853
854   /** GL_AMD_framebuffer_multisample_advanced */
855   GLint MaxColorFramebufferSamples;
856   GLint MaxColorFramebufferStorageSamples;
857   GLint MaxDepthStencilFramebufferSamples;
858
859   /* An array of supported MSAA modes allowing different sample
860    * counts per attachment type.
861    */
862   struct {
863      GLint NumColorSamples;
864      GLint NumColorStorageSamples;
865      GLint NumDepthStencilSamples;
866   } SupportedMultisampleModes[40];
867   GLint NumSupportedMultisampleModes;
868
869   /** GL_ARB_shader_atomic_counters */
870   GLuint MaxAtomicBufferBindings;
871   GLuint MaxAtomicBufferSize;
872   GLuint MaxCombinedAtomicBuffers;
873   GLuint MaxCombinedAtomicCounters;
874
875   /** GL_ARB_vertex_attrib_binding */
876   GLint MaxVertexAttribRelativeOffset;
877   GLint MaxVertexAttribBindings;
878
879   /* GL_ARB_shader_image_load_store */
880   GLuint MaxImageUnits;
881   GLuint MaxCombinedShaderOutputResources;
882   GLuint MaxImageSamples;
883   GLuint MaxCombinedImageUniforms;
884
885   /** GL_ARB_compute_shader */
886   GLuint MaxComputeWorkGroupCount[3]; /* Array of x, y, z dimensions */
887   GLuint MaxComputeWorkGroupSize[3]; /* Array of x, y, z dimensions */
888   GLuint MaxComputeWorkGroupInvocations;
889   GLuint MaxComputeSharedMemorySize;
890
891   /** GL_ARB_compute_variable_group_size */
892   GLuint MaxComputeVariableGroupSize[3]; /* Array of x, y, z dimensions */
893   GLuint MaxComputeVariableGroupInvocations;
894
895   /** GL_ARB_gpu_shader5 */
896   GLfloat MinFragmentInterpolationOffset;
897   GLfloat MaxFragmentInterpolationOffset;
898
899   GLboolean FakeSWMSAA;
900
901   /** GL_KHR_context_flush_control */
902   GLenum16 ContextReleaseBehavior;
903
904   struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_STAGES];
905
906   /** GL_ARB_tessellation_shader */
907   GLuint MaxPatchVertices;
908   GLuint MaxTessGenLevel;
909   GLuint MaxTessPatchComponents;
910   GLuint MaxTessControlTotalOutputComponents;
911   bool LowerTessLevel; /**< Lower gl_TessLevel* from float[n] to vecn? */
912   bool PrimitiveRestartForPatches;
913   bool LowerCsDerivedVariables;    /**< Lower gl_GlobalInvocationID and
914                                     *   gl_LocalInvocationIndex based on
915                                     *   other builtin variables. */
916
917   /** GL_OES_primitive_bounding_box */
918   bool NoPrimitiveBoundingBoxOutput;
919
920   /** GL_ARB_sparse_buffer */
921   GLuint SparseBufferPageSize;
922
923   /** Used as an input for sha1 generation in the on-disk shader cache */
924   unsigned char *dri_config_options_sha1;
925
926   /** When drivers are OK with mapped buffers during draw and other calls. */
927   bool AllowMappedBuffersDuringExecution;
928
929   /**
930    * Whether buffer creation, unsynchronized mapping, unmapping, and
931    * deletion is thread-safe.
932    */
933   bool BufferCreateMapUnsynchronizedThreadSafe;
934
935   /** Override GL_MAP_UNSYNCHRONIZED_BIT */
936   bool ForceMapBufferSynchronized;
937
938   /** GL_ARB_get_program_binary */
939   GLuint NumProgramBinaryFormats;
940
941   /** GL_NV_conservative_raster */
942   GLuint MaxSubpixelPrecisionBiasBits;
943
944   /** GL_NV_conservative_raster_dilate */
945   GLfloat ConservativeRasterDilateRange[2];
946   GLfloat ConservativeRasterDilateGranularity;
947
948   /** Is the drivers uniform storage packed or padded to 16 bytes. */
949   bool PackedDriverUniformStorage;
950
951   /** Wether or not glBitmap uses red textures rather than alpha */
952   bool BitmapUsesRed;
953
954   /** Whether the vertex buffer offset is a signed 32-bit integer. */
955   bool VertexBufferOffsetIsInt32;
956
957   /** Whether out-of-order draw (Begin/End) optimizations are allowed. */
958   bool AllowDrawOutOfOrder;
959
960   /** Whether to allow the fast path for frequently updated VAOs. */
961   bool AllowDynamicVAOFastPath;
962
963   /** Whether the driver can support primitive restart with a fixed index.
964    * This is essentially a subset of NV_primitive_restart with enough support
965    * to be able to enable GLES 3.1. Some hardware can support this but not the
966    * full NV extension with arbitrary restart indices.
967    */
968   bool PrimitiveRestartFixedIndex;
969
970   /** GL_ARB_gl_spirv */
971   struct spirv_supported_capabilities SpirVCapabilities;
972
973   /** GL_ARB_spirv_extensions */
974   struct spirv_supported_extensions *SpirVExtensions;
975
976   char *VendorOverride;
977   char *RendererOverride;
978
979   /** Buffer size used to upload vertices from glBegin/glEnd. */
980   unsigned glBeginEndBufferSize;
981
982   /** Whether the driver doesn't want x/y/width/height clipped based on src size
983    *  when doing a copy texture operation (eg: may want out-of-bounds reads that
984    *  produce 0 instead of leaving the texture content undefined).
985    */
986   bool NoClippingOnCopyTex;
987
988   /**
989    * Force glthread to always return GL_FRAMEBUFFER_COMPLETE to prevent
990    * synchronization. Used for apps that call it every frame or multiple times
991    * a frame, but always getting framebuffer completeness.
992    */
993   bool GLThreadNopCheckFramebufferStatus;
994
995   /** GL_ARB_sparse_texture */
996   GLuint MaxSparseTextureSize;
997   GLuint MaxSparse3DTextureSize;
998   GLuint MaxSparseArrayTextureLayers;
999   bool SparseTextureFullArrayCubeMipmaps;
1000
1001   /** Use hardware accelerated GL_SELECT */
1002   bool HardwareAcceleratedSelect;
1003
1004   /** Origin of point coordinates. True if upper left, false if lower left. */
1005   bool PointCoordOriginUpperLeft;
1006};
1007#endif
1008