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 /* vendor extensions */ 229 GLboolean AMD_compressed_ATC_texture; 230 GLboolean AMD_framebuffer_multisample_advanced; 231 GLboolean AMD_depth_clamp_separate; 232 GLboolean AMD_gpu_shader_half_float; 233 GLboolean AMD_performance_monitor; 234 GLboolean AMD_pinned_memory; 235 GLboolean AMD_seamless_cubemap_per_texture; 236 GLboolean AMD_vertex_shader_layer; 237 GLboolean AMD_vertex_shader_viewport_index; 238 GLboolean ANDROID_extension_pack_es31a; 239 GLboolean ARM_shader_framebuffer_fetch_depth_stencil; 240 GLboolean ATI_meminfo; 241 GLboolean ATI_texture_compression_3dc; 242 GLboolean ATI_texture_mirror_once; 243 GLboolean ATI_texture_env_combine3; 244 GLboolean ATI_fragment_shader; 245 GLboolean GREMEDY_string_marker; 246 GLboolean INTEL_blackhole_render; 247 GLboolean INTEL_conservative_rasterization; 248 GLboolean INTEL_performance_query; 249 GLboolean INTEL_shader_atomic_float_minmax; 250 GLboolean INTEL_shader_integer_functions2; 251 GLboolean KHR_blend_equation_advanced; 252 GLboolean KHR_blend_equation_advanced_coherent; 253 GLboolean KHR_robustness; 254 GLboolean KHR_shader_subgroup; 255 GLboolean KHR_texture_compression_astc_hdr; 256 GLboolean KHR_texture_compression_astc_ldr; 257 GLboolean KHR_texture_compression_astc_sliced_3d; 258 GLboolean MESA_framebuffer_flip_y; 259 GLboolean MESA_texture_const_bandwidth; 260 GLboolean MESA_pack_invert; 261 GLboolean MESA_tile_raster_order; 262 GLboolean EXT_shader_framebuffer_fetch; 263 GLboolean EXT_shader_framebuffer_fetch_non_coherent; 264 GLboolean MESA_shader_integer_functions; 265 GLboolean MESA_window_pos; 266 GLboolean MESA_ycbcr_texture; 267 GLboolean NV_alpha_to_coverage_dither_control; 268 GLboolean NV_compute_shader_derivatives; 269 GLboolean NV_conditional_render; 270 GLboolean NV_copy_depth_to_color; 271 GLboolean NV_copy_image; 272 GLboolean NV_fill_rectangle; 273 GLboolean NV_fog_distance; 274 GLboolean NV_primitive_restart; 275 GLboolean NV_shader_atomic_float; 276 GLboolean NV_shader_atomic_int64; 277 GLboolean NV_texture_barrier; 278 GLboolean NV_texture_env_combine4; 279 GLboolean NV_texture_rectangle; 280 GLboolean NV_vdpau_interop; 281 GLboolean NV_conservative_raster; 282 GLboolean NV_conservative_raster_dilate; 283 GLboolean NV_conservative_raster_pre_snap_triangles; 284 GLboolean NV_conservative_raster_pre_snap; 285 GLboolean NV_viewport_array2; 286 GLboolean NV_viewport_swizzle; 287 GLboolean NVX_gpu_memory_info; 288 GLboolean TDFX_texture_compression_FXT1; 289 GLboolean OES_EGL_image; 290 GLboolean OES_draw_texture; 291 GLboolean OES_depth_texture_cube_map; 292 GLboolean OES_EGL_image_external; 293 GLboolean OES_texture_3D; 294 GLboolean OES_texture_float; 295 GLboolean OES_texture_float_linear; 296 GLboolean OES_texture_half_float; 297 GLboolean OES_texture_half_float_linear; 298 GLboolean OES_compressed_ETC1_RGB8_texture; 299 GLboolean OES_geometry_shader; 300 GLboolean OES_texture_compression_astc; 301 GLboolean extension_sentinel; 302 /** The extension string */ 303 const GLubyte *String; 304 /** Number of supported extensions */ 305 GLuint Count; 306 /** 307 * The context version which extension helper functions compare against. 308 * By default, the value is equal to ctx->Version. This changes to ~0 309 * while meta is in progress. 310 */ 311 GLubyte Version; 312 }; 313 314 /** 315 * Compiler options for a single GLSL shaders type 316 */ 317 struct gl_shader_compiler_options 318 { 319 /** Driver-selectable options: */ 320 GLboolean EmitNoCont; /**< Emit CONT opcode? */ 321 GLboolean EmitNoMainReturn; /**< Emit CONT/RET opcodes? */ 322 GLbitfield LowerBuiltinVariablesXfb; /**< Which builtin variables should 323 * be lowered for transform feedback 324 **/ 325 326 /** 327 * If we can lower the precision of variables based on precision 328 * qualifiers 329 */ 330 GLboolean LowerPrecisionFloat16; 331 GLboolean LowerPrecisionInt16; 332 GLboolean LowerPrecisionDerivatives; 333 GLboolean LowerPrecisionFloat16Uniforms; 334 335 /** 336 * This enables lowering of 16b constants. Some drivers may not 337 * to lower constants to 16b (ie. if the hw can do automatic 338 * narrowing on constant load) 339 */ 340 GLboolean LowerPrecisionConstants; 341 342 /** 343 * \name Forms of indirect addressing the driver cannot do. 344 */ 345 /*@{*/ 346 GLboolean EmitNoIndirectInput; /**< No indirect addressing of inputs */ 347 GLboolean EmitNoIndirectOutput; /**< No indirect addressing of outputs */ 348 GLboolean EmitNoIndirectTemp; /**< No indirect addressing of temps */ 349 GLboolean EmitNoIndirectUniform; /**< No indirect addressing of constants */ 350 /*@}*/ 351 352 GLuint MaxIfDepth; /**< Maximum nested IF blocks */ 353 354 /** 355 * Optimize code for array of structures backends. 356 * 357 * This is a proxy for: 358 * - preferring DP4 instructions (rather than MUL/MAD) for 359 * matrix * vector operations, such as position transformation. 360 */ 361 GLboolean OptimizeForAOS; 362 363 /** Clamp UBO and SSBO block indices so they don't go out-of-bounds. */ 364 GLboolean ClampBlockIndicesToArrayBounds; 365 366 /** (driconf) Force gl_Position to be considered invariant */ 367 GLboolean PositionAlwaysInvariant; 368 369 /** (driconf) Force gl_Position to be considered precise */ 370 GLboolean PositionAlwaysPrecise; 371 372 const struct nir_shader_compiler_options *NirOptions; 373 }; 374 375 /** 376 * Precision info for shader datatypes. See glGetShaderPrecisionFormat(). 377 */ 378 struct gl_precision 379 { 380 GLushort RangeMin; /**< min value exponent */ 381 GLushort RangeMax; /**< max value exponent */ 382 GLushort Precision; /**< number of mantissa bits */ 383 }; 384 385 /** 386 * Limits for vertex, geometry and fragment programs/shaders. 387 */ 388 struct gl_program_constants 389 { 390 /* logical limits */ 391 GLuint MaxInstructions; 392 GLuint MaxAluInstructions; 393 GLuint MaxTexInstructions; 394 GLuint MaxTexIndirections; 395 GLuint MaxAttribs; 396 GLuint MaxTemps; 397 GLuint MaxAddressRegs; 398 GLuint MaxAddressOffset; /**< [-MaxAddressOffset, MaxAddressOffset-1] */ 399 GLuint MaxParameters; 400 GLuint MaxLocalParams; 401 GLuint MaxEnvParams; 402 /* native/hardware limits */ 403 GLuint MaxNativeInstructions; 404 GLuint MaxNativeAluInstructions; 405 GLuint MaxNativeTexInstructions; 406 GLuint MaxNativeTexIndirections; 407 GLuint MaxNativeAttribs; 408 GLuint MaxNativeTemps; 409 GLuint MaxNativeAddressRegs; 410 GLuint MaxNativeParameters; 411 /* For shaders */ 412 GLuint MaxUniformComponents; /**< Usually == MaxParameters * 4 */ 413 414 /** 415 * \name Per-stage input / output limits 416 * 417 * Previous to OpenGL 3.2, the intrastage data limits were advertised with 418 * a single value: GL_MAX_VARYING_COMPONENTS (GL_MAX_VARYING_VECTORS in 419 * ES). This is stored as \c gl_constants::MaxVarying. 420 * 421 * Starting with OpenGL 3.2, the limits are advertised with per-stage 422 * variables. Each stage as a certain number of outputs that it can feed 423 * to the next stage and a certain number inputs that it can consume from 424 * the previous stage. 425 * 426 * Vertex shader inputs do not participate this in this accounting. 427 * These are tracked exclusively by \c gl_program_constants::MaxAttribs. 428 * 429 * Fragment shader outputs do not participate this in this accounting. 430 * These are tracked exclusively by \c gl_constants::MaxDrawBuffers. 431 */ 432 /*@{*/ 433 GLuint MaxInputComponents; 434 GLuint MaxOutputComponents; 435 /*@}*/ 436 437 /* ES 2.0 and GL_ARB_ES2_compatibility */ 438 struct gl_precision LowFloat, MediumFloat, HighFloat; 439 struct gl_precision LowInt, MediumInt, HighInt; 440 /* GL_ARB_uniform_buffer_object */ 441 GLuint MaxUniformBlocks; 442 uint64_t MaxCombinedUniformComponents; 443 GLuint MaxTextureImageUnits; 444 445 /* GL_ARB_shader_atomic_counters */ 446 GLuint MaxAtomicBuffers; 447 GLuint MaxAtomicCounters; 448 449 /* GL_ARB_shader_image_load_store */ 450 GLuint MaxImageUniforms; 451 452 /* GL_ARB_shader_storage_buffer_object */ 453 GLuint MaxShaderStorageBlocks; 454 }; 455 456 /** 457 * Constants which may be overridden by device driver during context creation 458 * but are never changed after that. 459 */ 460 struct gl_constants 461 { 462 /** 463 * Bitmask of valid primitive types supported by the driver, 464 */ 465 GLbitfield DriverSupportedPrimMask; 466 467 GLuint MaxTextureMbytes; /**< Max memory per image, in MB */ 468 GLuint MaxTextureSize; /**< Max 1D/2D texture size, in pixels*/ 469 GLuint Max3DTextureLevels; /**< Max mipmap levels for 3D textures */ 470 GLuint MaxCubeTextureLevels; /**< Max mipmap levels for cube textures */ 471 GLuint MaxArrayTextureLayers; /**< Max layers in array textures */ 472 GLuint MaxTextureRectSize; /**< Max rectangle texture size, in pixes */ 473 GLuint MaxTextureCoordUnits; 474 GLuint MaxCombinedTextureImageUnits; 475 GLuint MaxTextureUnits; /**< = MIN(CoordUnits, FragmentProgram.ImageUnits) */ 476 GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ 477 GLfloat MaxTextureLodBias; /**< GL_EXT_texture_lod_bias */ 478 GLuint MaxTextureBufferSize; /**< GL_ARB_texture_buffer_object */ 479 480 GLuint TextureBufferOffsetAlignment; /**< GL_ARB_texture_buffer_range */ 481 482 GLuint MaxArrayLockSize; 483 484 GLint SubPixelBits; 485 486 GLfloat MinPointSize, MaxPointSize; /**< aliased */ 487 GLfloat MinPointSizeAA, MaxPointSizeAA; /**< antialiased */ 488 GLfloat PointSizeGranularity; 489 GLfloat MinLineWidth, MaxLineWidth; /**< aliased */ 490 GLfloat MinLineWidthAA, MaxLineWidthAA; /**< antialiased */ 491 GLfloat LineWidthGranularity; 492 493 GLuint MaxClipPlanes; 494 GLuint MaxLights; 495 GLfloat MaxShininess; /**< GL_NV_light_max_exponent */ 496 GLfloat MaxSpotExponent; /**< GL_NV_light_max_exponent */ 497 498 GLuint MaxViewportWidth, MaxViewportHeight; 499 GLuint MaxViewports; /**< GL_ARB_viewport_array */ 500 GLuint ViewportSubpixelBits; /**< GL_ARB_viewport_array */ 501 struct { 502 GLfloat Min; 503 GLfloat Max; 504 } ViewportBounds; /**< GL_ARB_viewport_array */ 505 GLuint MaxWindowRectangles; /**< GL_EXT_window_rectangles */ 506 507 struct gl_program_constants Program[MESA_SHADER_STAGES]; 508 GLuint MaxProgramMatrices; 509 GLuint MaxProgramMatrixStackDepth; 510 511 struct { 512 GLuint SamplesPassed; 513 GLuint TimeElapsed; 514 GLuint Timestamp; 515 GLuint PrimitivesGenerated; 516 GLuint PrimitivesWritten; 517 GLuint VerticesSubmitted; 518 GLuint PrimitivesSubmitted; 519 GLuint VsInvocations; 520 GLuint TessPatches; 521 GLuint TessInvocations; 522 GLuint GsInvocations; 523 GLuint GsPrimitives; 524 GLuint FsInvocations; 525 GLuint ComputeInvocations; 526 GLuint ClInPrimitives; 527 GLuint ClOutPrimitives; 528 } QueryCounterBits; 529 530 GLuint MaxDrawBuffers; /**< GL_ARB_draw_buffers */ 531 532 GLuint MaxColorAttachments; /**< GL_EXT_framebuffer_object */ 533 GLuint MaxRenderbufferSize; /**< GL_EXT_framebuffer_object */ 534 GLuint MaxSamples; /**< GL_ARB_framebuffer_object */ 535 536 /** 537 * GL_ARB_framebuffer_no_attachments 538 */ 539 GLuint MaxFramebufferWidth; 540 GLuint MaxFramebufferHeight; 541 GLuint MaxFramebufferLayers; 542 GLuint MaxFramebufferSamples; 543 544 /** Number of varying vectors between any two shader stages. */ 545 GLuint MaxVarying; 546 547 /** @{ 548 * GL_ARB_uniform_buffer_object 549 */ 550 GLuint MaxCombinedUniformBlocks; 551 GLuint MaxUniformBufferBindings; 552 GLuint MaxUniformBlockSize; 553 GLuint UniformBufferOffsetAlignment; 554 /** @} */ 555 556 /** @{ 557 * GL_ARB_shader_storage_buffer_object 558 */ 559 GLuint MaxCombinedShaderStorageBlocks; 560 GLuint MaxShaderStorageBufferBindings; 561 GLuint MaxShaderStorageBlockSize; 562 GLuint ShaderStorageBufferOffsetAlignment; 563 /** @} */ 564 565 /** 566 * GL_ARB_explicit_uniform_location 567 */ 568 GLuint MaxUserAssignableUniformLocations; 569 570 /** geometry shader */ 571 GLuint MaxGeometryOutputVertices; 572 GLuint MaxGeometryTotalOutputComponents; 573 GLuint MaxGeometryShaderInvocations; 574 575 GLuint GLSLVersion; /**< Desktop GLSL version supported (ex: 120 = 1.20) */ 576 GLuint GLSLVersionCompat; /**< Desktop compat GLSL version supported */ 577 578 /** 579 * Changes default GLSL extension behavior from "error" to "warn". It's out 580 * of spec, but it can make some apps work that otherwise wouldn't. 581 */ 582 GLboolean ForceGLSLExtensionsWarn; 583 584 /** 585 * Force all shaders to behave as if they were declared with the 586 * compatibility token. 587 */ 588 GLboolean ForceCompatShaders; 589 590 /** 591 * If non-zero, forces GLSL shaders to behave as if they began 592 * with "#version ForceGLSLVersion". 593 */ 594 GLuint ForceGLSLVersion; 595 596 /** 597 * Allow GLSL #extension directives in the middle of shaders. 598 */ 599 GLboolean AllowGLSLExtensionDirectiveMidShader; 600 601 /** 602 * Allow a subset of GLSL 1.20 in GLSL 1.10 as needed by SPECviewperf13. 603 */ 604 GLboolean AllowGLSL120SubsetIn110; 605 606 /** 607 * Allow builtins as part of constant expressions. This was not allowed 608 * until GLSL 1.20 this allows it everywhere. 609 */ 610 GLboolean AllowGLSLBuiltinConstantExpression; 611 612 /** 613 * Allow some relaxation of GLSL ES shader restrictions. This encompasses 614 * a number of relaxations to the ES shader rules. 615 */ 616 GLboolean AllowGLSLRelaxedES; 617 618 /** 619 * Allow GLSL built-in variables to be redeclared verbatim 620 */ 621 GLboolean AllowGLSLBuiltinVariableRedeclaration; 622 623 /** 624 * Allow GLSL interpolation qualifier mismatch across shader stages. 625 */ 626 GLboolean AllowGLSLCrossStageInterpolationMismatch; 627 628 /** 629 * Allow creating a higher compat profile (version 3.1+) for apps that 630 * request it. Be careful when adding that driconf option because some 631 * features are unimplemented and might not work correctly. 632 */ 633 GLboolean AllowHigherCompatVersion; 634 635 /** 636 * Allow GLSL shaders with the compatibility version directive 637 * in non-compatibility profiles. (for shader-db) 638 */ 639 GLboolean AllowGLSLCompatShaders; 640 641 /** 642 * Allow extra tokens at end of preprocessor directives. The CTS now tests 643 * to make sure these are not allowed. However, previously drivers would 644 * allow them to exist and just issue a warning so some old applications 645 * depend on this. 646 */ 647 GLboolean AllowExtraPPTokens; 648 649 /** 650 * The spec forbids a shader to "statically write both gl_ClipVertex 651 * and gl_ClipDistance". 652 * This option adds a tolerance for shader that statically writes to 653 * both but at least one of the write can be removed by a dead code 654 * elimination pass. 655 */ 656 GLboolean DoDCEBeforeClipCullAnalysis; 657 658 /** 659 * Force computing the absolute value for sqrt() and inversesqrt() to follow 660 * D3D9 when apps rely on this behaviour. 661 */ 662 GLboolean ForceGLSLAbsSqrt; 663 664 /** 665 * Forces the GLSL compiler to ignore writes to readonly vars rather than 666 * throwing an error. 667 */ 668 GLboolean GLSLIgnoreWriteToReadonlyVar; 669 670 /** 671 * Types of variable to default initialized to zero. Supported values are: 672 * - 0: no zero initialization 673 * - 1: all shader variables and gl_FragColor are initialiazed to 0 674 * - 2: same as 1, but shader out variables are *not* initialized, while 675 * function out variables are now initialized. 676 */ 677 GLchar GLSLZeroInit; 678 679 /** 680 * Force GL names reuse. Needed by SPECviewperf13. 681 */ 682 GLboolean ForceGLNamesReuse; 683 684 /** 685 * Treat integer textures using GL_LINEAR filters as GL_NEAREST. 686 */ 687 GLboolean ForceIntegerTexNearest; 688 689 /** 690 * Treat 32-bit floating-point textures using GL_LINEAR filters as 691 * GL_NEAREST. 692 */ 693 GLboolean ForceFloat32TexNearest; 694 695 /** 696 * Does the driver support real 32-bit integers? (Otherwise, integers are 697 * simulated via floats.) 698 */ 699 GLboolean NativeIntegers; 700 701 /** 702 * If the driver supports real 32-bit integers, what integer value should be 703 * used for boolean true in uniform uploads? (Usually 1 or ~0.) 704 */ 705 GLuint UniformBooleanTrue; 706 707 /** 708 * Maximum amount of time, measured in nanseconds, that the server can wait. 709 */ 710 GLuint64 MaxServerWaitTimeout; 711 712 /** GL_EXT_provoking_vertex */ 713 GLboolean QuadsFollowProvokingVertexConvention; 714 715 /** GL_ARB_viewport_array */ 716 GLenum16 LayerAndVPIndexProvokingVertex; 717 718 /** OpenGL version 3.0 */ 719 GLbitfield ContextFlags; /**< Ex: GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */ 720 721 /** OpenGL version 3.2 */ 722 GLbitfield ProfileMask; /**< Mask of CONTEXT_x_PROFILE_BIT */ 723 724 /** OpenGL version 4.4 */ 725 GLuint MaxVertexAttribStride; 726 727 /** GL_EXT_transform_feedback */ 728 GLuint MaxTransformFeedbackBuffers; 729 GLuint MaxTransformFeedbackSeparateComponents; 730 GLuint MaxTransformFeedbackInterleavedComponents; 731 GLuint MaxVertexStreams; 732 733 /** GL_EXT_gpu_shader4 */ 734 GLint MinProgramTexelOffset, MaxProgramTexelOffset; 735 736 /** GL_ARB_texture_gather */ 737 GLuint MinProgramTextureGatherOffset; 738 GLuint MaxProgramTextureGatherOffset; 739 GLuint MaxProgramTextureGatherComponents; 740 741 /* GL_ARB_robustness */ 742 GLenum16 ResetStrategy; 743 744 /* GL_KHR_robustness */ 745 GLboolean RobustAccess; 746 747 /* GL_ARB_blend_func_extended */ 748 GLuint MaxDualSourceDrawBuffers; 749 750 /** 751 * For drivers which can do a better job at eliminating unused uniforms 752 * than the GLSL compiler. 753 * 754 * XXX Remove these as soon as a better solution is available. 755 */ 756 GLboolean GLSLSkipStrictMaxUniformLimitCheck; 757 758 GLboolean GLSLHasHalfFloatPacking; 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 * Disable the glsl optimisation that resizes uniform arrays. 804 */ 805 bool DisableUniformArrayResize; 806 807 /** 808 * Alias extension e.g. GL_ATI_shader_texture_lod to GL_ARB_shader_texture_lod. 809 */ 810 char *AliasShaderExtension; 811 812 /** 813 * Allow fs-only bias argument in vertex shaders. 814 */ 815 GLboolean AllowVertexTextureBias; 816 817 /** 818 * Align varyings to POT in a slot 819 * 820 * Drivers that prefer varyings to be aligned to POT must set this value to GL_TRUE 821 */ 822 GLboolean PreferPOTAlignedVaryings; 823 824 825 /** 826 * UBOs and SSBOs can be packed tightly by the OpenGL implementation when 827 * layout is set as shared (the default) or packed. However most Mesa drivers 828 * just use STD140 for these layouts. This flag allows drivers to use STD430 829 * for packed and shared layouts which allows arrays to be packed more 830 * tightly. 831 */ 832 bool UseSTD430AsDefaultPacking; 833 834 /** 835 * Should meaningful names be generated for compiler temporary variables? 836 * 837 * Generally, it is not useful to have the compiler generate "meaningful" 838 * names for temporary variables that it creates. This can, however, be a 839 * useful debugging aid. In Mesa debug builds or release builds when 840 * MESA_GLSL is set at run-time, meaningful names will be generated. 841 * Drivers can also force names to be generated by setting this field. 842 * For example, the i965 driver may set it when INTEL_DEBUG=vs (to dump 843 * vertex shader assembly) is set at run-time. 844 */ 845 bool GenerateTemporaryNames; 846 847 /* 848 * Maximum value supported for an index in DrawElements and friends. 849 * 850 * This must be at least (1ull<<24)-1. The default value is 851 * (1ull<<32)-1. 852 * 853 * \since ES 3.0 or GL_ARB_ES3_compatibility 854 * \sa _mesa_init_constants 855 */ 856 GLuint64 MaxElementIndex; 857 858 /** 859 * Disable interpretation of line continuations (lines ending with a 860 * backslash character ('\') in GLSL source. 861 */ 862 GLboolean DisableGLSLLineContinuations; 863 864 /** GL_ARB_texture_multisample */ 865 GLint MaxColorTextureSamples; 866 GLint MaxDepthTextureSamples; 867 GLint MaxIntegerSamples; 868 869 /** GL_AMD_framebuffer_multisample_advanced */ 870 GLint MaxColorFramebufferSamples; 871 GLint MaxColorFramebufferStorageSamples; 872 GLint MaxDepthStencilFramebufferSamples; 873 874 /* An array of supported MSAA modes allowing different sample 875 * counts per attachment type. 876 */ 877 struct { 878 GLint NumColorSamples; 879 GLint NumColorStorageSamples; 880 GLint NumDepthStencilSamples; 881 } SupportedMultisampleModes[40]; 882 GLint NumSupportedMultisampleModes; 883 884 /** GL_ARB_shader_atomic_counters */ 885 GLuint MaxAtomicBufferBindings; 886 GLuint MaxAtomicBufferSize; 887 GLuint MaxCombinedAtomicBuffers; 888 GLuint MaxCombinedAtomicCounters; 889 890 /** GL_ARB_vertex_attrib_binding */ 891 GLint MaxVertexAttribRelativeOffset; 892 GLint MaxVertexAttribBindings; 893 894 /* GL_ARB_shader_image_load_store */ 895 GLuint MaxImageUnits; 896 GLuint MaxCombinedShaderOutputResources; 897 GLuint MaxImageSamples; 898 GLuint MaxCombinedImageUniforms; 899 900 /** GL_ARB_compute_shader */ 901 GLuint MaxComputeWorkGroupCount[3]; /* Array of x, y, z dimensions */ 902 GLuint MaxComputeWorkGroupSize[3]; /* Array of x, y, z dimensions */ 903 GLuint MaxComputeWorkGroupInvocations; 904 GLuint MaxComputeSharedMemorySize; 905 906 /** GL_ARB_compute_variable_group_size */ 907 GLuint MaxComputeVariableGroupSize[3]; /* Array of x, y, z dimensions */ 908 GLuint MaxComputeVariableGroupInvocations; 909 910 /** GL_ARB_gpu_shader5 */ 911 GLfloat MinFragmentInterpolationOffset; 912 GLfloat MaxFragmentInterpolationOffset; 913 914 GLboolean FakeSWMSAA; 915 916 /** GL_KHR_context_flush_control */ 917 GLenum16 ContextReleaseBehavior; 918 919 struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_STAGES]; 920 921 /** GL_ARB_tessellation_shader */ 922 GLuint MaxPatchVertices; 923 GLuint MaxTessGenLevel; 924 GLuint MaxTessPatchComponents; 925 GLuint MaxTessControlTotalOutputComponents; 926 bool PrimitiveRestartForPatches; 927 928 /** GL_OES_primitive_bounding_box */ 929 bool NoPrimitiveBoundingBoxOutput; 930 931 /** GL_ARB_sparse_buffer */ 932 GLuint SparseBufferPageSize; 933 934 /** Used as an input for sha1 generation in the on-disk shader cache */ 935 unsigned char *dri_config_options_sha1; 936 937 /** When drivers are OK with mapped buffers during draw and other calls. */ 938 bool AllowMappedBuffersDuringExecution; 939 940 /** Override GL_MAP_UNSYNCHRONIZED_BIT */ 941 bool ForceMapBufferSynchronized; 942 943 /** GL_ARB_get_program_binary */ 944 GLuint NumProgramBinaryFormats; 945 946 /** GL_ARB_gl_spirv */ 947 GLuint NumShaderBinaryFormats; 948 949 /** GL_NV_conservative_raster */ 950 GLuint MaxSubpixelPrecisionBiasBits; 951 952 /** GL_NV_conservative_raster_dilate */ 953 GLfloat ConservativeRasterDilateRange[2]; 954 GLfloat ConservativeRasterDilateGranularity; 955 956 /** Is the drivers uniform storage packed or padded to 16 bytes. */ 957 bool PackedDriverUniformStorage; 958 959 bool HasFBFetch; 960 961 bool CombinedClipCullDistanceArrays; 962 963 bool PointSizeFixed; 964 965 /** Wether or not glBitmap uses red textures rather than alpha */ 966 bool BitmapUsesRed; 967 968 /** Whether the vertex buffer offset is a signed 32-bit integer. */ 969 bool VertexBufferOffsetIsInt32; 970 971 /** Whether out-of-order draw (Begin/End) optimizations are allowed. */ 972 bool AllowDrawOutOfOrder; 973 974 /** Whether to force the fast path for binding VAOs. It has much lower 975 * overhead due to not spending CPU cycles on trying to find interleaved 976 * vertex attribs and binding them. 977 */ 978 bool UseVAOFastPath; 979 980 /** Whether the driver can support primitive restart with a fixed index. 981 * This is essentially a subset of NV_primitive_restart with enough support 982 * to be able to enable GLES 3.1. Some hardware can support this but not the 983 * full NV extension with arbitrary restart indices. 984 */ 985 bool PrimitiveRestartFixedIndex; 986 987 /** GL_ARB_spirv_extensions */ 988 struct spirv_supported_extensions *SpirVExtensions; 989 990 char *VendorOverride; 991 char *RendererOverride; 992 993 /** Buffer size used to upload vertices from glBegin/glEnd. */ 994 unsigned glBeginEndBufferSize; 995 996 /** Whether the driver doesn't want x/y/width/height clipped based on src size 997 * when doing a copy texture operation (eg: may want out-of-bounds reads that 998 * produce 0 instead of leaving the texture content undefined). 999 */ 1000 bool NoClippingOnCopyTex; 1001 1002 /** 1003 * Force glthread to always return GL_FRAMEBUFFER_COMPLETE to prevent 1004 * synchronization. Used for apps that call it every frame or multiple times 1005 * a frame, but always getting framebuffer completeness. 1006 */ 1007 bool GLThreadNopCheckFramebufferStatus; 1008 1009 /** GL_ARB_sparse_texture */ 1010 GLuint MaxSparseTextureSize; 1011 GLuint MaxSparse3DTextureSize; 1012 GLuint MaxSparseArrayTextureLayers; 1013 bool SparseTextureFullArrayCubeMipmaps; 1014 1015 /** Use hardware accelerated GL_SELECT */ 1016 bool HardwareAcceleratedSelect; 1017 1018 /** Allow GLThread to convert glBuffer */ 1019 bool AllowGLThreadBufferSubDataOpt; 1020 1021 /** Whether pipe_context::draw_vertex_state is supported. */ 1022 bool HasDrawVertexState; 1023 1024 /** GL_KHR_shader_subgroup */ 1025 GLuint ShaderSubgroupSize; 1026 GLuint ShaderSubgroupSupportedStages; 1027 GLuint ShaderSubgroupSupportedFeatures; 1028 bool ShaderSubgroupQuadAllStages; 1029 }; 1030 1031 #endif 1032