mesa: use GLenum16 in a few more places
[mesa.git] / src / mesa / main / mtypes.h
index f6fa6f45618f08e8144b372b6aecc768f90fa43d..46137f5d4ae70d1d3b2818b14f7df4d90b2879b4 100644 (file)
@@ -81,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
  */
@@ -459,7 +463,9 @@ 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 */
+
+   /** 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 */
 
@@ -960,7 +966,7 @@ typedef enum
 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
@@ -1064,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? */
@@ -1437,7 +1443,6 @@ typedef enum
  */
 struct gl_buffer_object
 {
-   simple_mtx_t Mutex;
    GLint RefCount;
    GLuint Name;
    GLchar *Label;       /**< GL_KHR_debug */
@@ -1458,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;
@@ -1512,6 +1518,21 @@ struct gl_vertex_array
 };
 
 
+/**
+ * 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.
  *
@@ -1582,9 +1603,9 @@ struct gl_vertex_array_object
     * 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.
+    * 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];
@@ -1598,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;
 
@@ -3205,7 +3229,7 @@ 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 */
    GLuint64EXT Result; /**< the counter */