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 "util/glheader.h" 35 #include "compiler/shader_enums.h" 36 #include "compiler/shader_info.h" 37 38 struct nir_shader_compiler_options; 39 40 /** 41 * Enable flag for each OpenGL extension. Different device drivers will 42 * enable different extensions at runtime. 43 */ 44 struct 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_clip_control; 59 GLboolean ARB_color_buffer_float; 60 GLboolean ARB_compatibility; 61 GLboolean ARB_compute_shader; 62 GLboolean ARB_compute_variable_group_size; 63 GLboolean ARB_conditional_render_inverted; 64 GLboolean ARB_conservative_depth; 65 GLboolean ARB_copy_image; 66 GLboolean ARB_cull_distance; 67 GLboolean ARB_depth_buffer_float; 68 GLboolean ARB_depth_clamp; 69 GLboolean ARB_derivative_control; 70 GLboolean ARB_draw_buffers_blend; 71 GLboolean ARB_draw_elements_base_vertex; 72 GLboolean ARB_draw_indirect; 73 GLboolean ARB_draw_instanced; 74 GLboolean ARB_fragment_coord_conventions; 75 GLboolean ARB_fragment_layer_viewport; 76 GLboolean ARB_fragment_program; 77 GLboolean ARB_fragment_program_shadow; 78 GLboolean ARB_fragment_shader; 79 GLboolean ARB_framebuffer_no_attachments; 80 GLboolean ARB_framebuffer_object; 81 GLboolean ARB_fragment_shader_interlock; 82 GLboolean ARB_enhanced_layouts; 83 GLboolean ARB_explicit_attrib_location; 84 GLboolean ARB_explicit_uniform_location; 85 GLboolean ARB_gl_spirv; 86 GLboolean ARB_gpu_shader5; 87 GLboolean ARB_gpu_shader_fp64; 88 GLboolean ARB_gpu_shader_int64; 89 GLboolean ARB_half_float_vertex; 90 GLboolean ARB_indirect_parameters; 91 GLboolean ARB_instanced_arrays; 92 GLboolean ARB_internalformat_query; 93 GLboolean ARB_internalformat_query2; 94 GLboolean ARB_map_buffer_range; 95 GLboolean ARB_occlusion_query; 96 GLboolean ARB_occlusion_query2; 97 GLboolean ARB_pipeline_statistics_query; 98 GLboolean ARB_polygon_offset_clamp; 99 GLboolean ARB_post_depth_coverage; 100 GLboolean ARB_query_buffer_object; 101 GLboolean ARB_robust_buffer_access_behavior; 102 GLboolean ARB_sample_locations; 103 GLboolean ARB_sample_shading; 104 GLboolean ARB_seamless_cube_map; 105 GLboolean ARB_shader_atomic_counter_ops; 106 GLboolean ARB_shader_atomic_counters; 107 GLboolean ARB_shader_ballot; 108 GLboolean ARB_shader_bit_encoding; 109 GLboolean ARB_shader_clock; 110 GLboolean ARB_shader_draw_parameters; 111 GLboolean ARB_shader_group_vote; 112 GLboolean ARB_shader_image_load_store; 113 GLboolean ARB_shader_image_size; 114 GLboolean ARB_shader_precision; 115 GLboolean ARB_shader_stencil_export; 116 GLboolean ARB_shader_storage_buffer_object; 117 GLboolean ARB_shader_texture_image_samples; 118 GLboolean ARB_shader_texture_lod; 119 GLboolean ARB_shader_viewport_layer_array; 120 GLboolean ARB_shading_language_packing; 121 GLboolean ARB_shading_language_420pack; 122 GLboolean ARB_shadow; 123 GLboolean ARB_sparse_buffer; 124 GLboolean ARB_sparse_texture; 125 GLboolean ARB_sparse_texture2; 126 GLboolean ARB_sparse_texture_clamp; 127 GLboolean ARB_stencil_texturing; 128 GLboolean ARB_spirv_extensions; 129 GLboolean ARB_sync; 130 GLboolean ARB_tessellation_shader; 131 GLboolean ARB_texture_buffer_object; 132 GLboolean ARB_texture_buffer_object_rgb32; 133 GLboolean ARB_texture_buffer_range; 134 GLboolean ARB_texture_compression_bptc; 135 GLboolean ARB_texture_compression_rgtc; 136 GLboolean ARB_texture_cube_map_array; 137 GLboolean ARB_texture_filter_anisotropic; 138 GLboolean ARB_texture_filter_minmax; 139 GLboolean ARB_texture_float; 140 GLboolean ARB_texture_gather; 141 GLboolean ARB_texture_mirror_clamp_to_edge; 142 GLboolean ARB_texture_multisample; 143 GLboolean ARB_texture_non_power_of_two; 144 GLboolean ARB_texture_stencil8; 145 GLboolean ARB_texture_query_levels; 146 GLboolean ARB_texture_query_lod; 147 GLboolean ARB_texture_rg; 148 GLboolean ARB_texture_rgb10_a2ui; 149 GLboolean ARB_texture_view; 150 GLboolean ARB_timer_query; 151 GLboolean ARB_transform_feedback2; 152 GLboolean ARB_transform_feedback3; 153 GLboolean ARB_transform_feedback_instanced; 154 GLboolean ARB_transform_feedback_overflow_query; 155 GLboolean ARB_uniform_buffer_object; 156 GLboolean ARB_vertex_attrib_64bit; 157 GLboolean ARB_vertex_program; 158 GLboolean ARB_vertex_shader; 159 GLboolean ARB_vertex_type_10f_11f_11f_rev; 160 GLboolean ARB_vertex_type_2_10_10_10_rev; 161 GLboolean ARB_viewport_array; 162 GLboolean EXT_blend_equation_separate; 163 GLboolean EXT_color_buffer_float; 164 GLboolean EXT_color_buffer_half_float; 165 GLboolean EXT_demote_to_helper_invocation; 166 GLboolean EXT_depth_bounds_test; 167 GLboolean EXT_disjoint_timer_query; 168 GLboolean EXT_draw_buffers2; 169 GLboolean EXT_EGL_image_storage; 170 GLboolean EXT_float_blend; 171 GLboolean EXT_framebuffer_multisample; 172 GLboolean EXT_framebuffer_multisample_blit_scaled; 173 GLboolean EXT_framebuffer_sRGB; 174 GLboolean EXT_gpu_program_parameters; 175 GLboolean EXT_gpu_shader4; 176 GLboolean EXT_memory_object; 177 GLboolean EXT_memory_object_fd; 178 GLboolean EXT_memory_object_win32; 179 GLboolean EXT_multisampled_render_to_texture; 180 GLboolean EXT_packed_float; 181 GLboolean EXT_provoking_vertex; 182 GLboolean EXT_render_snorm; 183 GLboolean EXT_semaphore; 184 GLboolean EXT_semaphore_fd; 185 GLboolean EXT_semaphore_win32; 186 GLboolean EXT_shader_image_load_formatted; 187 GLboolean EXT_shader_image_load_store; 188 GLboolean EXT_shader_integer_mix; 189 GLboolean EXT_shader_samples_identical; 190 GLboolean EXT_sRGB; 191 GLboolean EXT_stencil_two_side; 192 GLboolean EXT_shadow_samplers; 193 GLboolean EXT_texture_array; 194 GLboolean EXT_texture_buffer_object; 195 GLboolean EXT_texture_compression_astc_decode_mode; 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 GLboolean OVR_multiview; 227 GLboolean OVR_multiview2; 228 GLboolean OVR_multiview_multisampled_render_to_texture; 229 /* vendor extensions */ 230 GLboolean AMD_compressed_ATC_texture; 231 GLboolean AMD_framebuffer_multisample_advanced; 232 GLboolean AMD_depth_clamp_separate; 233 GLboolean AMD_gpu_shader_half_float; 234 GLboolean AMD_performance_monitor; 235 GLboolean AMD_pinned_memory; 236 GLboolean AMD_seamless_cubemap_per_texture; 237 GLboolean AMD_vertex_shader_layer; 238 GLboolean AMD_vertex_shader_viewport_index; 239 GLboolean ANDROID_extension_pack_es31a; 240 GLboolean ARM_shader_framebuffer_fetch_depth_stencil; 241 GLboolean ATI_meminfo; 242 GLboolean ATI_texture_compression_3dc; 243 GLboolean ATI_texture_mirror_once; 244 GLboolean ATI_texture_env_combine3; 245 GLboolean ATI_fragment_shader; 246 GLboolean GREMEDY_string_marker; 247 GLboolean INTEL_blackhole_render; 248 GLboolean INTEL_conservative_rasterization; 249 GLboolean INTEL_performance_query; 250 GLboolean INTEL_shader_atomic_float_minmax; 251 GLboolean INTEL_shader_integer_functions2; 252 GLboolean KHR_blend_equation_advanced; 253 GLboolean KHR_blend_equation_advanced_coherent; 254 GLboolean KHR_robustness; 255 GLboolean KHR_shader_subgroup; 256 GLboolean KHR_texture_compression_astc_hdr; 257 GLboolean KHR_texture_compression_astc_ldr; 258 GLboolean KHR_texture_compression_astc_sliced_3d; 259 GLboolean MESA_framebuffer_flip_y; 260 GLboolean MESA_texture_const_bandwidth; 261 GLboolean MESA_pack_invert; 262 GLboolean MESA_tile_raster_order; 263 GLboolean EXT_shader_framebuffer_fetch; 264 GLboolean EXT_shader_framebuffer_fetch_non_coherent; 265 GLboolean MESA_shader_integer_functions; 266 GLboolean MESA_window_pos; 267 GLboolean MESA_ycbcr_texture; 268 GLboolean NV_alpha_to_coverage_dither_control; 269 GLboolean NV_compute_shader_derivatives; 270 GLboolean NV_conditional_render; 271 GLboolean NV_copy_depth_to_color; 272 GLboolean NV_copy_image; 273 GLboolean NV_fill_rectangle; 274 GLboolean NV_fog_distance; 275 GLboolean NV_primitive_restart; 276 GLboolean NV_shader_atomic_float; 277 GLboolean NV_shader_atomic_int64; 278 GLboolean NV_texture_barrier; 279 GLboolean NV_texture_env_combine4; 280 GLboolean NV_texture_rectangle; 281 GLboolean NV_vdpau_interop; 282 GLboolean NV_conservative_raster; 283 GLboolean NV_conservative_raster_dilate; 284 GLboolean NV_conservative_raster_pre_snap_triangles; 285 GLboolean NV_conservative_raster_pre_snap; 286 GLboolean NV_viewport_array2; 287 GLboolean NV_viewport_swizzle; 288 GLboolean NVX_gpu_memory_info; 289 GLboolean TDFX_texture_compression_FXT1; 290 GLboolean OES_EGL_image; 291 GLboolean OES_draw_texture; 292 GLboolean OES_depth_texture_cube_map; 293 GLboolean OES_EGL_image_external; 294 GLboolean OES_texture_3D; 295 GLboolean OES_texture_float; 296 GLboolean OES_texture_float_linear; 297 GLboolean OES_texture_half_float; 298 GLboolean OES_texture_half_float_linear; 299 GLboolean OES_compressed_ETC1_RGB8_texture; 300 GLboolean OES_geometry_shader; 301 GLboolean OES_texture_compression_astc; 302 GLboolean extension_sentinel; 303 /** The extension string */ 304 const GLubyte *String; 305 /** Number of supported extensions */ 306 GLuint Count; 307 /** 308 * The context version which extension helper functions compare against. 309 * By default, the value is equal to ctx->Version. This changes to ~0 310 * while meta is in progress. 311 */ 312 GLubyte Version; 313 }; 314 315 /** 316 * Compiler options for a single GLSL shaders type 317 */ 318 struct gl_shader_compiler_options 319 { 320 /** Driver-selectable options: */ 321 GLboolean EmitNoCont; /**< Emit CONT opcode? */ 322 GLboolean EmitNoMainReturn; /**< Emit CONT/RET opcodes? */ 323 GLbitfield LowerBuiltinVariablesXfb; /**< Which builtin variables should 324 * be lowered for transform feedback 325 **/ 326 327 /** 328 * If we can lower the precision of variables based on precision 329 * qualifiers 330 */ 331 GLboolean LowerPrecisionFloat16; 332 GLboolean LowerPrecisionInt16; 333 GLboolean LowerPrecisionDerivatives; 334 GLboolean LowerPrecisionFloat16Uniforms; 335 336 /** 337 * This enables lowering of 16b constants. Some drivers may not 338 * to lower constants to 16b (ie. if the hw can do automatic 339 * narrowing on constant load) 340 */ 341 GLboolean LowerPrecisionConstants; 342 343 /** 344 * \name Forms of indirect addressing the driver cannot do. 345 */ 346 /*@{*/ 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 */ 377 struct 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 */ 387 struct 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 /* For shaders */ 402 GLuint MaxUniformComponents; /**< Usually == MaxParameters * 4 */ 403 404 /** 405 * \name Per-stage input / output limits 406 * 407 * Previous to OpenGL 3.2, the intrastage data limits were advertised with 408 * a single value: GL_MAX_VARYING_COMPONENTS (GL_MAX_VARYING_VECTORS in 409 * ES). This is stored as \c gl_constants::MaxVarying. 410 * 411 * Starting with OpenGL 3.2, the limits are advertised with per-stage 412 * variables. Each stage as a certain number of outputs that it can feed 413 * to the next stage and a certain number inputs that it can consume from 414 * the previous stage. 415 * 416 * Vertex shader inputs do not participate this in this accounting. 417 * These are tracked exclusively by \c gl_program_constants::MaxAttribs. 418 * 419 * Fragment shader outputs do not participate this in this accounting. 420 * These are tracked exclusively by \c gl_constants::MaxDrawBuffers. 421 */ 422 /*@{*/ 423 GLuint MaxInputComponents; 424 GLuint MaxOutputComponents; 425 /*@}*/ 426 427 /* ES 2.0 and GL_ARB_ES2_compatibility */ 428 struct gl_precision LowFloat, MediumFloat, HighFloat; 429 struct gl_precision LowInt, MediumInt, HighInt; 430 /* GL_ARB_uniform_buffer_object */ 431 GLuint MaxUniformBlocks; 432 uint64_t MaxCombinedUniformComponents; 433 GLuint MaxTextureImageUnits; 434 435 /* GL_ARB_shader_atomic_counters */ 436 GLuint MaxAtomicBuffers; 437 GLuint MaxAtomicCounters; 438 439 /* GL_ARB_shader_image_load_store */ 440 GLuint MaxImageUniforms; 441 442 /* GL_ARB_shader_storage_buffer_object */ 443 GLuint MaxShaderStorageBlocks; 444 }; 445 446 /** 447 * Constants which may be overridden by device driver during context creation 448 * but are never changed after that. 449 */ 450 struct gl_constants 451 { 452 /** 453 * Bitmask of valid primitive types supported by the driver, 454 */ 455 GLbitfield DriverSupportedPrimMask; 456 457 GLuint MaxTextureMbytes; /**< Max memory per image, in MB */ 458 GLuint MaxTextureSize; /**< Max 1D/2D texture size, in pixels*/ 459 GLuint Max3DTextureLevels; /**< Max mipmap levels for 3D textures */ 460 GLuint MaxCubeTextureLevels; /**< Max mipmap levels for cube textures */ 461 GLuint MaxArrayTextureLayers; /**< Max layers in array textures */ 462 GLuint MaxTextureRectSize; /**< Max rectangle texture size, in pixes */ 463 GLuint MaxTextureCoordUnits; 464 GLuint MaxCombinedTextureImageUnits; 465 GLuint MaxTextureUnits; /**< = MIN(CoordUnits, FragmentProgram.ImageUnits) */ 466 GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ 467 GLfloat MaxTextureLodBias; /**< GL_EXT_texture_lod_bias */ 468 GLuint MaxTextureBufferSize; /**< GL_ARB_texture_buffer_object */ 469 470 GLuint TextureBufferOffsetAlignment; /**< GL_ARB_texture_buffer_range */ 471 472 GLuint MaxArrayLockSize; 473 474 GLint SubPixelBits; 475 476 GLfloat MinPointSize, MaxPointSize; /**< aliased */ 477 GLfloat MinPointSizeAA, MaxPointSizeAA; /**< antialiased */ 478 GLfloat PointSizeGranularity; 479 GLfloat MinLineWidth, MaxLineWidth; /**< aliased */ 480 GLfloat MinLineWidthAA, MaxLineWidthAA; /**< antialiased */ 481 GLfloat LineWidthGranularity; 482 483 GLuint MaxClipPlanes; 484 GLuint MaxLights; 485 GLfloat MaxShininess; /**< GL_NV_light_max_exponent */ 486 GLfloat MaxSpotExponent; /**< GL_NV_light_max_exponent */ 487 488 GLuint MaxViewportWidth, MaxViewportHeight; 489 GLuint MaxViewports; /**< GL_ARB_viewport_array */ 490 GLuint ViewportSubpixelBits; /**< GL_ARB_viewport_array */ 491 struct { 492 GLfloat Min; 493 GLfloat Max; 494 } ViewportBounds; /**< GL_ARB_viewport_array */ 495 GLuint MaxWindowRectangles; /**< GL_EXT_window_rectangles */ 496 497 struct gl_program_constants Program[MESA_SHADER_STAGES]; 498 GLuint MaxProgramMatrices; 499 GLuint MaxProgramMatrixStackDepth; 500 501 struct { 502 GLuint SamplesPassed; 503 GLuint TimeElapsed; 504 GLuint Timestamp; 505 GLuint PrimitivesGenerated; 506 GLuint PrimitivesWritten; 507 GLuint VerticesSubmitted; 508 GLuint PrimitivesSubmitted; 509 GLuint VsInvocations; 510 GLuint TessPatches; 511 GLuint TessInvocations; 512 GLuint GsInvocations; 513 GLuint GsPrimitives; 514 GLuint FsInvocations; 515 GLuint ComputeInvocations; 516 GLuint ClInPrimitives; 517 GLuint ClOutPrimitives; 518 } QueryCounterBits; 519 520 GLuint MaxDrawBuffers; /**< GL_ARB_draw_buffers */ 521 522 GLuint MaxColorAttachments; /**< GL_EXT_framebuffer_object */ 523 GLuint MaxRenderbufferSize; /**< GL_EXT_framebuffer_object */ 524 GLuint MaxSamples; /**< GL_ARB_framebuffer_object */ 525 526 /** 527 * GL_ARB_framebuffer_no_attachments 528 */ 529 GLuint MaxFramebufferWidth; 530 GLuint MaxFramebufferHeight; 531 GLuint MaxFramebufferLayers; 532 GLuint MaxFramebufferSamples; 533 534 /** Number of varying vectors between any two shader stages. */ 535 GLuint MaxVarying; 536 537 /** @{ 538 * GL_ARB_uniform_buffer_object 539 */ 540 GLuint MaxCombinedUniformBlocks; 541 GLuint MaxUniformBufferBindings; 542 GLuint MaxUniformBlockSize; 543 GLuint UniformBufferOffsetAlignment; 544 /** @} */ 545 546 /** @{ 547 * GL_ARB_shader_storage_buffer_object 548 */ 549 GLuint MaxCombinedShaderStorageBlocks; 550 GLuint MaxShaderStorageBufferBindings; 551 GLuint MaxShaderStorageBlockSize; 552 GLuint ShaderStorageBufferOffsetAlignment; 553 /** @} */ 554 555 /** 556 * GL_ARB_explicit_uniform_location 557 */ 558 GLuint MaxUserAssignableUniformLocations; 559 560 /** geometry shader */ 561 GLuint MaxGeometryOutputVertices; 562 GLuint MaxGeometryTotalOutputComponents; 563 GLuint MaxGeometryShaderInvocations; 564 565 GLuint GLSLVersion; /**< Desktop GLSL version supported (ex: 120 = 1.20) */ 566 GLuint GLSLVersionCompat; /**< Desktop compat GLSL version supported */ 567 568 /** 569 * Changes default GLSL extension behavior from "error" to "warn". It's out 570 * of spec, but it can make some apps work that otherwise wouldn't. 571 */ 572 GLboolean ForceGLSLExtensionsWarn; 573 574 /** 575 * Force all shaders to behave as if they were declared with the 576 * compatibility token. 577 */ 578 GLboolean ForceCompatShaders; 579 580 /** 581 * If non-zero, forces GLSL shaders to behave as if they began 582 * with "#version ForceGLSLVersion". 583 */ 584 GLuint ForceGLSLVersion; 585 586 /** 587 * Allow GLSL #extension directives in the middle of shaders. 588 */ 589 GLboolean AllowGLSLExtensionDirectiveMidShader; 590 591 /** 592 * Allow a subset of GLSL 1.20 in GLSL 1.10 as needed by SPECviewperf13. 593 */ 594 GLboolean AllowGLSL120SubsetIn110; 595 596 /** 597 * Allow builtins as part of constant expressions. This was not allowed 598 * until GLSL 1.20 this allows it everywhere. 599 */ 600 GLboolean AllowGLSLBuiltinConstantExpression; 601 602 /** 603 * Allow some relaxation of GLSL ES shader restrictions. This encompasses 604 * a number of relaxations to the ES shader rules. 605 */ 606 GLboolean AllowGLSLRelaxedES; 607 608 /** 609 * Allow GLSL built-in variables to be redeclared verbatim 610 */ 611 GLboolean AllowGLSLBuiltinVariableRedeclaration; 612 613 /** 614 * Allow GLSL interpolation qualifier mismatch across shader stages. 615 */ 616 GLboolean AllowGLSLCrossStageInterpolationMismatch; 617 618 /** 619 * Allow creating a higher compat profile (version 3.1+) for apps that 620 * request it. Be careful when adding that driconf option because some 621 * features are unimplemented and might not work correctly. 622 */ 623 GLboolean AllowHigherCompatVersion; 624 625 /** 626 * Allow GLSL shaders with the compatibility version directive 627 * in non-compatibility profiles. (for shader-db) 628 */ 629 GLboolean AllowGLSLCompatShaders; 630 631 /** 632 * Allow extra tokens at end of preprocessor directives. The CTS now tests 633 * to make sure these are not allowed. However, previously drivers would 634 * allow them to exist and just issue a warning so some old applications 635 * depend on this. 636 */ 637 GLboolean AllowExtraPPTokens; 638 639 /** 640 * The spec forbids a shader to "statically write both gl_ClipVertex 641 * and gl_ClipDistance". 642 * This option adds a tolerance for shader that statically writes to 643 * both but at least one of the write can be removed by a dead code 644 * elimination pass. 645 */ 646 GLboolean DoDCEBeforeClipCullAnalysis; 647 648 /** 649 * Force computing the absolute value for sqrt() and inversesqrt() to follow 650 * D3D9 when apps rely on this behaviour. 651 */ 652 GLboolean ForceGLSLAbsSqrt; 653 654 /** 655 * Forces the GLSL compiler to ignore writes to readonly vars rather than 656 * throwing an error. 657 */ 658 GLboolean GLSLIgnoreWriteToReadonlyVar; 659 660 /** 661 * Types of variable to default initialized to zero. Supported values are: 662 * - 0: no zero initialization 663 * - 1: all shader variables and gl_FragColor are initialiazed to 0 664 * - 2: same as 1, but shader out variables are *not* initialized, while 665 * function out variables are now initialized. 666 */ 667 GLchar GLSLZeroInit; 668 669 /** 670 * Treat integer textures using GL_LINEAR filters as GL_NEAREST. 671 */ 672 GLboolean ForceIntegerTexNearest; 673 674 /** 675 * Treat 32-bit floating-point textures using GL_LINEAR filters as 676 * GL_NEAREST. 677 */ 678 GLboolean ForceFloat32TexNearest; 679 680 /** 681 * Does the driver support real 32-bit integers? (Otherwise, integers are 682 * simulated via floats.) 683 */ 684 GLboolean NativeIntegers; 685 686 /** 687 * If the driver supports real 32-bit integers, what integer value should be 688 * used for boolean true in uniform uploads? (Usually 1 or ~0.) 689 */ 690 GLuint UniformBooleanTrue; 691 692 /** 693 * Maximum amount of time, measured in nanseconds, that the server can wait. 694 */ 695 GLuint64 MaxServerWaitTimeout; 696 697 /** GL_EXT_provoking_vertex */ 698 GLboolean QuadsFollowProvokingVertexConvention; 699 700 /** GL_ARB_viewport_array */ 701 GLenum16 LayerAndVPIndexProvokingVertex; 702 703 /** OpenGL version 3.0 */ 704 GLbitfield ContextFlags; /**< Ex: GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */ 705 706 /** OpenGL version 3.2 */ 707 GLbitfield ProfileMask; /**< Mask of CONTEXT_x_PROFILE_BIT */ 708 709 /** OpenGL version 4.4 */ 710 GLuint MaxVertexAttribStride; 711 712 /** GL_EXT_transform_feedback */ 713 GLuint MaxTransformFeedbackBuffers; 714 GLuint MaxTransformFeedbackSeparateComponents; 715 GLuint MaxTransformFeedbackInterleavedComponents; 716 GLuint MaxVertexStreams; 717 718 /** GL_EXT_gpu_shader4 */ 719 GLint MinProgramTexelOffset, MaxProgramTexelOffset; 720 721 /** GL_ARB_texture_gather */ 722 GLuint MinProgramTextureGatherOffset; 723 GLuint MaxProgramTextureGatherOffset; 724 GLuint MaxProgramTextureGatherComponents; 725 726 /* GL_ARB_robustness */ 727 GLenum16 ResetStrategy; 728 729 /* GL_KHR_robustness */ 730 GLboolean RobustAccess; 731 732 /* GL_ARB_blend_func_extended */ 733 GLuint MaxDualSourceDrawBuffers; 734 735 /** 736 * For drivers which can do a better job at eliminating unused uniforms 737 * than the GLSL compiler. 738 * 739 * XXX Remove these as soon as a better solution is available. 740 */ 741 GLboolean GLSLSkipStrictMaxUniformLimitCheck; 742 743 GLboolean GLSLHasHalfFloatPacking; 744 745 /** 746 * Whether gl_FragCoord, gl_PointCoord and gl_FrontFacing 747 * are system values. 748 **/ 749 bool GLSLFragCoordIsSysVal; 750 bool GLSLPointCoordIsSysVal; 751 bool GLSLFrontFacingIsSysVal; 752 753 /** 754 * Whether to call lower_const_arrays_to_uniforms() during linking. 755 */ 756 bool GLSLLowerConstArrays; 757 758 /** 759 * True if gl_TessLevelInner/Outer[] in the TES should be inputs 760 * (otherwise, they're system values). 761 */ 762 bool GLSLTessLevelsAsInputs; 763 764 /** GL_ARB_map_buffer_alignment */ 765 GLuint MinMapBufferAlignment; 766 767 /** 768 * Disable varying packing. This is out of spec, but potentially useful 769 * for older platforms that supports a limited number of texture 770 * indirections--on these platforms, unpacking the varyings in the fragment 771 * shader increases the number of texture indirections by 1, which might 772 * make some shaders not executable at all. 773 * 774 * Drivers that support transform feedback must set this value to GL_FALSE. 775 */ 776 GLboolean DisableVaryingPacking; 777 778 /** 779 * Disable varying packing if used for transform feedback. This is needed 780 * for some drivers (e.g. Panfrost) where transform feedback requires 781 * unpacked varyings. 782 * 783 * This variable is mutually exlusive with DisableVaryingPacking. 784 */ 785 GLboolean DisableTransformFeedbackPacking; 786 787 /** 788 * Disable the glsl optimisation that resizes uniform arrays. 789 */ 790 bool DisableUniformArrayResize; 791 792 /** 793 * Alias extension e.g. GL_ATI_shader_texture_lod to GL_ARB_shader_texture_lod. 794 */ 795 char *AliasShaderExtension; 796 797 /** 798 * Allow fs-only bias argument in vertex shaders. 799 */ 800 GLboolean AllowVertexTextureBias; 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 PrimitiveRestartForPatches; 912 913 /** GL_OES_primitive_bounding_box */ 914 bool NoPrimitiveBoundingBoxOutput; 915 916 /** GL_ARB_sparse_buffer */ 917 GLuint SparseBufferPageSize; 918 919 /** Used as an input for sha1 generation in the on-disk shader cache */ 920 unsigned char *dri_config_options_sha1; 921 922 /** When drivers are OK with mapped buffers during draw and other calls. */ 923 bool AllowMappedBuffersDuringExecution; 924 925 /** Override GL_MAP_UNSYNCHRONIZED_BIT */ 926 bool ForceMapBufferSynchronized; 927 928 /** GL_ARB_get_program_binary */ 929 GLuint NumProgramBinaryFormats; 930 931 /** GL_ARB_gl_spirv */ 932 GLuint NumShaderBinaryFormats; 933 934 /** GL_NV_conservative_raster */ 935 GLuint MaxSubpixelPrecisionBiasBits; 936 937 /** GL_NV_conservative_raster_dilate */ 938 GLfloat ConservativeRasterDilateRange[2]; 939 GLfloat ConservativeRasterDilateGranularity; 940 941 /** Is the drivers uniform storage packed or padded to 16 bytes. */ 942 bool PackedDriverUniformStorage; 943 944 bool HasFBFetch; 945 946 bool PointSizeFixed; 947 948 /** Wether or not glBitmap uses red textures rather than alpha */ 949 bool BitmapUsesRed; 950 951 /** Whether the vertex buffer offset is a signed 32-bit integer. */ 952 bool VertexBufferOffsetIsInt32; 953 954 /** Whether out-of-order draw (Begin/End) optimizations are allowed. */ 955 bool AllowDrawOutOfOrder; 956 957 /** Whether to force the fast path for binding VAOs. It has much lower 958 * overhead due to not spending CPU cycles on trying to find interleaved 959 * vertex attribs and binding them. 960 */ 961 bool UseVAOFastPath; 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_spirv_extensions */ 971 struct spirv_supported_extensions *SpirVExtensions; 972 973 char *VendorOverride; 974 char *RendererOverride; 975 976 /** Buffer size used to upload vertices from glBegin/glEnd. */ 977 unsigned glBeginEndBufferSize; 978 979 /** Whether the driver doesn't want x/y/width/height clipped based on src size 980 * when doing a copy texture operation (eg: may want out-of-bounds reads that 981 * produce 0 instead of leaving the texture content undefined). 982 */ 983 bool NoClippingOnCopyTex; 984 985 /** 986 * Force glthread to always return GL_FRAMEBUFFER_COMPLETE to prevent 987 * synchronization. Used for apps that call it every frame or multiple times 988 * a frame, but always getting framebuffer completeness. 989 */ 990 bool GLThreadNopCheckFramebufferStatus; 991 992 /** GL_ARB_sparse_texture */ 993 GLuint MaxSparseTextureSize; 994 GLuint MaxSparse3DTextureSize; 995 GLuint MaxSparseArrayTextureLayers; 996 bool SparseTextureFullArrayCubeMipmaps; 997 998 /** Use hardware accelerated GL_SELECT */ 999 bool HardwareAcceleratedSelect; 1000 1001 /** Allow GLThread to convert glBuffer */ 1002 bool AllowGLThreadBufferSubDataOpt; 1003 1004 /** Whether pipe_context::draw_vertex_state is supported. */ 1005 bool HasDrawVertexState; 1006 1007 /** GL_KHR_shader_subgroup */ 1008 GLuint ShaderSubgroupSize; 1009 GLuint ShaderSubgroupSupportedStages; 1010 GLuint ShaderSubgroupSupportedFeatures; 1011 bool ShaderSubgroupQuadAllStages; 1012 }; 1013 1014 #endif 1015