X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fmtypes.h;h=87e3c0cbf362ab8189a3e0ae6cd23e5879b065f5;hb=3ee409bebfa88eaec34a7f912a1bbc86304a522f;hp=4e88494c387ab7bac542571dc7f7611717aa96fa;hpb=0af4bf4d4bc96d1a8471bdfe8055fa05e7ccd0fe;p=mesa.git diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 4e88494c387..87e3c0cbf36 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -42,8 +42,9 @@ #include "main/config.h" #include "glapi/glapi.h" #include "math/m_matrix.h" /* GLmatrix */ -#include "glsl/shader_enums.h" +#include "compiler/shader_enums.h" #include "main/formats.h" /* MESA_FORMAT_COUNT */ +#include "compiler/glsl/list.h" #ifdef __cplusplus @@ -94,11 +95,6 @@ struct vbo_context; #define PRIM_OUTSIDE_BEGIN_END (PRIM_MAX + 1) #define PRIM_UNKNOWN (PRIM_MAX + 2) -#define VARYING_SLOT_MAX (VARYING_SLOT_VAR0 + MAX_VARYING) -#define VARYING_SLOT_PATCH0 (VARYING_SLOT_MAX) -#define VARYING_SLOT_TESS_MAX (VARYING_SLOT_PATCH0 + MAX_VARYING) -#define FRAG_RESULT_MAX (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS) - /** * Determine if the given gl_varying_slot appears in the fragment shader. */ @@ -337,9 +333,6 @@ struct gl_material */ struct gl_light { - struct gl_light *next; /**< double linked list with sentinel */ - struct gl_light *prev; - GLfloat Ambient[4]; /**< ambient color */ GLfloat Diffuse[4]; /**< diffuse color */ GLfloat Specular[4]; /**< specular color */ @@ -487,26 +480,24 @@ struct gl_colorbuffer_attrib struct gl_current_attrib { /** - * \name Current vertex attributes. + * \name Current vertex attributes (color, texcoords, etc). * \note Values are valid only after FLUSH_VERTICES has been called. * \note Index and Edgeflag current values are stored as floats in the * SIX and SEVEN attribute slots. + * \note We need double storage for 64-bit vertex attributes */ - /* we need double storage for this for vertex attrib 64bit */ - GLfloat Attrib[VERT_ATTRIB_MAX][4*2]; /**< Position, color, texcoords, etc */ + GLfloat Attrib[VERT_ATTRIB_MAX][4*2]; /** - * \name Current raster position attributes (always valid). - * \note This set of attributes is very similar to the SWvertex struct. + * \name Current raster position attributes (always up to date after a + * glRasterPos call). */ - /*@{*/ GLfloat RasterPos[4]; GLfloat RasterDistance; GLfloat RasterColor[4]; GLfloat RasterSecondaryColor[4]; GLfloat RasterTexCoords[MAX_TEXTURE_COORD_UNITS][4]; GLboolean RasterPosValid; - /*@}*/ }; @@ -636,9 +627,10 @@ struct gl_light_attrib * Derived state for optimizations: */ /*@{*/ + GLbitfield _EnabledLights; /**< bitmask containing enabled lights */ + GLboolean _NeedEyeCoords; GLboolean _NeedVertices; /**< Use fast shader? */ - struct gl_light EnabledList; /**< List sentinel */ GLfloat _BaseColor[2][3]; /*@}*/ @@ -673,7 +665,6 @@ struct gl_list_attrib struct gl_multisample_attrib { GLboolean Enabled; - GLboolean _Enabled; /**< true if Enabled and multisample buffer */ GLboolean SampleAlphaToCoverage; GLboolean SampleAlphaToOne; GLboolean SampleCoverage; @@ -763,7 +754,7 @@ struct gl_point_attrib GLboolean SmoothFlag; /**< True if GL_POINT_SMOOTH is enabled */ GLboolean _Attenuated; /**< True if Params != [1, 0, 0] */ GLboolean PointSprite; /**< GL_NV/ARB_point_sprite */ - GLboolean CoordReplace[MAX_TEXTURE_COORD_UNITS]; /**< GL_ARB_point_sprite*/ + GLbitfield CoordReplace; /**< GL_ARB_point_sprite*/ GLenum SpriteRMode; /**< GL_NV_point_sprite (only!) */ GLenum SpriteOrigin; /**< GL_ARB_point_sprite */ }; @@ -944,6 +935,7 @@ typedef enum */ struct gl_sampler_object { + mtx_t Mutex; GLuint Name; GLint RefCount; GLchar *Label; /**< GL_KHR_debug */ @@ -1259,6 +1251,9 @@ typedef enum { USAGE_TEXTURE_BUFFER = 0x2, USAGE_ATOMIC_COUNTER_BUFFER = 0x4, USAGE_SHADER_STORAGE_BUFFER = 0x8, + USAGE_TRANSFORM_FEEDBACK_BUFFER = 0x10, + USAGE_PIXEL_PACK_BUFFER = 0x20, + USAGE_DISABLE_MINMAX_CACHE = 0x40, } gl_buffer_usage; @@ -1281,7 +1276,17 @@ struct gl_buffer_object GLboolean Immutable; /**< GL_ARB_buffer_storage */ gl_buffer_usage UsageHistory; /**< How has this buffer been used so far? */ + /** Counters used for buffer usage warnings */ + GLuint NumSubDataCalls; + GLuint NumMapBufferWriteCalls; + struct gl_buffer_mapping Mappings[MAP_COUNT]; + + /** Memoization of min/max index computations for static index buffers */ + struct hash_table *MinMaxCache; + unsigned MinMaxCacheHitIndices; + unsigned MinMaxCacheMissIndices; + bool MinMaxCacheDirty; }; @@ -1425,6 +1430,9 @@ struct gl_vertex_array_object /** Vertex buffer bindings */ struct gl_vertex_buffer_binding VertexBinding[VERT_ATTRIB_MAX]; + /** Mask indicating which vertex arrays have vertex buffer associated. */ + GLbitfield64 VertexAttribBufferMask; + /** Mask of VERT_BIT_* values indicating which arrays are enabled */ GLbitfield64 _Enabled; @@ -1608,7 +1616,9 @@ struct gl_transform_feedback_varying_info { char *Name; GLenum Type; + GLint BufferIndex; GLint Size; + GLint Offset; }; @@ -1634,15 +1644,33 @@ struct gl_transform_feedback_output }; +struct gl_transform_feedback_buffer +{ + unsigned Binding; + + unsigned NumVaryings; + + /** + * Total number of components stored in each buffer. This may be used by + * hardware back-ends to determine the correct stride when interleaving + * multiple transform feedback outputs in the same buffer. + */ + unsigned Stride; + + /** + * Which transform feedback stream this buffer binding is associated with. + */ + unsigned Stream; +}; + + /** Post-link transform feedback info. */ struct gl_transform_feedback_info { unsigned NumOutputs; - /** - * Number of transform feedback buffers in use by this program. - */ - unsigned NumBuffers; + /* Bitmask of active buffer indices. */ + unsigned ActiveBuffers; struct gl_transform_feedback_output *Outputs; @@ -1653,17 +1681,7 @@ struct gl_transform_feedback_info struct gl_transform_feedback_varying_info *Varyings; GLint NumVarying; - /** - * Total number of components stored in each buffer. This may be used by - * hardware back-ends to determine the correct stride when interleaving - * multiple transform feedback outputs in the same buffer. - */ - unsigned BufferStride[MAX_FEEDBACK_BUFFERS]; - - /** - * Which transform feedback stream this buffer binding is associated with. - */ - unsigned BufferStream[MAX_FEEDBACK_BUFFERS]; + struct gl_transform_feedback_buffer Buffers[MAX_FEEDBACK_BUFFERS]; }; @@ -1860,33 +1878,20 @@ typedef enum PROGRAM_SAMPLER, /**< for shader samplers, compile-time only */ PROGRAM_SYSTEM_VALUE,/**< InstanceId, PrimitiveID, etc. */ PROGRAM_UNDEFINED, /**< Invalid/TBD value */ + PROGRAM_IMMEDIATE, /**< Immediate value, used by TGSI */ + PROGRAM_BUFFER, /**< for shader buffers, compile-time only */ + PROGRAM_MEMORY, /**< for shared, global and local memory */ + PROGRAM_IMAGE, /**< for shader images, compile-time only */ PROGRAM_FILE_MAX } gl_register_file; -/** - * \brief Layout qualifiers for gl_FragDepth. - * - * Extension AMD_conservative_depth allows gl_FragDepth to be redeclared with - * a layout qualifier. - * - * \see enum ir_depth_layout - */ -enum gl_frag_depth_layout -{ - FRAG_DEPTH_LAYOUT_NONE, /**< No layout is specified. */ - FRAG_DEPTH_LAYOUT_ANY, - FRAG_DEPTH_LAYOUT_GREATER, - FRAG_DEPTH_LAYOUT_LESS, - FRAG_DEPTH_LAYOUT_UNCHANGED -}; - - /** * Base class for any kind of program object */ struct gl_program { + mtx_t Mutex; GLuint Id; GLint RefCount; GLubyte *String; /**< Null-terminated program text */ @@ -1914,7 +1919,8 @@ struct gl_program * For vertex and geometry shaders, true if the program uses the * gl_ClipDistance output. Ignored for fragment shaders. */ - GLboolean UsesClipDistanceOut; + unsigned ClipDistanceArraySize; + unsigned CullDistanceArraySize; /** Named parameters, constants, etc. from program text */ @@ -2049,6 +2055,11 @@ struct gl_compute_program * Size specified using local_size_{x,y,z}. */ unsigned LocalSize[3]; + + /** + * Size of shared variables accessed by the compute shader. + */ + unsigned SharedSize; }; @@ -2171,8 +2182,6 @@ struct gl_compute_program_state /** * ATI_fragment_shader runtime state */ -#define ATI_FS_INPUT_PRIMARY 0 -#define ATI_FS_INPUT_SECONDARY 1 struct atifs_instruction; struct atifs_setupinst; @@ -2196,6 +2205,7 @@ struct ati_fragment_shader GLboolean interpinp1; GLboolean isValid; GLuint swizzlerq; + struct gl_program *Program; }; /** @@ -2216,6 +2226,7 @@ struct gl_ati_fragment_shader_state struct gl_subroutine_function { char *name; + int index; int num_compat_types; const struct glsl_type **types; }; @@ -2283,15 +2294,15 @@ struct gl_shader */ unsigned num_combined_uniform_components; - /** - * This shader's uniform block information. - * - * These fields are only set post-linking. - */ unsigned NumUniformBlocks; - struct gl_uniform_block *UniformBlocks; + struct gl_uniform_block **UniformBlocks; + + unsigned NumShaderStorageBlocks; + struct gl_uniform_block **ShaderStorageBlocks; struct exec_list *ir; + struct exec_list *packed_varyings; + struct exec_list *fragdata_arrays; struct glsl_symbol_table *symbols; bool uses_builtin_functions; @@ -2305,6 +2316,11 @@ struct gl_shader bool origin_upper_left; bool pixel_center_integer; + struct { + /** Global xfb_stride out qualifier if any */ + GLuint BufferStride[MAX_FEEDBACK_BUFFERS]; + } TransformFeedback; + /** * Tessellation Control shader state from layout qualifiers. */ @@ -2389,6 +2405,9 @@ struct gl_shader */ GLuint NumImages; + struct gl_active_atomic_buffer **AtomicBuffers; + unsigned NumAtomicBuffers; + /** * Whether early fragment tests are enabled as defined by * ARB_shader_image_load_store. @@ -2415,6 +2434,7 @@ struct gl_shader * Subroutine uniform remap table * based on the program level uniform remap table. */ + GLuint NumSubroutineUniforms; /* non-sparse total */ GLuint NumSubroutineUniformRemapTable; struct gl_uniform_storage **SubroutineUniformRemapTable; @@ -2423,6 +2443,7 @@ struct gl_shader * and storage for them. */ GLuint NumSubroutineFunctions; + GLuint MaxSubroutineFunctionIndex; struct gl_subroutine_function *SubroutineFunctions; }; @@ -2453,7 +2474,8 @@ enum gl_uniform_block_packing { ubo_packing_std140, ubo_packing_shared, - ubo_packing_packed + ubo_packing_packed, + ubo_packing_std430 }; @@ -2473,21 +2495,14 @@ struct gl_uniform_block */ GLuint Binding; - /** - * Vulkan descriptor set qualifier for this block. - */ - GLuint Set; - /** * Minimum size (in bytes) of a buffer object to back this uniform buffer * (GL_UNIFORM_BLOCK_DATA_SIZE). */ GLuint UniformBufferSize; - /** - * Is this actually an interface block for a shader storage buffer? - */ - bool IsShaderStorage; + /** Stages that reference this block */ + uint8_t stageref; /** * Layout specified in the shader @@ -2518,6 +2533,105 @@ struct gl_active_atomic_buffer GLboolean StageReferences[MESA_SHADER_STAGES]; }; +/** + * Data container for shader queries. This holds only the minimal + * amount of required information for resource queries to work. + */ +struct gl_shader_variable +{ + /** + * Declared type of the variable + */ + const struct glsl_type *type; + + /** + * If the variable is in an interface block, this is the type of the block. + */ + const struct glsl_type *interface_type; + + /** + * For variables inside structs (possibly recursively), this is the + * outermost struct type. + */ + const struct glsl_type *outermost_struct_type; + + /** + * Declared name of the variable + */ + char *name; + + /** + * Storage location of the base of this variable + * + * The precise meaning of this field depends on the nature of the variable. + * + * - Vertex shader input: one of the values from \c gl_vert_attrib. + * - Vertex shader output: one of the values from \c gl_varying_slot. + * - Geometry shader input: one of the values from \c gl_varying_slot. + * - Geometry shader output: one of the values from \c gl_varying_slot. + * - Fragment shader input: one of the values from \c gl_varying_slot. + * - Fragment shader output: one of the values from \c gl_frag_result. + * - Uniforms: Per-stage uniform slot number for default uniform block. + * - Uniforms: Index within the uniform block definition for UBO members. + * - Non-UBO Uniforms: explicit location until linking then reused to + * store uniform slot number. + * - Other: This field is not currently used. + * + * If the variable is a uniform, shader input, or shader output, and the + * slot has not been assigned, the value will be -1. + */ + int location; + + /** + * Specifies the first component the variable is stored in as per + * ARB_enhanced_layouts. + */ + unsigned component:2; + + /** + * Output index for dual source blending. + * + * \note + * The GLSL spec only allows the values 0 or 1 for the index in \b dual + * source blending. + */ + unsigned index:1; + + /** + * Specifies whether a shader input/output is per-patch in tessellation + * shader stages. + */ + unsigned patch:1; + + /** + * Storage class of the variable. + * + * \sa (n)ir_variable_mode + */ + unsigned mode:4; + + /** + * Interpolation mode for shader inputs / outputs + * + * \sa ir_variable_interpolation + */ + unsigned interpolation:2; + + /** + * Was the location explicitly set in the shader? + * + * If the location is explicitly set in the shader, it \b cannot be changed + * by the linker or by the API (e.g., calls to \c glBindAttribLocation have + * no effect). + */ + unsigned explicit_location:1; + + /** + * Precision qualifier. + */ + unsigned precision:2; +}; + /** * Active resource in a gl_shader_program */ @@ -2582,6 +2696,8 @@ struct gl_shader_program */ struct { GLenum BufferMode; + /** Global xfb_stride out qualifier if any */ + GLuint BufferStride[MAX_FEEDBACK_BUFFERS]; GLuint NumVarying; GLchar **VaryingNames; /**< Array [NumVarying] of char * */ } TransformFeedback; @@ -2618,9 +2734,10 @@ struct gl_shader_program * True if gl_ClipDistance is written to. Copied into * gl_tess_eval_program by _mesa_copy_linked_program_data(). */ - GLboolean UsesClipDistance; GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or 0 if not present. */ + GLuint CullDistanceArraySize; /**< Size of the gl_CullDistance array, or + 0 if not present. */ } TessEval; /** @@ -2641,9 +2758,10 @@ struct gl_shader_program * True if gl_ClipDistance is written to. Copied into * gl_geometry_program by _mesa_copy_linked_program_data(). */ - GLboolean UsesClipDistance; GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or 0 if not present. */ + GLuint CullDistanceArraySize; /**< Size of the gl_CullDistance array, or + 0 if not present. */ bool UsesEndPrimitive; bool UsesStreams; } Geom; @@ -2654,9 +2772,10 @@ struct gl_shader_program * True if gl_ClipDistance is written to. Copied into gl_vertex_program * by _mesa_copy_linked_program_data(). */ - GLboolean UsesClipDistance; GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or 0 if not present. */ + GLuint CullDistanceArraySize; /**< Size of the gl_CullDistance array, or + 0 if not present. */ } Vert; /** @@ -2669,6 +2788,10 @@ struct gl_shader_program * local_size_{x,y,z}. Otherwise undefined. */ unsigned LocalSize[3]; + /** + * Size of shared variables accessed by the compute shader. + */ + unsigned SharedSize; } Comp; /* post-link info: */ @@ -2684,23 +2807,25 @@ struct gl_shader_program unsigned NumUniformRemapTable; struct gl_uniform_storage **UniformRemapTable; + /** + * Sometimes there are empty slots left over in UniformRemapTable after we + * allocate slots to explicit locations. This list stores the blocks of + * continuous empty slots inside UniformRemapTable. + */ + struct exec_list EmptyUniformLocations; + /** * Size of the gl_ClipDistance array that is output from the last pipeline * stage before the fragment shader. */ unsigned LastClipDistanceArraySize; + unsigned LastCullDistanceArraySize; unsigned NumUniformBlocks; struct gl_uniform_block *UniformBlocks; - /** - * Indices into the _LinkedShaders's UniformBlocks[] array for each stage - * they're used in, or -1. - * - * This is used to maintain the Binding values of the stage's UniformBlocks[] - * and to answer the GL_UNIFORM_BLOCK_REFERENCED_BY_*_SHADER queries. - */ - int *UniformBlockStageIndex[MESA_SHADER_STAGES]; + unsigned NumShaderStorageBlocks; + struct gl_uniform_block *ShaderStorageBlocks; /** * Map of active uniform names to locations @@ -2819,7 +2944,6 @@ struct gl_pipeline_shader_state struct gl_shader_compiler_options { /** Driver-selectable options: */ - GLboolean EmitCondCodes; /**< Use condition codes? */ GLboolean EmitNoLoops; GLboolean EmitNoFunctions; GLboolean EmitNoCont; /**< Emit CONT opcode? */ @@ -2827,7 +2951,10 @@ struct gl_shader_compiler_options GLboolean EmitNoNoise; /**< Emit NOISE opcodes? */ GLboolean EmitNoPow; /**< Emit POW opcodes? */ GLboolean EmitNoSat; /**< Emit SAT opcodes? */ - GLboolean LowerClipDistance; /**< Lower gl_ClipDistance from float[8] to vec4[2]? */ + GLboolean LowerCombinedClipCullDistance; /** Lower gl_ClipDistance and + * gl_CullDistance together from + * float[8] to vec4[2] + **/ /** * \name Forms of indirect addressing the driver cannot do. @@ -2852,6 +2979,14 @@ struct gl_shader_compiler_options */ GLboolean OptimizeForAOS; + GLboolean LowerBufferInterfaceBlocks; /**< Lower UBO and SSBO access to intrinsics. */ + + /** Clamp UBO and SSBO block indices so they don't go out-of-bounds. */ + GLboolean ClampBlockIndicesToArrayBounds; + + GLboolean LowerShaderSharedVariables; /**< Lower compute shader shared + * variable access to intrinsics. */ + const struct nir_shader_compiler_options *NirOptions; }; @@ -2922,6 +3057,7 @@ struct gl_shared_state mtx_t Mutex; /**< for thread safety */ GLint RefCount; /**< Reference count */ struct _mesa_HashTable *DisplayList; /**< Display lists hash table */ + struct _mesa_HashTable *BitmapAtlas; /**< For optimized glBitmap text */ struct _mesa_HashTable *TexObjects; /**< Texture objects hash table */ /** Default texture objects (shared by all texture units) */ @@ -3106,6 +3242,10 @@ struct gl_framebuffer struct { GLuint Width, Height, Layers, NumSamples; GLboolean FixedSampleLocations; + /* Derived from NumSamples by the driver so that it can choose a valid + * value for the hardware. + */ + GLuint _NumSamples; } DefaultGeometry; /** \name Drawing bounds (Intersection of buffer size and scissor box) @@ -3371,7 +3511,7 @@ struct gl_constants */ GLuint MaxUserAssignableUniformLocations; - /** GL_ARB_geometry_shader4 */ + /** geometry shader */ GLuint MaxGeometryOutputVertices; GLuint MaxGeometryTotalOutputComponents; @@ -3423,6 +3563,9 @@ struct gl_constants /** GL_EXT_provoking_vertex */ GLboolean QuadsFollowProvokingVertexConvention; + /** GL_ARB_viewport_array */ + GLenum LayerAndVPIndexProvokingVertex; + /** OpenGL version 3.0 */ GLbitfield ContextFlags; /**< Ex: GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */ @@ -3474,6 +3617,10 @@ struct gl_constants */ GLboolean GLSLSkipStrictMaxUniformLimitCheck; + /** Whether gl_FragCoord and gl_FrontFacing are system values. */ + bool GLSLFragCoordIsSysVal; + bool GLSLFrontFacingIsSysVal; + /** * Always use the GetTransformFeedbackVertexCount() driver hook, rather * than passing the transform feedback object to the drawing function. @@ -3555,11 +3702,24 @@ struct gl_constants * below: * SampleMap8x = {a, b, c, d, e, f, g, h}; * - * Follow the logic for other sample counts. + * Follow the logic for sample counts 2-8. + * + * For 16x the sample indices layout as a 4x4 grid as follows: + * + * ----------------- + * | 0 | 1 | 2 | 3 | + * ----------------- + * | 4 | 5 | 6 | 7 | + * ----------------- + * | 8 | 9 |10 |11 | + * ----------------- + * |12 |13 |14 |15 | + * ----------------- */ uint8_t SampleMap2x[2]; uint8_t SampleMap4x[4]; uint8_t SampleMap8x[8]; + uint8_t SampleMap16x[16]; /** GL_ARB_shader_atomic_counters */ GLuint MaxAtomicBufferBindings; @@ -3581,6 +3741,7 @@ struct gl_constants GLuint MaxComputeWorkGroupCount[3]; /* Array of x, y, z dimensions */ GLuint MaxComputeWorkGroupSize[3]; /* Array of x, y, z dimensions */ GLuint MaxComputeWorkGroupInvocations; + GLuint MaxComputeSharedMemorySize; /** GL_ARB_gpu_shader5 */ GLfloat MinFragmentInterpolationOffset; @@ -3599,6 +3760,12 @@ struct gl_constants GLuint MaxTessPatchComponents; GLuint MaxTessControlTotalOutputComponents; bool LowerTessLevel; /**< Lower gl_TessLevel* from float[n] to vecn? */ + bool LowerTCSPatchVerticesIn; /**< Lower gl_PatchVerticesIn to a uniform */ + bool LowerTESPatchVerticesIn; /**< Lower gl_PatchVerticesIn to a uniform */ + bool PrimitiveRestartForPatches; + bool LowerCsDerivedVariables; /**< Lower gl_GlobalInvocationID and + * gl_LocalInvocationIndex based on + * other builtin variables. */ }; @@ -3614,6 +3781,8 @@ struct gl_extensions GLboolean ANGLE_texture_compression_dxt; GLboolean ARB_ES2_compatibility; GLboolean ARB_ES3_compatibility; + GLboolean ARB_ES3_1_compatibility; + GLboolean ARB_ES3_2_compatibility; GLboolean ARB_arrays_of_arrays; GLboolean ARB_base_instance; GLboolean ARB_blend_func_extended; @@ -3625,6 +3794,7 @@ struct gl_extensions GLboolean ARB_conditional_render_inverted; GLboolean ARB_conservative_depth; GLboolean ARB_copy_image; + GLboolean ARB_cull_distance; GLboolean ARB_depth_buffer_float; GLboolean ARB_depth_clamp; GLboolean ARB_depth_texture; @@ -3640,29 +3810,38 @@ struct gl_extensions GLboolean ARB_fragment_shader; GLboolean ARB_framebuffer_no_attachments; GLboolean ARB_framebuffer_object; + GLboolean ARB_enhanced_layouts; GLboolean ARB_explicit_attrib_location; GLboolean ARB_explicit_uniform_location; - GLboolean ARB_geometry_shader4; GLboolean ARB_gpu_shader5; GLboolean ARB_gpu_shader_fp64; GLboolean ARB_half_float_vertex; + GLboolean ARB_indirect_parameters; GLboolean ARB_instanced_arrays; GLboolean ARB_internalformat_query; + GLboolean ARB_internalformat_query2; GLboolean ARB_map_buffer_range; GLboolean ARB_occlusion_query; GLboolean ARB_occlusion_query2; GLboolean ARB_pipeline_statistics_query; GLboolean ARB_point_sprite; + GLboolean ARB_query_buffer_object; + GLboolean ARB_robust_buffer_access_behavior; GLboolean ARB_sample_shading; GLboolean ARB_seamless_cube_map; + GLboolean ARB_shader_atomic_counter_ops; GLboolean ARB_shader_atomic_counters; GLboolean ARB_shader_bit_encoding; + GLboolean ARB_shader_clock; + GLboolean ARB_shader_draw_parameters; + GLboolean ARB_shader_group_vote; GLboolean ARB_shader_image_load_store; GLboolean ARB_shader_image_size; GLboolean ARB_shader_precision; GLboolean ARB_shader_stencil_export; GLboolean ARB_shader_storage_buffer_object; GLboolean ARB_shader_subroutine; + GLboolean ARB_shader_texture_image_samples; GLboolean ARB_shader_texture_lod; GLboolean ARB_shading_language_packing; GLboolean ARB_shading_language_420pack; @@ -3720,8 +3899,8 @@ struct gl_extensions GLboolean EXT_polygon_offset_clamp; GLboolean EXT_provoking_vertex; GLboolean EXT_shader_integer_mix; + GLboolean EXT_shader_samples_identical; GLboolean EXT_stencil_two_side; - GLboolean EXT_texture3D; GLboolean EXT_texture_array; GLboolean EXT_texture_compression_latc; GLboolean EXT_texture_compression_s3tc; @@ -3737,7 +3916,11 @@ struct gl_extensions GLboolean EXT_transform_feedback; GLboolean EXT_timer_query; GLboolean EXT_vertex_array_bgra; + GLboolean OES_copy_image; + GLboolean OES_sample_variables; + GLboolean OES_shader_io_blocks; GLboolean OES_standard_derivatives; + GLboolean OES_texture_buffer; /* vendor extensions */ GLboolean AMD_performance_monitor; GLboolean AMD_pinned_memory; @@ -3745,25 +3928,28 @@ struct gl_extensions GLboolean AMD_vertex_shader_layer; GLboolean AMD_vertex_shader_viewport_index; GLboolean APPLE_object_purgeable; + GLboolean ATI_meminfo; GLboolean ATI_texture_compression_3dc; GLboolean ATI_texture_mirror_once; GLboolean ATI_texture_env_combine3; GLboolean ATI_fragment_shader; GLboolean ATI_separate_stencil; + GLboolean GREMEDY_string_marker; GLboolean INTEL_performance_query; + GLboolean KHR_robustness; GLboolean KHR_texture_compression_astc_hdr; GLboolean KHR_texture_compression_astc_ldr; GLboolean MESA_pack_invert; GLboolean MESA_ycbcr_texture; GLboolean NV_conditional_render; GLboolean NV_fog_distance; - GLboolean NV_fragment_program_option; GLboolean NV_point_sprite; GLboolean NV_primitive_restart; GLboolean NV_texture_barrier; GLboolean NV_texture_env_combine4; GLboolean NV_texture_rectangle; GLboolean NV_vdpau_interop; + GLboolean NVX_gpu_memory_info; GLboolean TDFX_texture_compression_FXT1; GLboolean OES_EGL_image; GLboolean OES_draw_texture; @@ -3774,11 +3960,19 @@ struct gl_extensions GLboolean OES_texture_half_float; GLboolean OES_texture_half_float_linear; GLboolean OES_compressed_ETC1_RGB8_texture; + GLboolean OES_geometry_shader; + GLboolean OES_texture_compression_astc; GLboolean extension_sentinel; /** The extension string */ const GLubyte *String; /** Number of supported extensions */ GLuint Count; + /** + * The context version which extension helper functions compare against. + * By default, the value is equal to ctx->Version. This changes to ~0 + * while meta is in progress. + */ + GLubyte Version; }; @@ -3815,38 +4009,38 @@ struct gl_matrix_stack * \name Bits to indicate what state has changed. */ /*@{*/ -#define _NEW_MODELVIEW (1 << 0) /**< gl_context::ModelView */ -#define _NEW_PROJECTION (1 << 1) /**< gl_context::Projection */ -#define _NEW_TEXTURE_MATRIX (1 << 2) /**< gl_context::TextureMatrix */ -#define _NEW_COLOR (1 << 3) /**< gl_context::Color */ -#define _NEW_DEPTH (1 << 4) /**< gl_context::Depth */ -#define _NEW_EVAL (1 << 5) /**< gl_context::Eval, EvalMap */ -#define _NEW_FOG (1 << 6) /**< gl_context::Fog */ -#define _NEW_HINT (1 << 7) /**< gl_context::Hint */ -#define _NEW_LIGHT (1 << 8) /**< gl_context::Light */ -#define _NEW_LINE (1 << 9) /**< gl_context::Line */ -#define _NEW_PIXEL (1 << 10) /**< gl_context::Pixel */ -#define _NEW_POINT (1 << 11) /**< gl_context::Point */ -#define _NEW_POLYGON (1 << 12) /**< gl_context::Polygon */ -#define _NEW_POLYGONSTIPPLE (1 << 13) /**< gl_context::PolygonStipple */ -#define _NEW_SCISSOR (1 << 14) /**< gl_context::Scissor */ -#define _NEW_STENCIL (1 << 15) /**< gl_context::Stencil */ -#define _NEW_TEXTURE (1 << 16) /**< gl_context::Texture */ -#define _NEW_TRANSFORM (1 << 17) /**< gl_context::Transform */ -#define _NEW_VIEWPORT (1 << 18) /**< gl_context::Viewport */ +#define _NEW_MODELVIEW (1u << 0) /**< gl_context::ModelView */ +#define _NEW_PROJECTION (1u << 1) /**< gl_context::Projection */ +#define _NEW_TEXTURE_MATRIX (1u << 2) /**< gl_context::TextureMatrix */ +#define _NEW_COLOR (1u << 3) /**< gl_context::Color */ +#define _NEW_DEPTH (1u << 4) /**< gl_context::Depth */ +#define _NEW_EVAL (1u << 5) /**< gl_context::Eval, EvalMap */ +#define _NEW_FOG (1u << 6) /**< gl_context::Fog */ +#define _NEW_HINT (1u << 7) /**< gl_context::Hint */ +#define _NEW_LIGHT (1u << 8) /**< gl_context::Light */ +#define _NEW_LINE (1u << 9) /**< gl_context::Line */ +#define _NEW_PIXEL (1u << 10) /**< gl_context::Pixel */ +#define _NEW_POINT (1u << 11) /**< gl_context::Point */ +#define _NEW_POLYGON (1u << 12) /**< gl_context::Polygon */ +#define _NEW_POLYGONSTIPPLE (1u << 13) /**< gl_context::PolygonStipple */ +#define _NEW_SCISSOR (1u << 14) /**< gl_context::Scissor */ +#define _NEW_STENCIL (1u << 15) /**< gl_context::Stencil */ +#define _NEW_TEXTURE (1u << 16) /**< gl_context::Texture */ +#define _NEW_TRANSFORM (1u << 17) /**< gl_context::Transform */ +#define _NEW_VIEWPORT (1u << 18) /**< gl_context::Viewport */ /* gap, re-use for core Mesa state only; use ctx->DriverFlags otherwise */ -#define _NEW_ARRAY (1 << 20) /**< gl_context::Array */ -#define _NEW_RENDERMODE (1 << 21) /**< gl_context::RenderMode, etc */ -#define _NEW_BUFFERS (1 << 22) /**< gl_context::Visual, DrawBuffer, */ -#define _NEW_CURRENT_ATTRIB (1 << 23) /**< gl_context::Current */ -#define _NEW_MULTISAMPLE (1 << 24) /**< gl_context::Multisample */ -#define _NEW_TRACK_MATRIX (1 << 25) /**< gl_context::VertexProgram */ -#define _NEW_PROGRAM (1 << 26) /**< New program/shader state */ -#define _NEW_PROGRAM_CONSTANTS (1 << 27) -#define _NEW_BUFFER_OBJECT (1 << 28) -#define _NEW_FRAG_CLAMP (1 << 29) +#define _NEW_ARRAY (1u << 20) /**< gl_context::Array */ +#define _NEW_RENDERMODE (1u << 21) /**< gl_context::RenderMode, etc */ +#define _NEW_BUFFERS (1u << 22) /**< gl_context::Visual, DrawBuffer, */ +#define _NEW_CURRENT_ATTRIB (1u << 23) /**< gl_context::Current */ +#define _NEW_MULTISAMPLE (1u << 24) /**< gl_context::Multisample */ +#define _NEW_TRACK_MATRIX (1u << 25) /**< gl_context::VertexProgram */ +#define _NEW_PROGRAM (1u << 26) /**< New program/shader state */ +#define _NEW_PROGRAM_CONSTANTS (1u << 27) +#define _NEW_BUFFER_OBJECT (1u << 28) +#define _NEW_FRAG_CLAMP (1u << 29) /* gap, re-use for core Mesa state only; use ctx->DriverFlags otherwise */ -#define _NEW_VARYING_VP_INPUTS (1 << 31) /**< gl_context::varying_vp_inputs */ +#define _NEW_VARYING_VP_INPUTS (1u << 31) /**< gl_context::varying_vp_inputs */ #define _NEW_ALL ~0 /*@}*/ @@ -4070,13 +4264,6 @@ struct gl_image_unit */ GLboolean Layered; - /** - * GL_TRUE if the state of this image unit is valid and access from - * the shader is allowed. Otherwise loads from this unit should - * return zero and stores should have no effect. - */ - GLboolean _Valid; - /** * Layer of the texture object bound to this unit as specified by the * application. @@ -4153,7 +4340,11 @@ struct gl_context */ struct _glapi_table *BeginEnd; /** - * Tracks the current dispatch table out of the 3 above, so that it can be + * Dispatch table for when a graphics reset has happened. + */ + struct _glapi_table *ContextLost; + /** + * Tracks the current dispatch table out of the 4 above, so that it can be * re-set on glXMakeCurrent(). */ struct _glapi_table *CurrentDispatch; @@ -4292,10 +4483,14 @@ struct gl_context struct gl_perf_monitor_state PerfMonitor; struct gl_buffer_object *DrawIndirectBuffer; /** < GL_ARB_draw_indirect */ + struct gl_buffer_object *ParameterBuffer; /** < GL_ARB_indirect_parameters */ + struct gl_buffer_object *DispatchIndirectBuffer; /** < GL_ARB_compute_shader */ struct gl_buffer_object *CopyReadBuffer; /**< GL_ARB_copy_buffer */ struct gl_buffer_object *CopyWriteBuffer; /**< GL_ARB_copy_buffer */ + struct gl_buffer_object *QueryBuffer; /**< GL_ARB_query_buffer_object */ + /** * Current GL_ARB_uniform_buffer_object binding referenced by * GL_UNIFORM_BUFFER target for glBufferData, glMapBuffer, etc. @@ -4438,6 +4633,18 @@ struct gl_context GLboolean ShareGroupReset; }; +/** + * Information about memory usage. All sizes are in kilobytes. + */ +struct gl_memory_info +{ + unsigned total_device_memory; /**< size of device memory, e.g. VRAM */ + unsigned avail_device_memory; /**< free device memory at the moment */ + unsigned total_staging_memory; /**< size of staging memory, e.g. GART */ + unsigned avail_staging_memory; /**< free staging memory at the moment */ + unsigned device_memory_evicted; /**< size of memory evicted (monotonic counter) */ + unsigned nr_device_memory_evictions; /**< # of evictions (monotonic counter) */ +}; #ifdef DEBUG extern int MESA_VERBOSE; @@ -4479,13 +4686,6 @@ enum _debug DEBUG_INCOMPLETE_FBO = (1 << 3) }; -static inline bool -_mesa_active_fragment_shader_has_atomic_ops(const struct gl_context *ctx) -{ - return ctx->Shader._CurrentFragmentProgram != NULL && - ctx->Shader._CurrentFragmentProgram->NumAtomicBuffers > 0; -} - #ifdef __cplusplus } #endif