(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
*/
GLfloat Ambient[4]; /**< ambient color */
GLboolean LocalViewer; /**< Local (or infinite) view point? */
GLboolean TwoSide; /**< Two (or one) sided lighting? */
- GLenum ColorControl; /**< either GL_SINGLE_COLOR
+ GLenum16 ColorControl; /**< either GL_SINGLE_COLOR
or GL_SEPARATE_SPECULAR_COLOR */
};
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 */
/*@}*/
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.
/*@{*/
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 _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 */
+ 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 */
};
*/
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? */
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 */
};
*/
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 */
};
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:
*/
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... */
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 */
};
*/
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 */
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];
};
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 */
struct gl_texture_image
{
GLint InternalFormat; /**< Internal format as given by the user */
- GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_ALPHA,
+ 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
{
simple_mtx_t Mutex;
GLuint Name;
- GLint RefCount;
GLchar *Label; /**< GL_KHR_debug */
+ GLint RefCount;
- 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 */
+ GLenum16 sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
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 */
GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */
/** GL_ARB_bindless_texture */
*/
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. */
- gl_texture_index TargetIndex; /**< The gl_texture_unit::CurrentTex index.
- Only valid when Target is valid. */
+ simple_mtx_t Mutex; /**< for thread safety */
+ GLint RefCount; /**< reference count */
+ GLuint Name; /**< the user-visible texture object ID */
+ GLenum16 Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
+ GLenum16 DepthMode; /**< GL_ARB_depth_texture */
+ GLchar *Label; /**< GL_KHR_debug */
struct gl_sampler_object Sampler;
- GLenum DepthMode; /**< GL_ARB_depth_texture */
-
+ gl_texture_index TargetIndex; /**< The gl_texture_unit::CurrentTex index.
+ Only valid when Target is valid. */
GLfloat Priority; /**< in [0,1] */
- GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
- GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */
- GLint ImmutableLevels; /**< ES 3.0 / ARB_texture_view */
- GLint _MaxLevel; /**< actual max mipmap level (q in the spec) */
+ GLint MaxLevel; /**< max mipmap level (max=1000), OpenGL 1.2 */
+ GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
+ GLbyte _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 */
- GLuint _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */
+ GLushort _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */
+ GLbyte ImmutableLevels; /**< ES 3.0 / ARB_texture_view */
GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */
GLboolean _BaseComplete; /**< Is the base texture level valid? */
GLboolean _MipmapComplete; /**< Is the whole mipmap valid? */
bool StencilSampling; /**< Should we sample stencil instead of depth? */
bool HandleAllocated; /**< GL_ARB_bindless_texture */
- GLuint MinLevel; /**< GL_ARB_texture_view */
- GLuint MinLayer; /**< GL_ARB_texture_view */
- GLuint NumLevels; /**< GL_ARB_texture_view */
- GLuint NumLayers; /**< GL_ARB_texture_view */
+ /** GL_OES_EGL_image_external */
+ GLubyte RequiredTextureImageUnits;
+
+ GLubyte MinLevel; /**< GL_ARB_texture_view */
+ GLubyte NumLevels; /**< GL_ARB_texture_view */
+ GLushort MinLayer; /**< GL_ARB_texture_view */
+ GLushort 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_shader_image_load_store */
+ GLenum16 ImageFormatCompatibilityType;
/** GL_ARB_texture_buffer_object */
- struct gl_buffer_object *BufferObject;
- GLenum BufferObjectFormat;
+ GLenum16 BufferObjectFormat;
/** Equivalent Mesa format for BufferObjectFormat. */
mesa_format _BufferObjectFormat;
+ struct gl_buffer_object *BufferObject;
+
/** GL_ARB_texture_buffer_range */
GLintptr BufferOffset;
GLsizeiptr BufferSize; /**< if this is -1, use BufferObject->Size instead */
- /** GL_OES_EGL_image_external */
- GLint RequiredTextureImageUnits;
-
- /** GL_ARB_shader_image_load_store */
- GLenum ImageFormatCompatibilityType;
+ /** Actual texture images, indexed by [cube face] and [mipmap level] */
+ struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS];
/** GL_ARB_bindless_texture */
struct util_dynarray SamplerHandles;
*/
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];
- GLuint ScaleShiftRGB; /**< 0, 1 or 2 */
- GLuint ScaleShiftA; /**< 0, 1 or 2 */
- GLuint _NumArgsRGB; /**< Number of inputs used for the RGB combiner */
- GLuint _NumArgsA; /**< Number of inputs used for the A combiner */
+ GLenum16 OperandRGB[MAX_COMBINER_TERMS];
+ GLenum16 OperandA[MAX_COMBINER_TERMS];
+ GLubyte ScaleShiftRGB; /**< 0, 1 or 2 */
+ GLubyte ScaleShiftA; /**< 0, 1 or 2 */
+ GLubyte _NumArgsRGB; /**< Number of inputs used for the RGB combiner */
+ GLubyte _NumArgsA; /**< Number of inputs used for the A combiner */
};
*/
struct gl_texgen
{
- GLenum Mode; /**< GL_EYE_LINEAR, GL_SPHERE_MAP, etc */
- GLbitfield _ModeBit; /**< TEXGEN_x bit corresponding to Mode */
+ GLenum16 Mode; /**< GL_EYE_LINEAR, GL_SPHERE_MAP, etc */
+ GLbitfield8 _ModeBit; /**< TEXGEN_x bit corresponding to Mode */
GLfloat ObjectPlane[4];
GLfloat EyePlane[4];
};
/**
- * Texture unit state. Contains enable flags, texture environment/function/
- * combiners, texgen state, and pointers to current texture objects.
+ * Sampler-related subset of a texture unit, like current texture objects.
*/
struct gl_texture_unit
{
- GLbitfield Enabled; /**< bitmask of TEXTURE_*_BIT flags */
+ GLfloat LodBias; /**< for biasing mipmap levels */
+
+ /** Texture targets that have a non-default texture bound */
+ GLbitfield _BoundTextures;
+
+ /** Current sampler object (GL_ARB_sampler_objects) */
+ struct gl_sampler_object *Sampler;
+
+ /** Current texture object pointers */
+ struct gl_texture_object *CurrentTex[NUM_TEXTURE_TARGETS];
+
+ /** Points to highest priority, complete and enabled texture object */
+ struct gl_texture_object *_Current;
+};
+
+
+/**
+ * Fixed-function-related subset of a texture unit, like enable flags,
+ * texture environment/function/combiners, and texgen state.
+ */
+struct gl_fixedfunc_texture_unit
+{
+ GLbitfield16 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];
struct gl_texgen GenT;
struct gl_texgen GenR;
struct gl_texgen GenQ;
- GLbitfield TexGenEnabled; /**< Bitwise-OR of [STRQ]_BIT values */
- GLbitfield _GenFlags; /**< Bitwise-OR of Gen[STRQ]._ModeBit */
-
- GLfloat LodBias; /**< for biasing mipmap levels */
-
- /** Texture targets that have a non-default texture bound */
- GLbitfield _BoundTextures;
-
- /** Current sampler object (GL_ARB_sampler_objects) */
- struct gl_sampler_object *Sampler;
+ GLbitfield8 TexGenEnabled; /**< Bitwise-OR of [STRQ]_BIT values */
+ GLbitfield8 _GenFlags; /**< Bitwise-OR of Gen[STRQ]._ModeBit */
/**
* \name GL_EXT_texture_env_combine
*/
struct gl_tex_env_combine_state _EnvMode;
+ /** Current compressed TexEnv & Combine state */
+ struct gl_tex_env_combine_packed _CurrentCombinePacked;
+
/**
* Currently enabled combiner state. This will point to either
* \c Combine or \c _EnvMode.
*/
struct gl_tex_env_combine_state *_CurrentCombine;
-
- /** Current texture object pointers */
- struct gl_texture_object *CurrentTex[NUM_TEXTURE_TARGETS];
-
- /** Points to highest priority, complete and enabled texture object */
- struct gl_texture_object *_Current;
-
- /** Current compressed TexEnv & Combine state */
- struct gl_tex_env_combine_packed _CurrentCombinePacked;
};
*/
struct gl_texture_attrib
{
- GLuint CurrentUnit; /**< GL_ACTIVE_TEXTURE */
-
- /** GL_ARB_seamless_cubemap */
- GLboolean CubeMapSeamless;
-
struct gl_texture_object *ProxyTex[NUM_TEXTURE_TARGETS];
/** GL_ARB_texture_buffer_object */
struct gl_buffer_object *BufferObject;
+ GLuint CurrentUnit; /**< GL_ACTIVE_TEXTURE */
+
/** Texture coord units/sets used for fragment texturing */
- GLbitfield _EnabledCoordUnits;
+ GLbitfield8 _EnabledCoordUnits;
/** Texture coord units that have texgen enabled */
- GLbitfield _TexGenEnabled;
+ GLbitfield8 _TexGenEnabled;
/** Texture coord units that have non-identity matrices */
- GLbitfield _TexMatEnabled;
+ GLbitfield8 _TexMatEnabled;
/** Bitwise-OR of all Texture.Unit[i]._GenFlags */
- GLbitfield _GenFlags;
+ GLbitfield8 _GenFlags;
/** Largest index of a texture unit with _Current != NULL. */
- GLint _MaxEnabledTexImageUnit;
+ GLshort _MaxEnabledTexImageUnit;
/** Largest index + 1 of texture units that have had any CurrentTex set. */
- GLint NumCurrentTexUsed;
+ GLubyte NumCurrentTexUsed;
+
+ /** GL_ARB_seamless_cubemap */
+ GLboolean CubeMapSeamless;
struct gl_texture_unit Unit[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
+ struct gl_fixedfunc_texture_unit FixedFuncUnit[MAX_TEXTURE_COORD_UNITS];
};
*/
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 */
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 */
};
{
GLfloat X, Y; /**< position */
GLfloat Width, Height; /**< size */
- GLdouble Near, Far; /**< Depth buffer range */
+ GLfloat Near, Far; /**< Depth buffer range */
};
*/
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. */
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;
/**
- * Vertex array information which is derived from gl_array_attributes
- * and gl_vertex_buffer_binding information. Used by the VBO module and
- * device drivers.
+ * 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.
*/
-struct gl_vertex_array
+typedef enum
{
- 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 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 */
-};
+ 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;
/**
*/
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;
};
};
+/**
+ * Vertex array information which is derived from gl_array_attributes
+ * and gl_vertex_buffer_binding information. Used by the VBO module and
+ * device drivers.
+ */
+struct gl_vertex_array
+{
+ /** Vertex attribute array */
+ const struct gl_array_attributes *VertexAttrib;
+ /** Vertex buffer binding */
+ const struct gl_vertex_buffer_binding *BufferBinding;
+};
+
+
/**
* A representation of "Vertex Array Objects" (VAOs) from OpenGL 3.1+ /
* the GL_ARB_vertex_array_object extension.
GLboolean EverBound;
/**
- * Derived vertex attribute arrays
- *
- * This is a legacy data structure created from gl_array_attributes and
- * gl_vertex_buffer_binding, for compatibility with existing driver code.
+ * Marked to true if the object is shared between contexts and immutable.
+ * Then reference counting is done using atomics and thread safe.
+ * Is used for dlist VAOs.
*/
- struct gl_vertex_array _VertexAttrib[VERT_ATTRIB_MAX];
+ bool SharedAndImmutable;
/** Vertex attribute arrays */
struct gl_array_attributes VertexAttrib[VERT_ATTRIB_MAX];
/** 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;
};
-/**
- * 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.
*
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;
+ /**
+ * Vertex array object that is used with the currently active draw command.
+ * The _DrawVAO is either set to the currently bound VAO for array type
+ * draws or to internal VAO's set up by the vbo module to execute immediate
+ * mode or display list draws.
+ */
+ struct gl_vertex_array_object *_DrawVAO;
+ /**
+ * The VERT_BIT_* bits effectively enabled from the current _DrawVAO.
+ * This is always a subset of _mesa_get_vao_vp_inputs(_DrawVAO)
+ * but may omit those arrays that shall not be referenced by the current
+ * gl_vertex_program_state::_VPMode. For example the generic attributes are
+ * maked out form the _DrawVAO's enabled arrays when a fixed function
+ * array draw is executed.
+ */
+ GLbitfield _DrawVAOEnabledAttribs;
+ /**
+ * Initially or if the VAO referenced by _DrawVAO is deleted the _DrawVAO
+ * pointer is set to the _EmptyVAO which is just an empty VAO all the time.
+ */
+ struct gl_vertex_array_object *_EmptyVAO;
+
/**
* Vertex arrays as consumed by a driver.
* The array pointer is set up only by the VBO module.
*/
- const struct gl_vertex_array **_DrawArrays; /**< 0..VERT_ATTRIB_MAX-1 */
+ const struct gl_vertex_array *_DrawArrays; /**< 0..VERT_ATTRIB_MAX-1 */
/** Legal array datatypes and the API for which they have been computed */
GLbitfield LegalTypesMask;
*/
struct gl_feedback
{
- GLenum Type;
+ GLenum16 Type;
GLbitfield _Mask; /**< FB_* bits */
GLfloat *Buffer;
GLuint BufferSize;
struct gl_transform_feedback_varying_info
{
char *Name;
- GLenum Type;
+ GLenum16 Type;
GLint BufferIndex;
GLint Size;
GLint Offset;
/** Post-link transform feedback info. */
struct gl_transform_feedback_info
{
- /* Was xfb enabled via the api or in shader layout qualifiers */
- bool api_enabled;
-
unsigned NumOutputs;
/* Bitmask of active buffer indices. */
*/
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;
* 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;
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;
} gl_register_file;
+/**
+ * Current vertex processing mode: fixed function vs. shader.
+ * In reality, fixed function is probably implemented by a shader but that's
+ * not what we care about here.
+ */
+typedef enum
+{
+ VP_MODE_FF, /**< legacy / fixed function */
+ VP_MODE_SHADER, /**< ARB vertex program or GLSL vertex shader */
+ VP_MODE_MAX /**< for sizing arrays */
+} gl_vertex_processing_mode;
+
+
/**
* Base class for any kind of program object
*/
GLubyte *String; /**< Null-terminated program text */
/** GL_VERTEX/FRAGMENT_PROGRAM_ARB, GL_GEOMETRY_PROGRAM_NV */
- GLenum Target;
- GLenum Format; /**< String encoding format */
+ GLenum16 Target;
+ GLenum16 Format; /**< String encoding format */
GLboolean _Used; /**< Ever used for drawing? Used for debugging */
/** Subset of OutputsWritten outputs written with non-zero index. */
GLbitfield64 SecondaryOutputsWritten;
/** TEXTURE_x_BIT bitmask */
- GLbitfield TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
+ GLbitfield16 TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
/** Bitfield of which samplers are used */
GLbitfield SamplersUsed;
/** Texture units used for shadow sampling. */
* 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;
/** Which texture target is being sampled
* (TEXTURE_1D/2D/3D/etc_INDEX)
*/
- gl_texture_index SamplerTargets[MAX_SAMPLERS];
+ GLubyte SamplerTargets[MAX_SAMPLERS];
/**
* Number of samplers declared with the bindless_sampler layout
struct gl_program_cache *Cache;
GLboolean _Overriden;
+
+ /**
+ * If we have a vertex program, a TNL program or no program at all.
+ * Note that this value should be kept up to date all the time,
+ * nevertheless its correctness is asserted in _mesa_update_state.
+ * The reason is to avoid calling _mesa_update_state twice we need
+ * this value on draw *before* actually calling _mesa_update_state.
+ * Also it should need to get recomputed only on changes to the
+ * vertex program which are heavyweight already.
+ */
+ gl_vertex_processing_mode _VPMode;
};
/**
* 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.
*/
* 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;
/**
* 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 */
*/
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. */
};
*/
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 */
* feedback output, see LinkedTransformFeedback.
*/
struct {
- GLenum BufferMode;
+ GLenum16 BufferMode;
/** Global xfb_stride out qualifier if any */
GLuint BufferStride[MAX_FEEDBACK_BUFFERS];
GLuint NumVarying;
*/
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 */
GLuint64EXT Result; /**< the counter */
/** GL_ARB_pipeline_statistics_query */
struct gl_query_object *pipeline_stats[MAX_PIPELINE_STATISTICS];
- GLenum CondRenderMode;
+ GLenum16 CondRenderMode;
};
GLboolean DeletePending; /**< Object was deleted while there were still
* live references (e.g., sync not yet finished)
*/
- GLenum SyncCondition;
+ GLenum16 SyncCondition;
GLbitfield Flags; /**< Flags passed to glFenceSync */
GLuint StatusFlag:1; /**< Has the sync object been signaled? */
};
/** 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
*/
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 */
/**
*/
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;
/**
/*@}*/
/** 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
/* 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;
struct gl_constants
{
GLuint MaxTextureMbytes; /**< Max memory per image, in MB */
- GLuint MaxTextureLevels; /**< Max mipmap levels. */
+ GLuint MaxTextureLevels; /**< Max mipmap levels. */
GLuint Max3DTextureLevels; /**< Max mipmap levels for 3D textures */
GLuint MaxCubeTextureLevels; /**< Max mipmap levels for cube textures */
GLuint MaxArrayTextureLayers; /**< Max layers in array textures */
GLboolean QuadsFollowProvokingVertexConvention;
/** GL_ARB_viewport_array */
- GLenum LayerAndVPIndexProvokingVertex;
+ GLenum16 LayerAndVPIndexProvokingVertex;
/** OpenGL version 3.0 */
GLbitfield ContextFlags; /**< Ex: GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */
GLuint MaxProgramTextureGatherComponents;
/* GL_ARB_robustness */
- GLenum ResetStrategy;
+ GLenum16 ResetStrategy;
/* GL_KHR_robustness */
GLboolean RobustAccess;
GLboolean FakeSWMSAA;
/** GL_KHR_context_flush_control */
- GLenum ContextReleaseBehavior;
+ GLenum16 ContextReleaseBehavior;
struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_STAGES];
/** GL_ARB_get_program_binary */
GLuint NumProgramBinaryFormats;
+
+ /** Is the drivers uniform storage packed or padded to 16 bytes. */
+ bool PackedDriverUniformStorage;
};
GLboolean ARB_clear_texture;
GLboolean ARB_clip_control;
GLboolean ARB_color_buffer_float;
+ GLboolean ARB_compatibility;
GLboolean ARB_compute_shader;
GLboolean ARB_compute_variable_group_size;
GLboolean ARB_conditional_render_inverted;
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;
GLboolean KHR_texture_compression_astc_sliced_3d;
GLboolean MESA_tile_raster_order;
GLboolean MESA_pack_invert;
- GLboolean MESA_shader_framebuffer_fetch;
- GLboolean MESA_shader_framebuffer_fetch_non_coherent;
+ GLboolean EXT_shader_framebuffer_fetch;
+ GLboolean EXT_shader_framebuffer_fetch_non_coherent;
GLboolean MESA_shader_integer_functions;
GLboolean MESA_ycbcr_texture;
GLboolean NV_conditional_render;
/* State known to have been set by the currently-compiling display
* list. Used to eliminate some redundant state changes.
*/
- GLenum ShadeModel;
+ GLenum16 ShadeModel;
} Current;
};
/**
* Level of the texture object bound to this unit.
*/
- GLuint Level;
+ GLubyte Level;
/**
* \c GL_TRUE if the whole level is bound as an array of layers, \c
* Layer of the texture object bound to this unit as specified by the
* application.
*/
- GLuint Layer;
+ GLushort Layer;
/**
- * Layer of the texture object bound to this unit, or zero if the
- * whole level is bound.
+ * Layer of the texture object bound to this unit, or zero if
+ * Layered == false.
*/
- GLuint _Layer;
+ GLushort _Layer;
/**
* 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.
*/
- mesa_format _ActualFormat;
-
+ mesa_format _ActualFormat:16;
};
/**
GLboolean Dedicated; /**< import memory from a dedicated allocation */
};
+struct gl_semaphore_object
+{
+ GLuint Name; /**< hash table ID/name */
+};
+
/**
* Mesa rendering 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.
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 */