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_texture_array; 193 GLboolean EXT_texture_buffer_object; 194 GLboolean EXT_texture_compression_latc; 195 GLboolean EXT_texture_compression_s3tc; 196 GLboolean EXT_texture_compression_s3tc_srgb; 197 GLboolean EXT_texture_env_dot3; 198 GLboolean EXT_texture_filter_anisotropic; 199 GLboolean EXT_texture_filter_minmax; 200 GLboolean EXT_texture_integer; 201 GLboolean EXT_texture_mirror_clamp; 202 GLboolean EXT_texture_norm16; 203 GLboolean EXT_texture_shadow_lod; 204 GLboolean EXT_texture_shared_exponent; 205 GLboolean EXT_texture_snorm; 206 GLboolean EXT_texture_sRGB; 207 GLboolean EXT_texture_sRGB_R8; 208 GLboolean EXT_texture_sRGB_RG8; 209 GLboolean EXT_texture_sRGB_decode; 210 GLboolean EXT_texture_swizzle; 211 GLboolean EXT_texture_type_2_10_10_10_REV; 212 GLboolean EXT_transform_feedback; 213 GLboolean EXT_timer_query; 214 GLboolean EXT_vertex_array_bgra; 215 GLboolean EXT_window_rectangles; 216 GLboolean OES_copy_image; 217 GLboolean OES_primitive_bounding_box; 218 GLboolean OES_sample_variables; 219 GLboolean OES_standard_derivatives; 220 GLboolean OES_texture_buffer; 221 GLboolean OES_texture_cube_map_array; 222 GLboolean OES_texture_view; 223 GLboolean OES_viewport_array; 224 /* vendor extensions */ 225 GLboolean AMD_compressed_ATC_texture; 226 GLboolean AMD_framebuffer_multisample_advanced; 227 GLboolean AMD_depth_clamp_separate; 228 GLboolean AMD_gpu_shader_half_float; 229 GLboolean AMD_performance_monitor; 230 GLboolean AMD_pinned_memory; 231 GLboolean AMD_seamless_cubemap_per_texture; 232 GLboolean AMD_vertex_shader_layer; 233 GLboolean AMD_vertex_shader_viewport_index; 234 GLboolean ANDROID_extension_pack_es31a; 235 GLboolean ARM_shader_framebuffer_fetch_depth_stencil; 236 GLboolean ATI_meminfo; 237 GLboolean ATI_texture_compression_3dc; 238 GLboolean ATI_texture_mirror_once; 239 GLboolean ATI_texture_env_combine3; 240 GLboolean ATI_fragment_shader; 241 GLboolean GREMEDY_string_marker; 242 GLboolean INTEL_blackhole_render; 243 GLboolean INTEL_conservative_rasterization; 244 GLboolean INTEL_performance_query; 245 GLboolean INTEL_shader_atomic_float_minmax; 246 GLboolean INTEL_shader_integer_functions2; 247 GLboolean KHR_blend_equation_advanced; 248 GLboolean KHR_blend_equation_advanced_coherent; 249 GLboolean KHR_robustness; 250 GLboolean KHR_texture_compression_astc_hdr; 251 GLboolean KHR_texture_compression_astc_ldr; 252 GLboolean KHR_texture_compression_astc_sliced_3d; 253 GLboolean MESA_framebuffer_flip_y; 254 GLboolean MESA_texture_const_bandwidth; 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 */ 312 struct 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 */ 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 /* 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 */ 459 struct 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 * Treat 32-bit floating-point textures using GL_LINEAR filters as 690 * GL_NEAREST. 691 */ 692 GLboolean ForceFloat32TexNearest; 693 694 /** 695 * Does the driver support real 32-bit integers? (Otherwise, integers are 696 * simulated via floats.) 697 */ 698 GLboolean NativeIntegers; 699 700 /** 701 * If the driver supports real 32-bit integers, what integer value should be 702 * used for boolean true in uniform uploads? (Usually 1 or ~0.) 703 */ 704 GLuint UniformBooleanTrue; 705 706 /** 707 * Maximum amount of time, measured in nanseconds, that the server can wait. 708 */ 709 GLuint64 MaxServerWaitTimeout; 710 711 /** GL_EXT_provoking_vertex */ 712 GLboolean QuadsFollowProvokingVertexConvention; 713 714 /** GL_ARB_viewport_array */ 715 GLenum16 LayerAndVPIndexProvokingVertex; 716 717 /** OpenGL version 3.0 */ 718 GLbitfield ContextFlags; /**< Ex: GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */ 719 720 /** OpenGL version 3.2 */ 721 GLbitfield ProfileMask; /**< Mask of CONTEXT_x_PROFILE_BIT */ 722 723 /** OpenGL version 4.4 */ 724 GLuint MaxVertexAttribStride; 725 726 /** GL_EXT_transform_feedback */ 727 GLuint MaxTransformFeedbackBuffers; 728 GLuint MaxTransformFeedbackSeparateComponents; 729 GLuint MaxTransformFeedbackInterleavedComponents; 730 GLuint MaxVertexStreams; 731 732 /** GL_EXT_gpu_shader4 */ 733 GLint MinProgramTexelOffset, MaxProgramTexelOffset; 734 735 /** GL_ARB_texture_gather */ 736 GLuint MinProgramTextureGatherOffset; 737 GLuint MaxProgramTextureGatherOffset; 738 GLuint MaxProgramTextureGatherComponents; 739 740 /* GL_ARB_robustness */ 741 GLenum16 ResetStrategy; 742 743 /* GL_KHR_robustness */ 744 GLboolean RobustAccess; 745 746 /* GL_ARB_blend_func_extended */ 747 GLuint MaxDualSourceDrawBuffers; 748 749 /** 750 * For drivers which can do a better job at eliminating unused uniforms 751 * than the GLSL compiler. 752 * 753 * XXX Remove these as soon as a better solution is available. 754 */ 755 GLboolean GLSLSkipStrictMaxUniformLimitCheck; 756 757 GLboolean GLSLHasHalfFloatPacking; 758 759 /** 760 * Whether gl_FragCoord, gl_PointCoord and gl_FrontFacing 761 * are system values. 762 **/ 763 bool GLSLFragCoordIsSysVal; 764 bool GLSLPointCoordIsSysVal; 765 bool GLSLFrontFacingIsSysVal; 766 767 /** 768 * Whether to call lower_const_arrays_to_uniforms() during linking. 769 */ 770 bool GLSLLowerConstArrays; 771 772 /** 773 * True if gl_TessLevelInner/Outer[] in the TES should be inputs 774 * (otherwise, they're system values). 775 */ 776 bool GLSLTessLevelsAsInputs; 777 778 /** GL_ARB_map_buffer_alignment */ 779 GLuint MinMapBufferAlignment; 780 781 /** 782 * Disable varying packing. This is out of spec, but potentially useful 783 * for older platforms that supports a limited number of texture 784 * indirections--on these platforms, unpacking the varyings in the fragment 785 * shader increases the number of texture indirections by 1, which might 786 * make some shaders not executable at all. 787 * 788 * Drivers that support transform feedback must set this value to GL_FALSE. 789 */ 790 GLboolean DisableVaryingPacking; 791 792 /** 793 * Disable varying packing if used for transform feedback. This is needed 794 * for some drivers (e.g. Panfrost) where transform feedback requires 795 * unpacked varyings. 796 * 797 * This variable is mutually exlusive with DisableVaryingPacking. 798 */ 799 GLboolean DisableTransformFeedbackPacking; 800 801 /** 802 * Disable the glsl optimisation that resizes uniform arrays. 803 */ 804 bool DisableUniformArrayResize; 805 806 /** 807 * Alias extension e.g. GL_ATI_shader_texture_lod to GL_ARB_shader_texture_lod. 808 */ 809 char *AliasShaderExtension; 810 811 /** 812 * Allow fs-only bias argument in vertex shaders. 813 */ 814 GLboolean AllowVertexTextureBias; 815 816 /** 817 * Align varyings to POT in a slot 818 * 819 * Drivers that prefer varyings to be aligned to POT must set this value to GL_TRUE 820 */ 821 GLboolean PreferPOTAlignedVaryings; 822 823 824 /** 825 * UBOs and SSBOs can be packed tightly by the OpenGL implementation when 826 * layout is set as shared (the default) or packed. However most Mesa drivers 827 * just use STD140 for these layouts. This flag allows drivers to use STD430 828 * for packed and shared layouts which allows arrays to be packed more 829 * tightly. 830 */ 831 bool UseSTD430AsDefaultPacking; 832 833 /** 834 * Should meaningful names be generated for compiler temporary variables? 835 * 836 * Generally, it is not useful to have the compiler generate "meaningful" 837 * names for temporary variables that it creates. This can, however, be a 838 * useful debugging aid. In Mesa debug builds or release builds when 839 * MESA_GLSL is set at run-time, meaningful names will be generated. 840 * Drivers can also force names to be generated by setting this field. 841 * For example, the i965 driver may set it when INTEL_DEBUG=vs (to dump 842 * vertex shader assembly) is set at run-time. 843 */ 844 bool GenerateTemporaryNames; 845 846 /* 847 * Maximum value supported for an index in DrawElements and friends. 848 * 849 * This must be at least (1ull<<24)-1. The default value is 850 * (1ull<<32)-1. 851 * 852 * \since ES 3.0 or GL_ARB_ES3_compatibility 853 * \sa _mesa_init_constants 854 */ 855 GLuint64 MaxElementIndex; 856 857 /** 858 * Disable interpretation of line continuations (lines ending with a 859 * backslash character ('\') in GLSL source. 860 */ 861 GLboolean DisableGLSLLineContinuations; 862 863 /** GL_ARB_texture_multisample */ 864 GLint MaxColorTextureSamples; 865 GLint MaxDepthTextureSamples; 866 GLint MaxIntegerSamples; 867 868 /** GL_AMD_framebuffer_multisample_advanced */ 869 GLint MaxColorFramebufferSamples; 870 GLint MaxColorFramebufferStorageSamples; 871 GLint MaxDepthStencilFramebufferSamples; 872 873 /* An array of supported MSAA modes allowing different sample 874 * counts per attachment type. 875 */ 876 struct { 877 GLint NumColorSamples; 878 GLint NumColorStorageSamples; 879 GLint NumDepthStencilSamples; 880 } SupportedMultisampleModes[40]; 881 GLint NumSupportedMultisampleModes; 882 883 /** GL_ARB_shader_atomic_counters */ 884 GLuint MaxAtomicBufferBindings; 885 GLuint MaxAtomicBufferSize; 886 GLuint MaxCombinedAtomicBuffers; 887 GLuint MaxCombinedAtomicCounters; 888 889 /** GL_ARB_vertex_attrib_binding */ 890 GLint MaxVertexAttribRelativeOffset; 891 GLint MaxVertexAttribBindings; 892 893 /* GL_ARB_shader_image_load_store */ 894 GLuint MaxImageUnits; 895 GLuint MaxCombinedShaderOutputResources; 896 GLuint MaxImageSamples; 897 GLuint MaxCombinedImageUniforms; 898 899 /** GL_ARB_compute_shader */ 900 GLuint MaxComputeWorkGroupCount[3]; /* Array of x, y, z dimensions */ 901 GLuint MaxComputeWorkGroupSize[3]; /* Array of x, y, z dimensions */ 902 GLuint MaxComputeWorkGroupInvocations; 903 GLuint MaxComputeSharedMemorySize; 904 905 /** GL_ARB_compute_variable_group_size */ 906 GLuint MaxComputeVariableGroupSize[3]; /* Array of x, y, z dimensions */ 907 GLuint MaxComputeVariableGroupInvocations; 908 909 /** GL_ARB_gpu_shader5 */ 910 GLfloat MinFragmentInterpolationOffset; 911 GLfloat MaxFragmentInterpolationOffset; 912 913 GLboolean FakeSWMSAA; 914 915 /** GL_KHR_context_flush_control */ 916 GLenum16 ContextReleaseBehavior; 917 918 struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_STAGES]; 919 920 /** GL_ARB_tessellation_shader */ 921 GLuint MaxPatchVertices; 922 GLuint MaxTessGenLevel; 923 GLuint MaxTessPatchComponents; 924 GLuint MaxTessControlTotalOutputComponents; 925 bool PrimitiveRestartForPatches; 926 927 /** GL_OES_primitive_bounding_box */ 928 bool NoPrimitiveBoundingBoxOutput; 929 930 /** GL_ARB_sparse_buffer */ 931 GLuint SparseBufferPageSize; 932 933 /** Used as an input for sha1 generation in the on-disk shader cache */ 934 unsigned char *dri_config_options_sha1; 935 936 /** When drivers are OK with mapped buffers during draw and other calls. */ 937 bool AllowMappedBuffersDuringExecution; 938 939 /** Override GL_MAP_UNSYNCHRONIZED_BIT */ 940 bool ForceMapBufferSynchronized; 941 942 /** GL_ARB_get_program_binary */ 943 GLuint NumProgramBinaryFormats; 944 945 /** GL_ARB_gl_spirv */ 946 GLuint NumShaderBinaryFormats; 947 948 /** GL_NV_conservative_raster */ 949 GLuint MaxSubpixelPrecisionBiasBits; 950 951 /** GL_NV_conservative_raster_dilate */ 952 GLfloat ConservativeRasterDilateRange[2]; 953 GLfloat ConservativeRasterDilateGranularity; 954 955 /** Is the drivers uniform storage packed or padded to 16 bytes. */ 956 bool PackedDriverUniformStorage; 957 958 bool HasFBFetch; 959 960 /** Whether the backend supports reading from outputs */ 961 bool SupportsReadingOutputs; 962 963 bool CombinedClipCullDistanceArrays; 964 965 bool PointSizeFixed; 966 967 /** Wether or not glBitmap uses red textures rather than alpha */ 968 bool BitmapUsesRed; 969 970 /** Whether the vertex buffer offset is a signed 32-bit integer. */ 971 bool VertexBufferOffsetIsInt32; 972 973 /** Whether out-of-order draw (Begin/End) optimizations are allowed. */ 974 bool AllowDrawOutOfOrder; 975 976 /** Whether to force the fast path for binding VAOs. It has much lower 977 * overhead due to not spending CPU cycles on trying to find interleaved 978 * vertex attribs and binding them. 979 */ 980 bool UseVAOFastPath; 981 982 /** Whether the driver can support primitive restart with a fixed index. 983 * This is essentially a subset of NV_primitive_restart with enough support 984 * to be able to enable GLES 3.1. Some hardware can support this but not the 985 * full NV extension with arbitrary restart indices. 986 */ 987 bool PrimitiveRestartFixedIndex; 988 989 /** GL_ARB_gl_spirv */ 990 struct spirv_supported_capabilities SpirVCapabilities; 991 992 /** GL_ARB_spirv_extensions */ 993 struct spirv_supported_extensions *SpirVExtensions; 994 995 char *VendorOverride; 996 char *RendererOverride; 997 998 /** Buffer size used to upload vertices from glBegin/glEnd. */ 999 unsigned glBeginEndBufferSize; 1000 1001 /** Whether the driver doesn't want x/y/width/height clipped based on src size 1002 * when doing a copy texture operation (eg: may want out-of-bounds reads that 1003 * produce 0 instead of leaving the texture content undefined). 1004 */ 1005 bool NoClippingOnCopyTex; 1006 1007 /** 1008 * Force glthread to always return GL_FRAMEBUFFER_COMPLETE to prevent 1009 * synchronization. Used for apps that call it every frame or multiple times 1010 * a frame, but always getting framebuffer completeness. 1011 */ 1012 bool GLThreadNopCheckFramebufferStatus; 1013 1014 /** GL_ARB_sparse_texture */ 1015 GLuint MaxSparseTextureSize; 1016 GLuint MaxSparse3DTextureSize; 1017 GLuint MaxSparseArrayTextureLayers; 1018 bool SparseTextureFullArrayCubeMipmaps; 1019 1020 /** Use hardware accelerated GL_SELECT */ 1021 bool HardwareAcceleratedSelect; 1022 1023 /** Allow GLThread to convert glBuffer */ 1024 bool AllowGLThreadBufferSubDataOpt; 1025 1026 /** Whether pipe_context::draw_vertex_state is supported. */ 1027 bool HasDrawVertexState; 1028 }; 1029 1030 #endif 1031