X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fmtypes.h;h=46137f5d4ae70d1d3b2818b14f7df4d90b2879b4;hb=ca721b3d894a49d7342f5aa053ed132017e9352a;hp=96775824ea67948bbb92d8cec7f6933d4150b3ee;hpb=3e789026cae21e56d07e21773bd6b34f32e31b4d;p=mesa.git diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 96775824ea6..46137f5d4ae 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -46,7 +46,6 @@ #include "compiler/shader_info.h" #include "main/formats.h" /* MESA_FORMAT_COUNT */ #include "compiler/glsl/list.h" -#include "util/bitscan.h" #include "util/simple_mtx.h" #include "util/u_dynarray.h" @@ -82,6 +81,10 @@ typedef GLuint64 GLbitfield64; (BITFIELD64_MASK((b) + (count)) & ~BITFIELD64_MASK(b)) +#define GET_COLORMASK_BIT(mask, buf, chan) (((mask) >> (4 * (buf) + (chan))) & 0x1) +#define GET_COLORMASK(mask, buf) (((mask) >> (4 * (buf))) & 0xf) + + /** * \name Some forward type declarations */ @@ -98,8 +101,8 @@ struct st_context; struct gl_uniform_storage; struct prog_instruction; struct gl_program_parameter_list; +struct gl_shader_spirv_data; struct set; -struct set_entry; struct vbo_context; /*@}*/ @@ -243,7 +246,7 @@ struct gl_config /* ARB_multisample / SGIS_multisample */ GLint sampleBuffers; - GLint samples; + GLuint samples; /* SGIX_pbuffer / GLX 1.3 */ GLint maxPbufferWidth; @@ -271,11 +274,11 @@ struct gl_config * \name Bit flags used for updating material values. */ /*@{*/ -#define MAT_ATTRIB_FRONT_AMBIENT 0 +#define MAT_ATTRIB_FRONT_AMBIENT 0 #define MAT_ATTRIB_BACK_AMBIENT 1 -#define MAT_ATTRIB_FRONT_DIFFUSE 2 +#define MAT_ATTRIB_FRONT_DIFFUSE 2 #define MAT_ATTRIB_BACK_DIFFUSE 3 -#define MAT_ATTRIB_FRONT_SPECULAR 4 +#define MAT_ATTRIB_FRONT_SPECULAR 4 #define MAT_ATTRIB_BACK_SPECULAR 5 #define MAT_ATTRIB_FRONT_EMISSION 6 #define MAT_ATTRIB_BACK_EMISSION 7 @@ -285,16 +288,12 @@ struct gl_config #define MAT_ATTRIB_BACK_INDEXES 11 #define MAT_ATTRIB_MAX 12 -#define MAT_ATTRIB_AMBIENT(f) (MAT_ATTRIB_FRONT_AMBIENT+(f)) -#define MAT_ATTRIB_DIFFUSE(f) (MAT_ATTRIB_FRONT_DIFFUSE+(f)) -#define MAT_ATTRIB_SPECULAR(f) (MAT_ATTRIB_FRONT_SPECULAR+(f)) -#define MAT_ATTRIB_EMISSION(f) (MAT_ATTRIB_FRONT_EMISSION+(f)) +#define MAT_ATTRIB_AMBIENT(f) (MAT_ATTRIB_FRONT_AMBIENT+(f)) +#define MAT_ATTRIB_DIFFUSE(f) (MAT_ATTRIB_FRONT_DIFFUSE+(f)) +#define MAT_ATTRIB_SPECULAR(f) (MAT_ATTRIB_FRONT_SPECULAR+(f)) +#define MAT_ATTRIB_EMISSION(f) (MAT_ATTRIB_FRONT_EMISSION+(f)) #define MAT_ATTRIB_SHININESS(f)(MAT_ATTRIB_FRONT_SHININESS+(f)) -#define MAT_ATTRIB_INDEXES(f) (MAT_ATTRIB_FRONT_INDEXES+(f)) - -#define MAT_INDEX_AMBIENT 0 -#define MAT_INDEX_DIFFUSE 1 -#define MAT_INDEX_SPECULAR 2 +#define MAT_ATTRIB_INDEXES(f) (MAT_ATTRIB_FRONT_INDEXES+(f)) #define MAT_BIT_FRONT_AMBIENT (1<> (2 * src_bit + dst_bit)) & 1 + * + * For the GL enums, the result is: + * + * result_bit = logic_op & (1 << (2 * src_bit + dst_bit)) + */ +enum PACKED gl_logicop_mode { + COLOR_LOGICOP_CLEAR = 0, + COLOR_LOGICOP_NOR = 1, + COLOR_LOGICOP_AND_INVERTED = 2, + COLOR_LOGICOP_COPY_INVERTED = 3, + COLOR_LOGICOP_AND_REVERSE = 4, + COLOR_LOGICOP_INVERT = 5, + COLOR_LOGICOP_XOR = 6, + COLOR_LOGICOP_NAND = 7, + COLOR_LOGICOP_AND = 8, + COLOR_LOGICOP_EQUIV = 9, + COLOR_LOGICOP_NOOP = 10, + COLOR_LOGICOP_OR_INVERTED = 11, + COLOR_LOGICOP_COPY = 12, + COLOR_LOGICOP_OR_REVERSE = 13, + COLOR_LOGICOP_OR = 14, + COLOR_LOGICOP_SET = 15 +}; /** * Color buffer attribute group (GL_COLOR_BUFFER_BIT). @@ -427,21 +463,23 @@ struct gl_colorbuffer_attrib GLuint ClearIndex; /**< Index for glClear */ union gl_color_union ClearColor; /**< Color for glClear, unclamped */ GLuint IndexMask; /**< Color index write mask */ - GLubyte ColorMask[MAX_DRAW_BUFFERS][4]; /**< Each flag is 0xff or 0x0 */ - GLenum DrawBuffer[MAX_DRAW_BUFFERS]; /**< Which buffer to draw into */ + /** 4 colormask bits per draw buffer, max 8 draw buffers. 4*8 = 32 bits */ + GLbitfield ColorMask; - /** + GLenum16 DrawBuffer[MAX_DRAW_BUFFERS]; /**< Which buffer to draw into */ + + /** * \name alpha testing */ /*@{*/ GLboolean AlphaEnabled; /**< Alpha test enabled flag */ - GLenum AlphaFunc; /**< Alpha test function */ + GLenum16 AlphaFunc; /**< Alpha test function */ GLfloat AlphaRefUnclamped; GLclampf AlphaRef; /**< Alpha reference value */ /*@}*/ - /** + /** * \name Blending */ /*@{*/ @@ -451,17 +489,17 @@ struct gl_colorbuffer_attrib * control, only on the fixed-pointness of the render target. * The query does however depend on fragment color clamping. */ - GLfloat BlendColorUnclamped[4]; /**< Blending color */ + GLfloat BlendColorUnclamped[4]; /**< Blending color */ GLfloat BlendColor[4]; /**< Blending color */ struct { - GLenum SrcRGB; /**< RGB blend source term */ - GLenum DstRGB; /**< RGB blend dest term */ - GLenum SrcA; /**< Alpha blend source term */ - GLenum DstA; /**< Alpha blend dest term */ - GLenum EquationRGB; /**< GL_ADD, GL_SUBTRACT, etc. */ - GLenum EquationA; /**< GL_ADD, GL_SUBTRACT, etc. */ + GLenum16 SrcRGB; /**< RGB blend source term */ + GLenum16 DstRGB; /**< RGB blend dest term */ + GLenum16 SrcA; /**< Alpha blend source term */ + GLenum16 DstA; /**< Alpha blend dest term */ + GLenum16 EquationRGB; /**< GL_ADD, GL_SUBTRACT, etc. */ + GLenum16 EquationA; /**< GL_ADD, GL_SUBTRACT, etc. */ /** * Set if any blend factor uses SRC1. Computed at the time blend factors * get set. @@ -486,23 +524,23 @@ struct gl_colorbuffer_attrib bool BlendCoherent; /*@}*/ - /** + /** * \name Logic op */ /*@{*/ GLboolean IndexLogicOpEnabled; /**< Color index logic op enabled flag */ GLboolean ColorLogicOpEnabled; /**< RGBA logic op enabled flag */ - GLenum LogicOp; /**< Logic operator */ - + GLenum16 LogicOp; /**< Logic operator */ + enum gl_logicop_mode _LogicOp; /*@}*/ - GLboolean DitherFlag; /**< Dither enable flag */ + GLboolean DitherFlag; /**< Dither enable flag */ - GLboolean _ClampFragmentColor; /** < with GL_FIXED_ONLY_ARB resolved */ - GLenum ClampFragmentColor; /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */ - GLenum ClampReadColor; /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */ + GLboolean _ClampFragmentColor; /** < with GL_FIXED_ONLY_ARB resolved */ + GLenum16 ClampFragmentColor; /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */ + GLenum16 ClampReadColor; /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */ - GLboolean sRGBEnabled; /**< Framebuffer sRGB blending/updating requested */ + GLboolean sRGBEnabled; /**< Framebuffer sRGB blending/updating requested */ }; @@ -514,7 +552,7 @@ struct gl_current_attrib /** * \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 + * \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 */ @@ -538,7 +576,7 @@ struct gl_current_attrib */ struct gl_depthbuffer_attrib { - GLenum Func; /**< Function for depth buffer compare */ + GLenum16 Func; /**< Function for depth buffer compare */ GLclampd Clear; /**< Value to clear depth buffer to */ GLboolean Test; /**< Depth buffering enabled flag */ GLboolean Mask; /**< Depth buffer writable? */ @@ -553,7 +591,7 @@ struct gl_depthbuffer_attrib struct gl_eval_attrib { /** - * \name Enable bits + * \name Enable bits */ /*@{*/ GLboolean Map1Color4; @@ -576,7 +614,7 @@ struct gl_eval_attrib GLboolean Map2Vertex4; GLboolean AutoNormal; /*@}*/ - + /** * \name Map Grid endpoints and divisions and calculated du values */ @@ -617,28 +655,27 @@ struct gl_fog_attrib GLfloat Start; /**< Start distance in eye coords */ GLfloat End; /**< End distance in eye coords */ GLfloat Index; /**< Fog index */ - GLenum Mode; /**< Fog mode */ - GLenum FogCoordinateSource; /**< GL_EXT_fog_coord */ - GLfloat _Scale; /**< (End == Start) ? 1.0 : 1.0 / (End - Start) */ - GLenum FogDistanceMode; /**< GL_NV_fog_distance */ + GLenum16 Mode; /**< Fog mode */ + GLenum16 FogCoordinateSource;/**< GL_EXT_fog_coord */ + GLenum16 FogDistanceMode; /**< GL_NV_fog_distance */ }; -/** +/** * Hint attribute group (GL_HINT_BIT). - * + * * Values are always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE. */ struct gl_hint_attrib { - GLenum PerspectiveCorrection; - GLenum PointSmooth; - GLenum LineSmooth; - GLenum PolygonSmooth; - GLenum Fog; - GLenum TextureCompression; /**< GL_ARB_texture_compression */ - GLenum GenerateMipmap; /**< GL_SGIS_generate_mipmap */ - GLenum FragmentShaderDerivative; /**< GL_ARB_fragment_shader */ + GLenum16 PerspectiveCorrection; + GLenum16 PointSmooth; + GLenum16 LineSmooth; + GLenum16 PolygonSmooth; + GLenum16 Fog; + GLenum16 TextureCompression; /**< GL_ARB_texture_compression */ + GLenum16 GenerateMipmap; /**< GL_SGIS_generate_mipmap */ + GLenum16 FragmentShaderDerivative; /**< GL_ARB_fragment_shader */ }; @@ -659,23 +696,23 @@ struct gl_light_attrib GLboolean Enabled; /**< Lighting enabled flag */ GLboolean ColorMaterialEnabled; - GLenum ShadeModel; /**< GL_FLAT or GL_SMOOTH */ - GLenum ProvokingVertex; /**< GL_EXT_provoking_vertex */ - GLenum ColorMaterialFace; /**< GL_FRONT, BACK or FRONT_AND_BACK */ - GLenum ColorMaterialMode; /**< GL_AMBIENT, GL_DIFFUSE, etc */ + GLenum16 ShadeModel; /**< GL_FLAT or GL_SMOOTH */ + GLenum16 ProvokingVertex; /**< GL_EXT_provoking_vertex */ + GLenum16 ColorMaterialFace; /**< GL_FRONT, BACK or FRONT_AND_BACK */ + GLenum16 ColorMaterialMode; /**< GL_AMBIENT, GL_DIFFUSE, etc */ GLbitfield _ColorMaterialBitmask; /**< bitmask formed from Face and Mode */ GLboolean _ClampVertexColor; - GLenum ClampVertexColor; /**< GL_TRUE, GL_FALSE, GL_FIXED_ONLY */ + GLenum16 ClampVertexColor; /**< GL_TRUE, GL_FALSE, GL_FIXED_ONLY */ - /** - * Derived state for optimizations: + /** + * Derived state for optimizations: */ /*@{*/ GLbitfield _EnabledLights; /**< bitmask containing enabled lights */ - GLboolean _NeedEyeCoords; + GLboolean _NeedEyeCoords; GLboolean _NeedVertices; /**< Use fast shader? */ GLfloat _BaseColor[2][3]; @@ -761,7 +798,7 @@ struct gl_pixelmaps */ struct gl_pixel_attrib { - GLenum ReadBuffer; /**< source buffer for glRead/CopyPixels() */ + GLenum16 ReadBuffer; /**< source buffer for glRead/CopyPixels() */ /*--- Begin Pixel Transfer State ---*/ /* Fields are in the order in which they're applied... */ @@ -801,8 +838,8 @@ struct gl_point_attrib GLboolean _Attenuated; /**< True if Params != [1, 0, 0] */ GLboolean PointSprite; /**< GL_NV/ARB_point_sprite */ GLbitfield CoordReplace; /**< GL_ARB_point_sprite*/ - GLenum SpriteRMode; /**< GL_NV_point_sprite (only!) */ - GLenum SpriteOrigin; /**< GL_ARB_point_sprite */ + GLenum16 SpriteRMode; /**< GL_NV_point_sprite (only!) */ + GLenum16 SpriteOrigin; /**< GL_ARB_point_sprite */ }; @@ -811,13 +848,13 @@ struct gl_point_attrib */ struct gl_polygon_attrib { - GLenum FrontFace; /**< Either GL_CW or GL_CCW */ + GLenum16 FrontFace; /**< Either GL_CW or GL_CCW */ GLenum FrontMode; /**< Either GL_POINT, GL_LINE or GL_FILL */ GLenum BackMode; /**< Either GL_POINT, GL_LINE or GL_FILL */ GLboolean CullFlag; /**< Culling on/off flag */ GLboolean SmoothFlag; /**< True if GL_POLYGON_SMOOTH is enabled */ GLboolean StippleFlag; /**< True if GL_POLYGON_STIPPLE is enabled */ - GLenum CullFaceMode; /**< Culling mode GL_FRONT or GL_BACK */ + GLenum16 CullFaceMode; /**< Culling mode GL_FRONT or GL_BACK */ GLfloat OffsetFactor; /**< Polygon offset factor, from user */ GLfloat OffsetUnits; /**< Polygon offset units, from user */ GLfloat OffsetClamp; /**< Polygon offset clamp, from user */ @@ -835,12 +872,14 @@ struct gl_scissor_rect GLint X, Y; /**< Lower left corner of box */ GLsizei Width, Height; /**< Size of box */ }; + + struct gl_scissor_attrib { GLbitfield EnableFlags; /**< Scissor test enabled? */ struct gl_scissor_rect ScissorArray[MAX_VIEWPORTS]; GLint NumWindowRects; /**< Count of enabled window rectangles */ - GLenum WindowRectMode; /**< Whether to include or exclude the rects */ + GLenum16 WindowRectMode; /**< Whether to include or exclude the rects */ struct gl_scissor_rect WindowRects[MAX_WINDOW_RECTANGLES]; }; @@ -867,10 +906,10 @@ struct gl_stencil_attrib GLboolean TestTwoSide; /**< GL_EXT_stencil_two_side */ GLubyte ActiveFace; /**< GL_EXT_stencil_two_side (0 or 2) */ GLubyte _BackFace; /**< Current back stencil state (1 or 2) */ - GLenum Function[3]; /**< Stencil function */ - GLenum FailFunc[3]; /**< Fail function */ - GLenum ZPassFunc[3]; /**< Depth buffer pass function */ - GLenum ZFailFunc[3]; /**< Depth buffer fail function */ + GLenum16 Function[3]; /**< Stencil function */ + GLenum16 FailFunc[3]; /**< Fail function */ + GLenum16 ZPassFunc[3]; /**< Depth buffer pass function */ + GLenum16 ZFailFunc[3]; /**< Depth buffer fail function */ GLint Ref[3]; /**< Reference value */ GLuint ValueMask[3]; /**< Value mask */ GLuint WriteMask[3]; /**< Write mask */ @@ -927,12 +966,12 @@ typedef enum struct gl_texture_image { GLint InternalFormat; /**< Internal format as given by the user */ - GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_ALPHA, - * GL_LUMINANCE, GL_LUMINANCE_ALPHA, - * GL_INTENSITY, GL_DEPTH_COMPONENT or - * GL_DEPTH_STENCIL_EXT only. Used for - * choosing TexEnv arithmetic. - */ + GLenum16 _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_ALPHA, + * GL_LUMINANCE, GL_LUMINANCE_ALPHA, + * GL_INTENSITY, GL_DEPTH_COMPONENT or + * GL_DEPTH_STENCIL_EXT only. Used for + * choosing TexEnv arithmetic. + */ mesa_format TexFormat; /**< The actual texture memory format */ GLuint Border; /**< 0 or 1 */ @@ -985,19 +1024,19 @@ struct gl_sampler_object GLint RefCount; GLchar *Label; /**< GL_KHR_debug */ - GLenum WrapS; /**< S-axis texture image wrap mode */ - GLenum WrapT; /**< T-axis texture image wrap mode */ - GLenum WrapR; /**< R-axis texture image wrap mode */ - GLenum MinFilter; /**< minification filter */ - GLenum MagFilter; /**< magnification filter */ + GLenum16 WrapS; /**< S-axis texture image wrap mode */ + GLenum16 WrapT; /**< T-axis texture image wrap mode */ + GLenum16 WrapR; /**< R-axis texture image wrap mode */ + GLenum16 MinFilter; /**< minification filter */ + GLenum16 MagFilter; /**< magnification filter */ union gl_color_union BorderColor; /**< Interpreted according to texture format */ GLfloat MinLod; /**< min lambda, OpenGL 1.2 */ GLfloat MaxLod; /**< max lambda, OpenGL 1.2 */ GLfloat LodBias; /**< OpenGL 1.4 */ GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ - GLenum CompareMode; /**< GL_ARB_shadow */ - GLenum CompareFunc; /**< GL_ARB_shadow */ - GLenum sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */ + GLenum16 CompareMode; /**< GL_ARB_shadow */ + GLenum16 CompareFunc; /**< GL_ARB_shadow */ + GLenum16 sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */ GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */ /** GL_ARB_bindless_texture */ @@ -1012,17 +1051,17 @@ struct gl_sampler_object */ struct gl_texture_object { - simple_mtx_t Mutex; /**< for thread safety */ - GLint RefCount; /**< reference count */ - GLuint Name; /**< the user-visible texture object ID */ - GLchar *Label; /**< GL_KHR_debug */ - GLenum Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */ + simple_mtx_t Mutex; /**< for thread safety */ + GLint RefCount; /**< reference count */ + GLuint Name; /**< the user-visible texture object ID */ + GLchar *Label; /**< GL_KHR_debug */ + GLenum16 Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */ gl_texture_index TargetIndex; /**< The gl_texture_unit::CurrentTex index. Only valid when Target is valid. */ struct gl_sampler_object Sampler; - GLenum DepthMode; /**< GL_ARB_depth_texture */ + GLenum16 DepthMode; /**< GL_ARB_depth_texture */ GLfloat Priority; /**< in [0,1] */ GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */ @@ -1031,7 +1070,7 @@ struct gl_texture_object GLint _MaxLevel; /**< actual max mipmap level (q in the spec) */ GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - p in spec) */ GLint CropRect[4]; /**< GL_OES_draw_texture */ - GLenum Swizzle[4]; /**< GL_EXT_texture_swizzle */ + GLenum16 Swizzle[4]; /**< GL_EXT_texture_swizzle */ GLuint _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */ GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */ GLboolean _BaseComplete; /**< Is the base texture level valid? */ @@ -1052,14 +1091,14 @@ struct gl_texture_object GLuint NumLayers; /**< GL_ARB_texture_view */ /** GL_EXT_memory_object */ - GLenum TextureTiling; + GLenum16 TextureTiling; /** Actual texture images, indexed by [cube face] and [mipmap level] */ struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS]; /** GL_ARB_texture_buffer_object */ struct gl_buffer_object *BufferObject; - GLenum BufferObjectFormat; + GLenum16 BufferObjectFormat; /** Equivalent Mesa format for BufferObjectFormat. */ mesa_format _BufferObjectFormat; /** GL_ARB_texture_buffer_range */ @@ -1070,7 +1109,7 @@ struct gl_texture_object GLint RequiredTextureImageUnits; /** GL_ARB_shader_image_load_store */ - GLenum ImageFormatCompatibilityType; + GLenum16 ImageFormatCompatibilityType; /** GL_ARB_bindless_texture */ struct util_dynarray SamplerHandles; @@ -1087,14 +1126,14 @@ struct gl_texture_object */ struct gl_tex_env_combine_state { - GLenum ModeRGB; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */ - GLenum ModeA; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */ + GLenum16 ModeRGB; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */ + GLenum16 ModeA; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */ /** Source terms: GL_PRIMARY_COLOR, GL_TEXTURE, etc */ - GLenum SourceRGB[MAX_COMBINER_TERMS]; - GLenum SourceA[MAX_COMBINER_TERMS]; + GLenum16 SourceRGB[MAX_COMBINER_TERMS]; + GLenum16 SourceA[MAX_COMBINER_TERMS]; /** Source operands: GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, etc */ - GLenum OperandRGB[MAX_COMBINER_TERMS]; - GLenum OperandA[MAX_COMBINER_TERMS]; + GLenum16 OperandRGB[MAX_COMBINER_TERMS]; + GLenum16 OperandA[MAX_COMBINER_TERMS]; GLuint ScaleShiftRGB; /**< 0, 1 or 2 */ GLuint ScaleShiftA; /**< 0, 1 or 2 */ GLuint _NumArgsRGB; /**< Number of inputs used for the RGB combiner */ @@ -1171,12 +1210,12 @@ struct gl_tex_env_argument */ struct gl_tex_env_combine_packed { - uint32_t ModeRGB:4; /**< Effective mode for RGB as 4 bits */ - uint32_t ModeA:4; /**< Effective mode for RGB as 4 bits */ - uint32_t ScaleShiftRGB:2; /**< 0, 1 or 2 */ - uint32_t ScaleShiftA:2; /**< 0, 1 or 2 */ - uint32_t NumArgsRGB:3; /**< Number of inputs used for the RGB combiner */ - uint32_t NumArgsA:3; /**< Number of inputs used for the A combiner */ + uint32_t ModeRGB:4; /**< Effective mode for RGB as 4 bits */ + uint32_t ModeA:4; /**< Effective mode for RGB as 4 bits */ + uint32_t ScaleShiftRGB:2; /**< 0, 1 or 2 */ + uint32_t ScaleShiftA:2; /**< 0, 1 or 2 */ + uint32_t NumArgsRGB:3; /**< Number of inputs used for the RGB combiner */ + uint32_t NumArgsA:3; /**< Number of inputs used for the A combiner */ /** Source arguments in a packed manner */ struct gl_tex_env_argument ArgsRGB[MAX_COMBINER_TERMS]; struct gl_tex_env_argument ArgsA[MAX_COMBINER_TERMS]; @@ -1205,13 +1244,13 @@ struct gl_tex_env_combine_packed #define TEXGEN_REFLECTION_MAP_NV 0x8 #define TEXGEN_NORMAL_MAP_NV 0x10 -#define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \ - TEXGEN_REFLECTION_MAP_NV | \ - TEXGEN_NORMAL_MAP_NV) -#define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \ - TEXGEN_REFLECTION_MAP_NV | \ - TEXGEN_NORMAL_MAP_NV | \ - TEXGEN_EYE_LINEAR) +#define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \ + TEXGEN_REFLECTION_MAP_NV | \ + TEXGEN_NORMAL_MAP_NV) +#define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \ + TEXGEN_REFLECTION_MAP_NV | \ + TEXGEN_NORMAL_MAP_NV | \ + TEXGEN_EYE_LINEAR) /*@}*/ @@ -1228,7 +1267,7 @@ struct gl_tex_env_combine_packed */ struct gl_texgen { - GLenum Mode; /**< GL_EYE_LINEAR, GL_SPHERE_MAP, etc */ + GLenum16 Mode; /**< GL_EYE_LINEAR, GL_SPHERE_MAP, etc */ GLbitfield _ModeBit; /**< TEXGEN_x bit corresponding to Mode */ GLfloat ObjectPlane[4]; GLfloat EyePlane[4]; @@ -1243,7 +1282,7 @@ struct gl_texture_unit { GLbitfield Enabled; /**< bitmask of TEXTURE_*_BIT flags */ - GLenum EnvMode; /**< GL_MODULATE, GL_DECAL, GL_BLEND, etc. */ + GLenum16 EnvMode; /**< GL_MODULATE, GL_DECAL, GL_BLEND, etc. */ GLclampf EnvColor[4]; GLfloat EnvColorUnclamped[4]; @@ -1262,8 +1301,8 @@ struct gl_texture_unit /** Current sampler object (GL_ARB_sampler_objects) */ struct gl_sampler_object *Sampler; - /** - * \name GL_EXT_texture_env_combine + /** + * \name GL_EXT_texture_env_combine */ struct gl_tex_env_combine_state Combine; @@ -1339,7 +1378,7 @@ typedef GLfloat gl_clip_plane[4]; */ struct gl_transform_attrib { - GLenum MatrixMode; /**< Matrix mode */ + GLenum16 MatrixMode; /**< Matrix mode */ gl_clip_plane EyeUserPlane[MAX_CLIP_PLANES]; /**< User clip planes */ gl_clip_plane _ClipUserPlane[MAX_CLIP_PLANES]; /**< derived */ GLbitfield ClipPlanesEnabled; /**< on/off bitmask */ @@ -1348,8 +1387,8 @@ struct gl_transform_attrib GLboolean RasterPositionUnclipped; /**< GL_IBM_rasterpos_clip */ GLboolean DepthClamp; /**< GL_ARB_depth_clamp */ /** GL_ARB_clip_control */ - GLenum ClipOrigin; /**< GL_LOWER_LEFT or GL_UPPER_LEFT */ - GLenum ClipDepthMode; /**< GL_NEGATIVE_ONE_TO_ONE or GL_ZERO_TO_ONE */ + GLenum16 ClipOrigin; /**< GL_LOWER_LEFT or GL_UPPER_LEFT */ + GLenum16 ClipDepthMode;/**< GL_NEGATIVE_ONE_TO_ONE or GL_ZERO_TO_ONE */ }; @@ -1364,10 +1403,10 @@ struct gl_viewport_attrib }; -typedef enum { +typedef enum +{ MAP_USER, MAP_INTERNAL, - MAP_COUNT } gl_map_buffer_index; @@ -1375,18 +1414,20 @@ typedef enum { /** * Fields describing a mapped buffer range. */ -struct gl_buffer_mapping { +struct gl_buffer_mapping +{ GLbitfield AccessFlags; /**< Mask of GL_MAP_x_BIT flags */ - GLvoid *Pointer; /**< User-space address of mapping */ - GLintptr Offset; /**< Mapped offset */ - GLsizeiptr Length; /**< Mapped length */ + GLvoid *Pointer; /**< User-space address of mapping */ + GLintptr Offset; /**< Mapped offset */ + GLsizeiptr Length; /**< Mapped length */ }; /** * Usages we've seen for a buffer object. */ -typedef enum { +typedef enum +{ USAGE_UNIFORM_BUFFER = 0x1, USAGE_TEXTURE_BUFFER = 0x2, USAGE_ATOMIC_COUNTER_BUFFER = 0x4, @@ -1402,11 +1443,10 @@ typedef enum { */ struct gl_buffer_object { - simple_mtx_t Mutex; GLint RefCount; GLuint Name; GLchar *Label; /**< GL_KHR_debug */ - GLenum Usage; /**< GL_STREAM_DRAW_ARB, GL_STREAM_READ_ARB, etc. */ + GLenum16 Usage; /**< GL_STREAM_DRAW_ARB, GL_STREAM_READ_ARB, etc. */ GLbitfield StorageFlags; /**< GL_MAP_PERSISTENT_BIT, etc. */ GLsizeiptrARB Size; /**< Size of buffer storage in bytes */ GLubyte *Data; /**< Location of storage either in RAM or VRAM. */ @@ -1423,6 +1463,7 @@ struct gl_buffer_object struct gl_buffer_mapping Mappings[MAP_COUNT]; /** Memoization of min/max index computations for static index buffers */ + simple_mtx_t MinMaxCacheMutex; struct hash_table *MinMaxCache; unsigned MinMaxCacheHitIndices; unsigned MinMaxCacheMissIndices; @@ -1461,21 +1502,37 @@ struct gl_pixelstore_attrib */ struct gl_vertex_array { - GLint Size; /**< components per element (1,2,3,4) */ - GLenum Type; /**< datatype: GL_FLOAT, GL_INT, etc */ - GLenum Format; /**< default: GL_RGBA, but may be GL_BGRA */ + /** if NULL, vertex data are in user memory */ + struct gl_buffer_object *BufferObj; + /** Pointer into user memory, or offset into the BufferObj */ + const GLubyte *Ptr; GLsizei StrideB; /**< actual stride in bytes */ - GLuint _ElementSize; /**< size of each element in bytes */ - const GLubyte *Ptr; /**< Points to array data */ - GLboolean Normalized; /**< GL_ARB_vertex_program */ - GLboolean Integer; /**< Integer-valued? */ - GLboolean Doubles; /**< double precision values are not converted to floats */ GLuint InstanceDivisor; /**< GL_ARB_instanced_arrays */ - - struct gl_buffer_object *BufferObj;/**< GL_ARB_vertex_buffer_object */ + GLenum16 Type; /**< datatype: GL_FLOAT, GL_INT, etc */ + GLenum16 Format; /**< default: GL_RGBA, but may be GL_BGRA */ + unsigned Size:4; /**< components per element (1,2,3,4) */ + unsigned _ElementSize:8; /**< in bytes, up to 4*sizeof(GLdouble) */ + unsigned Normalized:1; /**< GL_ARB_vertex_program */ + unsigned Integer:1; /**< Integer-valued? */ + unsigned Doubles:1; /**< doubles not converted to floats */ }; +/** + * Enum for defining the mapping for the position/generic0 attribute. + * + * Do not change the order of the values as these are used as + * array indices. + */ +typedef enum +{ + ATTRIBUTE_MAP_MODE_IDENTITY, /**< 1:1 mapping */ + ATTRIBUTE_MAP_MODE_POSITION, /**< get position and generic0 from position */ + ATTRIBUTE_MAP_MODE_GENERIC0, /**< get position and generic0 from generic0 */ + ATTRIBUTE_MAP_MODE_MAX /**< for sizing arrays */ +} gl_attribute_map_mode; + + /** * Attributes to describe a vertex array. * @@ -1491,18 +1548,21 @@ struct gl_vertex_array */ struct gl_array_attributes { - GLint Size; /**< Components per element (1,2,3,4) */ - GLenum Type; /**< Datatype: GL_FLOAT, GL_INT, etc */ - GLenum Format; /**< Default: GL_RGBA, but may be GL_BGRA */ - GLsizei Stride; /**< Stride as specified with gl*Pointer() */ - const GLubyte *Ptr; /**< Points to client array data. Not used when a VBO is bound */ - GLintptr RelativeOffset; /**< Offset of the first element relative to the binding offset */ + /** Points to client array data. Not used when a VBO is bound */ + const GLubyte *Ptr; + /** Offset of the first element relative to the binding offset */ + GLuint RelativeOffset; + GLshort Stride; /**< Stride as specified with gl*Pointer() */ + GLenum16 Type; /**< Datatype: GL_FLOAT, GL_INT, etc */ + GLenum16 Format; /**< Default: GL_RGBA, but may be GL_BGRA */ GLboolean Enabled; /**< Whether the array is enabled */ - GLboolean Normalized; /**< Fixed-point values are normalized when converted to floats */ - GLboolean Integer; /**< Fixed-point values are not converted to floats */ - GLboolean Doubles; /**< double precision values are not converted to floats */ - GLuint _ElementSize; /**< Size of each element in bytes */ - GLuint BufferBindingIndex; /**< Vertex buffer binding */ + GLubyte Size; /**< Components per element (1,2,3,4) */ + unsigned Normalized:1; /**< Fixed-point values are normalized when converted to floats */ + unsigned Integer:1; /**< Fixed-point values are not converted to floats */ + unsigned Doubles:1; /**< double precision values are not converted to floats */ + unsigned _ElementSize:8; /**< Size of each element in bytes */ + /** Index into gl_vertex_array_object::BufferBinding[] array */ + unsigned BufferBindingIndex:6; }; @@ -1542,10 +1602,10 @@ struct gl_vertex_array_object /** * Derived vertex attribute arrays * - * This is a legacy data structure created from gl_vertex_attrib_array and - * gl_vertex_buffer_binding, for compatibility with existing driver code. + * This is a legacy data structure created from gl_array_attributes and + * gl_vertex_buffer_binding, only used by the VBO module at this time. */ - struct gl_vertex_array _VertexAttrib[VERT_ATTRIB_MAX]; + struct gl_vertex_array _VertexArray[VERT_ATTRIB_MAX]; /** Vertex attribute arrays */ struct gl_array_attributes VertexAttrib[VERT_ATTRIB_MAX]; @@ -1559,6 +1619,9 @@ struct gl_vertex_array_object /** Mask of VERT_BIT_* values indicating which arrays are enabled */ GLbitfield _Enabled; + /** Denotes the way the position/generic0 attribute is mapped */ + gl_attribute_map_mode _AttributeMapMode; + /** Mask of VERT_BIT_* values indicating changed/dirty arrays */ GLbitfield NewArrays; @@ -1567,16 +1630,6 @@ struct gl_vertex_array_object }; -/** Used to signal when transitioning from one kind of drawing method - * to another. - */ -typedef enum { - DRAW_NONE, /**< Initial value only */ - DRAW_BEGIN_END, - DRAW_DISPLAY_LIST, - DRAW_ARRAYS -} gl_draw_method; - /** * Enum for the OpenGL APIs we know about and may support. * @@ -1592,6 +1645,7 @@ typedef enum API_OPENGL_LAST = API_OPENGL_CORE } gl_api; + /** * Vertex array state */ @@ -1626,9 +1680,6 @@ struct gl_array_attrib GLuint RestartIndex; /*@}*/ - /** One of the DRAW_xxx flags, not consumed by drivers */ - gl_draw_method DrawMethod; - /* GL_ARB_vertex_buffer_object */ struct gl_buffer_object *ArrayBufferObj; @@ -1649,7 +1700,7 @@ struct gl_array_attrib */ struct gl_feedback { - GLenum Type; + GLenum16 Type; GLbitfield _Mask; /**< FB_* bits */ GLfloat *Buffer; GLuint BufferSize; @@ -1703,7 +1754,7 @@ struct gl_2d_map */ struct gl_evaluators { - /** + /** * \name 1-D maps */ /*@{*/ @@ -1718,8 +1769,8 @@ struct gl_evaluators struct gl_1d_map Map1Texture4; /*@}*/ - /** - * \name 2-D maps + /** + * \name 2-D maps */ /*@{*/ struct gl_2d_map Map2Vertex3; @@ -1738,7 +1789,7 @@ struct gl_evaluators struct gl_transform_feedback_varying_info { char *Name; - GLenum Type; + GLenum16 Type; GLint BufferIndex; GLint Size; GLint Offset; @@ -1871,7 +1922,7 @@ struct gl_transform_feedback_object */ struct gl_transform_feedback_state { - GLenum Mode; /**< GL_POINTS, GL_LINES or GL_TRIANGLES */ + GLenum16 Mode; /**< GL_POINTS, GL_LINES or GL_TRIANGLES */ /** The general binding point (GL_TRANSFORM_FEEDBACK_BUFFER) */ struct gl_buffer_object *CurrentBuffer; @@ -1939,7 +1990,7 @@ struct gl_perf_monitor_counter * Data type of the counter. Valid values are FLOAT, UNSIGNED_INT, * UNSIGNED_INT64_AMD, and PERCENTAGE_AMD. */ - GLenum Type; + GLenum16 Type; /** Minimum counter value. */ union gl_perf_monitor_counter_value Minimum; @@ -2024,6 +2075,7 @@ struct gl_bindless_sampler GLvoid *data; }; + /** * A bindless image object. */ @@ -2036,12 +2088,13 @@ struct gl_bindless_image GLboolean bound; /** Access qualifier (GL_READ_WRITE, GL_READ_ONLY, GL_WRITE_ONLY) */ - GLenum access; + GLenum16 access; /** Pointer to the base of the data. */ GLvoid *data; }; + /** * Names of the various vertex/fragment program register files, etc. * @@ -2087,8 +2140,9 @@ struct gl_program GLint RefCount; GLubyte *String; /**< Null-terminated program text */ - GLenum Target; /**< GL_VERTEX/FRAGMENT_PROGRAM_ARB, GL_GEOMETRY_PROGRAM_NV */ - GLenum Format; /**< String encoding format */ + /** GL_VERTEX/FRAGMENT_PROGRAM_ARB, GL_GEOMETRY_PROGRAM_NV */ + GLenum16 Target; + GLenum16 Format; /**< String encoding format */ GLboolean _Used; /**< Ever used for drawing? Used for debugging */ @@ -2103,11 +2157,16 @@ struct gl_program /** Is this program written to on disk shader cache */ bool program_written_to_cache; - GLbitfield64 SecondaryOutputsWritten; /**< Subset of OutputsWritten outputs written with non-zero index. */ - GLbitfield TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */ - GLbitfield SamplersUsed; /**< Bitfield of which samplers are used */ - GLbitfield ShadowSamplers; /**< Texture units used for shadow sampling. */ - GLbitfield ExternalSamplersUsed; /**< Texture units used for samplerExternalOES */ + /** Subset of OutputsWritten outputs written with non-zero index. */ + GLbitfield64 SecondaryOutputsWritten; + /** TEXTURE_x_BIT bitmask */ + GLbitfield TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS]; + /** Bitfield of which samplers are used */ + GLbitfield SamplersUsed; + /** Texture units used for shadow sampling. */ + GLbitfield ShadowSamplers; + /** Texture units used for samplerExternalOES */ + GLbitfield ExternalSamplersUsed; /* Fragement shader only fields */ GLboolean OriginUpperLeft; @@ -2171,7 +2230,7 @@ struct gl_program * It may be different, though only more strict than the value of * \c gl_image_unit::Access for the corresponding image unit. */ - GLenum ImageAccess[MAX_IMAGE_UNIFORMS]; + GLenum16 ImageAccess[MAX_IMAGE_UNIFORMS]; struct gl_uniform_block **UniformBlocks; struct gl_uniform_block **ShaderStorageBlocks; @@ -2324,7 +2383,8 @@ struct gl_tess_eval_program_state */ struct gl_geometry_program_state { - /** Currently enabled and valid program (including internal programs + /** + * Currently enabled and valid program (including internal programs * and compiled shader programs). */ struct gl_program *_Current; @@ -2341,7 +2401,8 @@ struct gl_fragment_program_state struct gl_program *Current; /**< User-bound fragment program */ - /** Currently enabled and valid fragment program (including internal + /** + * Currently enabled and valid fragment program (including internal * programs, user-defined fragment programs and GLSL fragment shaders). * This is the program we must use when rendering. */ @@ -2390,10 +2451,18 @@ struct ati_fragment_shader GLubyte numArithInstr[2]; GLubyte regsAssigned[2]; GLubyte NumPasses; /**< 1 or 2 */ + /** + * Current compile stage: 0 setup pass1, 1 arith pass1, + * 2 setup pass2, 3 arith pass2. + */ GLubyte cur_pass; GLubyte last_optype; GLboolean interpinp1; GLboolean isValid; + /** + * Array of 2 bit values for each tex unit to remember whether + * STR or STQ swizzle was used + */ GLuint swizzlerq; struct gl_program *Program; }; @@ -2444,14 +2513,14 @@ struct gl_shader_info * GL_TRIANGLES, GL_QUADS, GL_ISOLINES or PRIM_UNKNOWN if it's not set * in this shader. */ - GLenum PrimitiveMode; + GLenum16 PrimitiveMode; enum gl_tess_spacing Spacing; /** * GL_CW, GL_CCW, or 0 if it's not set in this shader. */ - GLenum VertexOrder; + GLenum16 VertexOrder; /** * 1, 0, or -1 if it's not set in this shader. */ @@ -2473,12 +2542,12 @@ struct gl_shader_info * GL_TRIANGLES_ADJACENCY, or PRIM_UNKNOWN if it's not set in this * shader. */ - GLenum InputType; + GLenum16 InputType; /** * GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP, or PRIM_UNKNOWN if * it's not set in this shader. */ - GLenum OutputType; + GLenum16 OutputType; } Geom; /** @@ -2544,33 +2613,17 @@ struct gl_linked_shader }; -static inline GLbitfield -gl_external_samplers(const struct gl_program *prog) -{ - GLbitfield external_samplers = 0; - GLbitfield mask = prog->SamplersUsed; - - while (mask) { - int idx = u_bit_scan(&mask); - if (prog->sh.SamplerTargets[idx] == TEXTURE_EXTERNAL_INDEX) - external_samplers |= (1 << idx); - } - - return external_samplers; -} - - /** - * Compile status enum. compile_skipped is used to indicate the compile + * Compile status enum. COMPILE_SKIPPED is used to indicate the compile * was skipped due to the shader matching one that's been seen before by * the on-disk cache. */ enum gl_compile_status { - compile_failure = 0, - compile_success, - compile_skipped, - compiled_no_opts + COMPILE_FAILURE = 0, + COMPILE_SUCCESS, + COMPILE_SKIPPED, + COMPILED_NO_OPTS }; /** @@ -2582,7 +2635,7 @@ struct gl_shader * GL_TESS_CONTROL_SHADER || GL_TESS_EVALUATION_SHADER. * Must be the first field. */ - GLenum Type; + GLenum16 Type; gl_shader_stage Stage; GLuint Name; /**< AKA the handle */ GLint RefCount; /**< Reference count */ @@ -2646,6 +2699,9 @@ struct gl_shader GLuint TransformFeedbackBufferStride[MAX_FEEDBACK_BUFFERS]; struct gl_shader_info info; + + /* ARB_gl_spirv related data */ + struct gl_shader_spirv_data *spirv_data; }; @@ -2844,20 +2900,20 @@ struct gl_shader_variable */ struct gl_program_resource { - GLenum Type; /** Program interface type. */ + GLenum16 Type; /** Program interface type. */ const void *Data; /** Pointer to resource associated data structure. */ uint8_t StageReferences; /** Bitmask of shader stage references. */ }; /** - * Link status enum. linking_skipped is used to indicate linking + * Link status enum. LINKING_SKIPPED is used to indicate linking * was skipped due to the shader being loaded from the on-disk cache. */ enum gl_link_status { - linking_failure = 0, - linking_success, - linking_skipped + LINKING_FAILURE = 0, + LINKING_SUCCESS, + LINKING_SKIPPED }; /** @@ -2887,6 +2943,17 @@ struct gl_shader_program_data unsigned NumUniformDataSlots; union gl_constant_value *UniformDataSlots; + /* Used to hold initial uniform values for program binary restores. + * + * From the ARB_get_program_binary spec: + * + * "A successful call to ProgramBinary will reset all uniform + * variables to their initial values. The initial value is either + * the value of the variable's initializer as specified in the + * original shader source, or 0 if no initializer was present. + */ + union gl_constant_value *UniformDataDefaults; + GLboolean Validated; /** List of all active resources after linking. */ @@ -2908,7 +2975,7 @@ struct gl_shader_program_data */ struct gl_shader_program { - GLenum Type; /**< Always GL_SHADER_PROGRAM (internal token) */ + GLenum16 Type; /**< Always GL_SHADER_PROGRAM (internal token) */ GLuint Name; /**< aka handle or ID */ GLchar *Label; /**< GL_KHR_debug */ GLint RefCount; /**< Reference count */ @@ -2955,7 +3022,7 @@ struct gl_shader_program * feedback output, see LinkedTransformFeedback. */ struct { - GLenum BufferMode; + GLenum16 BufferMode; /** Global xfb_stride out qualifier if any */ GLuint BufferStride[MAX_FEEDBACK_BUFFERS]; GLuint NumVarying; @@ -3035,11 +3102,12 @@ struct gl_shader_program */ struct gl_linked_shader *_LinkedShaders[MESA_SHADER_STAGES]; - /* True if any of the fragment shaders attached to this program use: + /** + * True if any of the fragment shaders attached to this program use: * #extension ARB_fragment_coord_conventions: enable */ GLboolean ARB_fragment_coord_conventions_enable; -}; +}; #define GLSL_DUMP 0x1 /**< Dump shaders to stdout */ @@ -3085,11 +3153,9 @@ struct gl_pipeline_object */ struct gl_shader_program *ActiveProgram; - GLbitfield Flags; /**< Mask of GLSL_x flags */ - - GLboolean EverBound; /**< Has the pipeline object been created */ - - GLboolean Validated; /**< Pipeline Validation status */ + GLbitfield Flags; /**< Mask of GLSL_x flags */ + GLboolean EverBound; /**< Has the pipeline object been created */ + GLboolean Validated; /**< Pipeline Validation status */ GLchar *InfoLog; }; @@ -3102,7 +3168,7 @@ struct gl_pipeline_shader_state /** Currently bound pipeline object. See _mesa_BindProgramPipeline() */ struct gl_pipeline_object *Current; - /* Default Object to ensure that _Shader is never NULL */ + /** Default Object to ensure that _Shader is never NULL */ struct gl_pipeline_object *Default; /** Pipeline objects */ @@ -3148,7 +3214,8 @@ struct gl_shader_compiler_options */ GLboolean OptimizeForAOS; - GLboolean LowerBufferInterfaceBlocks; /**< Lower UBO and SSBO access to intrinsics. */ + /** Lower UBO and SSBO access to intrinsics. */ + GLboolean LowerBufferInterfaceBlocks; /** Clamp UBO and SSBO block indices so they don't go out-of-bounds. */ GLboolean ClampBlockIndicesToArrayBounds; @@ -3162,9 +3229,9 @@ struct gl_shader_compiler_options */ struct gl_query_object { - GLenum Target; /**< The query target, when active */ + GLenum16 Target; /**< The query target, when active */ GLuint Id; /**< hash table ID/name */ - GLchar *Label; /**< GL_KHR_debug */ + GLchar *Label; /**< GL_KHR_debug */ GLuint64EXT Result; /**< the counter */ GLboolean Active; /**< inside Begin/EndQuery */ GLboolean Ready; /**< result is ready? */ @@ -3199,7 +3266,7 @@ struct gl_query_state /** GL_ARB_pipeline_statistics_query */ struct gl_query_object *pipeline_stats[MAX_PIPELINE_STATISTICS]; - GLenum CondRenderMode; + GLenum16 CondRenderMode; }; @@ -3210,9 +3277,9 @@ struct gl_sync_object GLint RefCount; /**< Reference count */ GLchar *Label; /**< GL_KHR_debug */ GLboolean DeletePending; /**< Object was deleted while there were still - * live references (e.g., sync not yet finished) - */ - GLenum SyncCondition; + * live references (e.g., sync not yet finished) + */ + GLenum16 SyncCondition; GLbitfield Flags; /**< Flags passed to glFenceSync */ GLuint StatusFlag:1; /**< Has the sync object been signaled? */ }; @@ -3237,7 +3304,7 @@ struct gl_shared_state /** * \name Thread safety and statechange notification for texture - * objects. + * objects. * * \todo Improve the granularity of locking. */ @@ -3296,6 +3363,17 @@ struct gl_shared_state /** EXT_external_objects */ struct _mesa_HashTable *MemoryObjects; + /** EXT_semaphore */ + struct _mesa_HashTable *SemaphoreObjects; + + /** + * Some context in this share group was affected by a disjoint + * operation. This operation can be anything that has effects on + * values of timer queries in such manner that they become invalid for + * performance metrics. As example gpu reset, counter overflow or gpu + * frequency changes. + */ + bool DisjointOperation; }; @@ -3326,8 +3404,8 @@ struct gl_renderbuffer */ GLboolean NeedsFinishRenderTexture; GLubyte NumSamples; /**< zero means not multisampled */ - GLenum InternalFormat; /**< The user-specified format */ - GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or + GLenum16 InternalFormat; /**< The user-specified format */ + GLenum16 _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or GL_STENCIL_INDEX. */ mesa_format Format; /**< The actual renderbuffer memory format */ /** @@ -3356,7 +3434,7 @@ struct gl_renderbuffer */ struct gl_renderbuffer_attachment { - GLenum Type; /**< \c GL_NONE or \c GL_TEXTURE or \c GL_RENDERBUFFER_EXT */ + GLenum16 Type; /**< \c GL_NONE or \c GL_TEXTURE or \c GL_RENDERBUFFER_EXT */ GLboolean Complete; /** @@ -3443,7 +3521,7 @@ struct gl_framebuffer /*@}*/ /** One of the GL_FRAMEBUFFER_(IN)COMPLETE_* tokens */ - GLenum _Status; + GLenum16 _Status; /** Whether one of Attachment has Type != GL_NONE * NOTE: the values for Width and Height are set to 0 in case of having @@ -3482,8 +3560,8 @@ struct gl_framebuffer /* In unextended OpenGL these vars are part of the GL_COLOR_BUFFER * attribute group and GL_PIXEL attribute group, respectively. */ - GLenum ColorDrawBuffer[MAX_DRAW_BUFFERS]; - GLenum ColorReadBuffer; + GLenum16 ColorDrawBuffer[MAX_DRAW_BUFFERS]; + GLenum16 ColorReadBuffer; /** Computed from ColorDraw/ReadBuffer above */ GLuint _NumColorDrawBuffers; @@ -3579,7 +3657,6 @@ struct gl_program_constants GLuint MaxShaderStorageBlocks; }; - /** * Constants which may be overridden by device driver during context creation * but are never changed after that. @@ -3717,6 +3794,11 @@ struct gl_constants */ GLboolean AllowGLSLBuiltinVariableRedeclaration; + /** + * Allow GLSL interpolation qualifier mismatch across shader stages. + */ + GLboolean AllowGLSLCrossStageInterpolationMismatch; + /** * Allow creating a higher compat profile (version 3.1+) for apps that * request it. Be careful when adding that driconf option because some @@ -3765,7 +3847,7 @@ struct gl_constants GLboolean QuadsFollowProvokingVertexConvention; /** GL_ARB_viewport_array */ - GLenum LayerAndVPIndexProvokingVertex; + GLenum16 LayerAndVPIndexProvokingVertex; /** OpenGL version 3.0 */ GLbitfield ContextFlags; /**< Ex: GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */ @@ -3791,7 +3873,7 @@ struct gl_constants GLuint MaxProgramTextureGatherComponents; /* GL_ARB_robustness */ - GLenum ResetStrategy; + GLenum16 ResetStrategy; /* GL_KHR_robustness */ GLboolean RobustAccess; @@ -3980,7 +4062,7 @@ struct gl_constants GLboolean FakeSWMSAA; /** GL_KHR_context_flush_control */ - GLenum ContextReleaseBehavior; + GLenum16 ContextReleaseBehavior; struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_STAGES]; @@ -3990,8 +4072,6 @@ 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 @@ -4008,6 +4088,9 @@ struct gl_constants /** When drivers are OK with mapped buffers during draw and other calls. */ bool AllowMappedBuffersDuringExecution; + + /** GL_ARB_get_program_binary */ + GLuint NumProgramBinaryFormats; }; @@ -4057,6 +4140,7 @@ struct gl_extensions GLboolean ARB_enhanced_layouts; GLboolean ARB_explicit_attrib_location; GLboolean ARB_explicit_uniform_location; + GLboolean ARB_gl_spirv; GLboolean ARB_gpu_shader5; GLboolean ARB_gpu_shader_fp64; GLboolean ARB_gpu_shader_int64; @@ -4138,6 +4222,7 @@ struct gl_extensions GLboolean EXT_blend_func_separate; GLboolean EXT_blend_minmax; GLboolean EXT_depth_bounds_test; + GLboolean EXT_disjoint_timer_query; GLboolean EXT_draw_buffers2; GLboolean EXT_framebuffer_multisample; GLboolean EXT_framebuffer_multisample_blit_scaled; @@ -4150,6 +4235,8 @@ struct gl_extensions GLboolean EXT_pixel_buffer_object; GLboolean EXT_point_parameters; GLboolean EXT_provoking_vertex; + GLboolean EXT_semaphore; + GLboolean EXT_semaphore_fd; GLboolean EXT_shader_integer_mix; GLboolean EXT_shader_samples_identical; GLboolean EXT_stencil_two_side; @@ -4263,7 +4350,7 @@ struct gl_matrix_stack /** - * \name Bits for image transfer operations + * \name Bits for image transfer operations * \sa __struct gl_contextRec::ImageTransferState. */ /*@{*/ @@ -4274,12 +4361,13 @@ struct gl_matrix_stack /** Pixel Transfer ops */ -#define IMAGE_BITS (IMAGE_SCALE_BIAS_BIT | \ - IMAGE_SHIFT_OFFSET_BIT | \ - IMAGE_MAP_COLOR_BIT) +#define IMAGE_BITS (IMAGE_SCALE_BIAS_BIT | \ + IMAGE_SHIFT_OFFSET_BIT | \ + IMAGE_MAP_COLOR_BIT) + /** - * \name Bits to indicate what state has changed. + * \name Bits to indicate what state has changed. */ /*@{*/ #define _NEW_MODELVIEW (1u << 0) /**< gl_context::ModelView */ @@ -4344,23 +4432,12 @@ struct gl_matrix_stack #include "dd.h" -/** - * Display list flags. - * Strictly this is a tnl-private concept, but it doesn't seem - * worthwhile adding a tnl private structure just to hold this one bit - * of information: - */ -#define DLIST_DANGLING_REFS 0x1 - - /** Opaque declaration of display list payload data type */ union gl_dlist_node; /** - * Provide a location where information about a display list can be - * collected. Could be extended with driverPrivate structures, - * etc. in the future. + * Per-display list information. */ struct gl_display_list { @@ -4386,7 +4463,7 @@ struct gl_dlist_state GLubyte ActiveAttribSize[VERT_ATTRIB_MAX]; GLfloat CurrentAttrib[VERT_ATTRIB_MAX][4]; - + GLubyte ActiveMaterialSize[MAT_ATTRIB_MAX]; GLfloat CurrentMaterial[MAT_ATTRIB_MAX][4]; @@ -4394,7 +4471,7 @@ struct gl_dlist_state /* State known to have been set by the currently-compiling display * list. Used to eliminate some redundant state changes. */ - GLenum ShadeModel; + GLenum16 ShadeModel; } Current; }; @@ -4404,7 +4481,8 @@ struct gl_dlist_state * to small enums suitable for use as an array index. */ -enum mesa_debug_source { +enum mesa_debug_source +{ MESA_DEBUG_SOURCE_API, MESA_DEBUG_SOURCE_WINDOW_SYSTEM, MESA_DEBUG_SOURCE_SHADER_COMPILER, @@ -4414,7 +4492,8 @@ enum mesa_debug_source { MESA_DEBUG_SOURCE_COUNT }; -enum mesa_debug_type { +enum mesa_debug_type +{ MESA_DEBUG_TYPE_ERROR, MESA_DEBUG_TYPE_DEPRECATED, MESA_DEBUG_TYPE_UNDEFINED, @@ -4427,7 +4506,8 @@ enum mesa_debug_type { MESA_DEBUG_TYPE_COUNT }; -enum mesa_debug_severity { +enum mesa_debug_severity +{ MESA_DEBUG_SEVERITY_LOW, MESA_DEBUG_SEVERITY_MEDIUM, MESA_DEBUG_SEVERITY_HIGH, @@ -4622,14 +4702,14 @@ struct gl_image_unit * Access allowed to this texture image. Either \c GL_READ_ONLY, * \c GL_WRITE_ONLY or \c GL_READ_WRITE. */ - GLenum Access; + GLenum16 Access; /** * GL internal format that determines the interpretation of the * image memory when shader image operations are performed through * this unit. */ - GLenum Format; + GLenum16 Format; /** * Mesa format corresponding to \c Format. @@ -4667,6 +4747,11 @@ struct gl_memory_object GLboolean Dedicated; /**< import memory from a dedicated allocation */ }; +struct gl_semaphore_object +{ + GLuint Name; /**< hash table ID/name */ +}; + /** * Mesa rendering context. * @@ -4774,7 +4859,7 @@ struct gl_context /*@}*/ /** \name Renderer attribute groups - * + * * We define a struct for each attribute group to make pushing and popping * attributes easy. Also it's a good organization. */ @@ -4931,7 +5016,7 @@ struct gl_context /* GL_EXT_framebuffer_object */ struct gl_renderbuffer *CurrentRenderbuffer; - GLenum ErrorValue; /**< Last error code */ + GLenum16 ErrorValue; /**< Last error code */ /** * Recognize and silence repeated error debug messages in buggy apps. @@ -4943,7 +5028,7 @@ struct gl_context simple_mtx_t DebugMutex; struct gl_debug_state *Debug; - GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ + GLenum16 RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ GLbitfield NewState; /**< bitwise-or of _NEW_* flags */ uint64_t NewDriverState; /**< bitwise-or of flags from DriverFlags */ @@ -4956,9 +5041,10 @@ struct gl_context /** \name Derived state */ GLbitfield _ImageTransferState;/**< bitwise-or of IMAGE_*_BIT flags */ GLfloat _EyeZDir[3]; - GLfloat _ModelViewInvScale; + GLfloat _ModelViewInvScale; /* may be for model- or eyespace lighting */ + GLfloat _ModelViewInvScaleEyespace; /* always factor defined in spec */ GLboolean _NeedEyeCoords; - GLboolean _ForceEyeCoords; + GLboolean _ForceEyeCoords; GLuint TextureStateTimestamp; /**< detect changes to shared state */ @@ -4993,7 +5079,7 @@ struct gl_context GLboolean TileRasterOrderIncreasingY; /** - * \name Hooks for module contexts. + * \name Hooks for module contexts. * * These will eventually live in the driver or elsewhere. */ @@ -5056,11 +5142,9 @@ struct gl_memory_info #ifdef DEBUG extern int MESA_VERBOSE; extern int MESA_DEBUG_FLAGS; -# define MESA_FUNCTION __func__ #else # define MESA_VERBOSE 0 # define MESA_DEBUG_FLAGS 0 -# define MESA_FUNCTION "a function" #endif