Merge branch 'origin'
[mesa.git] / src / mesa / main / mtypes.h
index a78a7d1927f29e13234688cf8359d292216647f3..0ed73beb3c5fd820bf909f8329a8a1b510a4d364 100644 (file)
@@ -142,7 +142,7 @@ enum
    VERT_ATTRIB_COLOR0 = 3,
    VERT_ATTRIB_COLOR1 = 4,
    VERT_ATTRIB_FOG = 5,
-   VERT_ATTRIB_SIX = 6,
+   VERT_ATTRIB_COLOR_INDEX = 6,
    VERT_ATTRIB_SEVEN = 7,
    VERT_ATTRIB_TEX0 = 8,
    VERT_ATTRIB_TEX1 = 9,
@@ -176,38 +176,38 @@ enum
  * These are used in bitfields in many places.
  */
 /*@{*/
-#define VERT_BIT_POS      (1 << VERT_ATTRIB_POS)
-#define VERT_BIT_WEIGHT   (1 << VERT_ATTRIB_WEIGHT)
-#define VERT_BIT_NORMAL   (1 << VERT_ATTRIB_NORMAL)
-#define VERT_BIT_COLOR0   (1 << VERT_ATTRIB_COLOR0)
-#define VERT_BIT_COLOR1   (1 << VERT_ATTRIB_COLOR1)
-#define VERT_BIT_FOG      (1 << VERT_ATTRIB_FOG)
-#define VERT_BIT_SIX      (1 << VERT_ATTRIB_SIX)
-#define VERT_BIT_SEVEN    (1 << VERT_ATTRIB_SEVEN)
-#define VERT_BIT_TEX0     (1 << VERT_ATTRIB_TEX0)
-#define VERT_BIT_TEX1     (1 << VERT_ATTRIB_TEX1)
-#define VERT_BIT_TEX2     (1 << VERT_ATTRIB_TEX2)
-#define VERT_BIT_TEX3     (1 << VERT_ATTRIB_TEX3)
-#define VERT_BIT_TEX4     (1 << VERT_ATTRIB_TEX4)
-#define VERT_BIT_TEX5     (1 << VERT_ATTRIB_TEX5)
-#define VERT_BIT_TEX6     (1 << VERT_ATTRIB_TEX6)
-#define VERT_BIT_TEX7     (1 << VERT_ATTRIB_TEX7)
-#define VERT_BIT_GENERIC0 (1 << VERT_ATTRIB_GENERIC0)
-#define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1)
-#define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2)
-#define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3)
-#define VERT_BIT_GENERIC4 (1 << VERT_ATTRIB_GENERIC4)
-#define VERT_BIT_GENERIC5 (1 << VERT_ATTRIB_GENERIC5)
-#define VERT_BIT_GENERIC6 (1 << VERT_ATTRIB_GENERIC6)
-#define VERT_BIT_GENERIC7 (1 << VERT_ATTRIB_GENERIC7)
-#define VERT_BIT_GENERIC8 (1 << VERT_ATTRIB_GENERIC8)
-#define VERT_BIT_GENERIC9 (1 << VERT_ATTRIB_GENERIC9)
-#define VERT_BIT_GENERIC10 (1 << VERT_ATTRIB_GENERIC10)
-#define VERT_BIT_GENERIC11 (1 << VERT_ATTRIB_GENERIC11)
-#define VERT_BIT_GENERIC12 (1 << VERT_ATTRIB_GENERIC12)
-#define VERT_BIT_GENERIC13 (1 << VERT_ATTRIB_GENERIC13)
-#define VERT_BIT_GENERIC14 (1 << VERT_ATTRIB_GENERIC14)
-#define VERT_BIT_GENERIC15 (1 << VERT_ATTRIB_GENERIC15)
+#define VERT_BIT_POS         (1 << VERT_ATTRIB_POS)
+#define VERT_BIT_WEIGHT      (1 << VERT_ATTRIB_WEIGHT)
+#define VERT_BIT_NORMAL      (1 << VERT_ATTRIB_NORMAL)
+#define VERT_BIT_COLOR0      (1 << VERT_ATTRIB_COLOR0)
+#define VERT_BIT_COLOR1      (1 << VERT_ATTRIB_COLOR1)
+#define VERT_BIT_FOG         (1 << VERT_ATTRIB_FOG)
+#define VERT_BIT_COLOR_INDEX (1 << VERT_ATTRIB_COLOR_INDEX)
+#define VERT_BIT_SEVEN       (1 << VERT_ATTRIB_SEVEN)
+#define VERT_BIT_TEX0        (1 << VERT_ATTRIB_TEX0)
+#define VERT_BIT_TEX1        (1 << VERT_ATTRIB_TEX1)
+#define VERT_BIT_TEX2        (1 << VERT_ATTRIB_TEX2)
+#define VERT_BIT_TEX3        (1 << VERT_ATTRIB_TEX3)
+#define VERT_BIT_TEX4        (1 << VERT_ATTRIB_TEX4)
+#define VERT_BIT_TEX5        (1 << VERT_ATTRIB_TEX5)
+#define VERT_BIT_TEX6        (1 << VERT_ATTRIB_TEX6)
+#define VERT_BIT_TEX7        (1 << VERT_ATTRIB_TEX7)
+#define VERT_BIT_GENERIC0    (1 << VERT_ATTRIB_GENERIC0)
+#define VERT_BIT_GENERIC1    (1 << VERT_ATTRIB_GENERIC1)
+#define VERT_BIT_GENERIC2    (1 << VERT_ATTRIB_GENERIC2)
+#define VERT_BIT_GENERIC3    (1 << VERT_ATTRIB_GENERIC3)
+#define VERT_BIT_GENERIC4    (1 << VERT_ATTRIB_GENERIC4)
+#define VERT_BIT_GENERIC5    (1 << VERT_ATTRIB_GENERIC5)
+#define VERT_BIT_GENERIC6    (1 << VERT_ATTRIB_GENERIC6)
+#define VERT_BIT_GENERIC7    (1 << VERT_ATTRIB_GENERIC7)
+#define VERT_BIT_GENERIC8    (1 << VERT_ATTRIB_GENERIC8)
+#define VERT_BIT_GENERIC9    (1 << VERT_ATTRIB_GENERIC9)
+#define VERT_BIT_GENERIC10   (1 << VERT_ATTRIB_GENERIC10)
+#define VERT_BIT_GENERIC11   (1 << VERT_ATTRIB_GENERIC11)
+#define VERT_BIT_GENERIC12   (1 << VERT_ATTRIB_GENERIC12)
+#define VERT_BIT_GENERIC13   (1 << VERT_ATTRIB_GENERIC13)
+#define VERT_BIT_GENERIC14   (1 << VERT_ATTRIB_GENERIC14)
+#define VERT_BIT_GENERIC15   (1 << VERT_ATTRIB_GENERIC15)
 
 #define VERT_BIT_TEX(u)  (1 << (VERT_ATTRIB_TEX0 + (u)))
 #define VERT_BIT_GENERIC(g)  (1 << (VERT_ATTRIB_GENERIC0 + (g)))
@@ -249,7 +249,8 @@ enum
 #define VERT_RESULT_PSIZ 12
 #define VERT_RESULT_BFC0 13
 #define VERT_RESULT_BFC1 14
-#define VERT_RESULT_MAX  15
+#define VERT_RESULT_EDGE 15
+#define VERT_RESULT_MAX  16
 /*@}*/
 
 
@@ -391,9 +392,9 @@ struct gl_color_table
 {
    GLenum InternalFormat;      /**< The user-specified format */
    GLenum _BaseFormat;         /**< GL_ALPHA, GL_RGBA, GL_RGB, etc */
-   GLuint Size;           /**< number of entries (rows) in table */
-   GLvoid *Table;         /**< points to data of <Type> */
-   GLenum Type;           /**< GL_UNSIGNED_BYTE or GL_FLOAT */
+   GLuint Size;                /**< number of entries in table */
+   GLfloat *TableF;            /**< Color table, floating point values */
+   GLubyte *TableUB;           /**< Color table, ubyte values */
    GLubyte RedSize;
    GLubyte GreenSize;
    GLubyte BlueSize;
@@ -613,29 +614,27 @@ struct gl_colorbuffer_attrib
 struct gl_current_attrib
 {
    /**
-    * \name Values valid only when FLUSH_VERTICES has been called.
+    * \name Current vertex attributes.
+    * \note Values are valid only after FLUSH_VERTICES has been called.
     */
    /*@{*/
-   GLfloat Attrib[VERT_ATTRIB_MAX][4];         /**< Current vertex attributes
-                                                 *  indexed by VERT_ATTRIB_* */
-   GLfloat Index;                              /**< Current color index */
-   GLboolean EdgeFlag;                         /**< Current edge flag */
+   GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Position, color, texcoords, etc */
+   GLfloat Index;                      /**< Current color index */
+   GLboolean EdgeFlag;                 /**< Current edge flag */
    /*@}*/
 
    /**
-    * \name Values are always valid.  
-    * 
-    * \note BTW, note how similar this set of attributes is to the SWvertex
-    * data type in the software rasterizer...
+    * \name Current raster position attributes (always valid).
+    * \note This set of attributes is very similar to the SWvertex struct.
     */
    /*@{*/
-   GLfloat RasterPos[4];                       /**< Current raster position */
-   GLfloat RasterDistance;                     /**< Current raster distance */
-   GLfloat RasterColor[4];                     /**< Current raster color */
-   GLfloat RasterSecondaryColor[4];             /**< Current raster secondary color */
-   GLfloat RasterIndex;                                /**< Current raster index */
+   GLfloat RasterPos[4];
+   GLfloat RasterDistance;
+   GLfloat RasterColor[4];
+   GLfloat RasterSecondaryColor[4];
+   GLfloat RasterIndex;
    GLfloat RasterTexCoords[MAX_TEXTURE_COORD_UNITS][4];
-   GLboolean RasterPosValid;                   /**< Raster pos valid flag */
+   GLboolean RasterPosValid;
    /*@}*/
 };
 
@@ -889,6 +888,7 @@ struct gl_light_attrib
    GLenum ColorMaterialMode;           /**< GL_AMBIENT, GL_DIFFUSE, etc */
    GLbitfield ColorMaterialBitmask;    /**< bitmask formed from Face and Mode */
    GLboolean ColorMaterialEnabled;
+   GLenum ClampVertexColor;
 
    struct gl_light EnabledList;         /**< List sentinel */
 
@@ -1217,22 +1217,40 @@ typedef void (*StoreTexelFunc)(struct gl_texture_image *texImage,
                                GLint col, GLint row, GLint img,
                                const void *texel);
 
+
 /**
- * TexImage store function.  This is called by the glTex[Sub]Image
- * functions and is responsible for converting the user-specified texture
- * image into a specific (hardware) image format.
+ * This macro defines the (many) parameters to the texstore functions.
+ * \param dims  either 1 or 2 or 3
+ * \param baseInternalFormat  user-specified base internal format
+ * \param dstFormat  destination Mesa texture format
+ * \param dstAddr  destination image address
+ * \param dstX/Y/Zoffset  destination x/y/z offset (ala TexSubImage), in texels
+ * \param dstRowStride  destination image row stride, in bytes
+ * \param dstImageOffsets  offset of each 2D slice within 3D texture, in texels
+ * \param srcWidth/Height/Depth  source image size, in pixels
+ * \param srcFormat  incoming image format
+ * \param srcType  incoming image data type
+ * \param srcAddr  source image address
+ * \param srcPacking  source image packing parameters
  */
-typedef GLboolean (*StoreTexImageFunc)(GLcontext *ctx, GLuint dims,
-                          GLenum baseInternalFormat,
-                          const struct gl_texture_format *dstFormat,
-                          GLvoid *dstAddr,
-                          GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
-                          GLint dstRowStride, GLint dstImageStride,
-                          GLint srcWidth, GLint srcHeight, GLint srcDepth,
-                          GLenum srcFormat, GLenum srcType,
-                          const GLvoid *srcAddr,
-                          const struct gl_pixelstore_attrib *srcPacking);
+#define TEXSTORE_PARAMS \
+       GLcontext *ctx, GLuint dims, \
+       GLenum baseInternalFormat, \
+       const struct gl_texture_format *dstFormat, \
+       GLvoid *dstAddr, \
+       GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \
+       GLint dstRowStride, const GLuint *dstImageOffsets, \
+       GLint srcWidth, GLint srcHeight, GLint srcDepth, \
+       GLenum srcFormat, GLenum srcType, \
+       const GLvoid *srcAddr, \
+       const struct gl_pixelstore_attrib *srcPacking
+
+
 
+/**
+ * Texture image storage function.
+ */
+typedef GLboolean (*StoreTexImageFunc)(TEXSTORE_PARAMS);
 
 
 /**
@@ -1278,6 +1296,8 @@ struct gl_texture_format
 };
 
 
+#define MAX_3D_TEXTURE_SIZE (1 << (MAX_3D_TEXTURE_LEVELS - 1))
+
 /**
  * Texture image state.  Describes the dimensions of a texture image,
  * the texel format and pointers to Texel Fetch functions.
@@ -1295,8 +1315,6 @@ struct gl_texture_image
    GLuint Width;               /**< = 2^WidthLog2 + 2*Border */
    GLuint Height;              /**< = 2^HeightLog2 + 2*Border */
    GLuint Depth;               /**< = 2^DepthLog2 + 2*Border */
-   GLuint RowStride;           /**< == Width unless IsClientData and padded */
-   GLuint ImageStride;          /**< Stride between images, in texels */
    GLuint Width2;              /**< = Width - 2*Border */
    GLuint Height2;             /**< = Height - 2*Border */
    GLuint Depth2;              /**< = Depth - 2*Border */
@@ -1307,7 +1325,6 @@ struct gl_texture_image
    GLfloat WidthScale;         /**< used for mipmap LOD computation */
    GLfloat HeightScale;                /**< used for mipmap LOD computation */
    GLfloat DepthScale;         /**< used for mipmap LOD computation */
-   GLvoid *Data;               /**< Image data, accessed via FetchTexel() */
    GLboolean IsClientData;     /**< Data owned by client? */
    GLboolean _IsPowerOfTwo;    /**< Are all dimensions powers of two? */
 
@@ -1321,6 +1338,11 @@ struct gl_texture_image
    GLboolean IsCompressed;     /**< GL_ARB_texture_compression */
    GLuint CompressedSize;      /**< GL_ARB_texture_compression */
 
+   GLuint RowStride;           /**< == Width unless IsClientData and padded */
+   GLuint *ImageOffsets;        /**< if 3D texture: array [Depth] of offsets to
+                                     each 2D slice in 'Data', in texels */
+   GLvoid *Data;               /**< Image data, accessed via FetchTexel() */
+
    /**
     * \name For device driver:
     */
@@ -1493,11 +1515,17 @@ struct gl_texture_unit
    GLboolean ColorTableEnabled;
 };
 
-struct texenvprog_cache {
+struct texenvprog_cache_item {
    GLuint hash;
    void *key;
-   void *data;
-   struct texenvprog_cache *next;
+   struct gl_fragment_program *data;
+   struct texenvprog_cache_item *next;
+};
+
+struct texenvprog_cache {
+   struct texenvprog_cache_item **items;
+   GLuint size, n_items;
+   GLcontext *ctx;
 };
 
 /**
@@ -1530,7 +1558,7 @@ struct gl_texture_attrib
    struct gl_color_table Palette;
    
    /** Cached texenv fragment programs */
-   struct texenvprog_cache *env_fp_cache;
+   struct texenvprog_cache env_fp_cache;
 };
 
 
@@ -1637,11 +1665,17 @@ struct gl_client_array
 
 
 /**
- * Vertex array state
+ * Collection of vertex arrays.  Defined by the GL_APPLE_vertex_array_object
+ * extension, but a nice encapsulation in any case.
  */
-struct gl_array_attrib
+struct gl_array_object
 {
-   struct gl_client_array Vertex;           /**< client data descriptors */
+   /** Name of the array object as received from glGenVertexArrayAPPLE. */
+   GLuint Name;
+
+   /** Conventional vertex arrays */
+   /*@{*/
+   struct gl_client_array Vertex;
    struct gl_client_array Normal;
    struct gl_client_array Color;
    struct gl_client_array SecondaryColor;
@@ -1649,15 +1683,29 @@ struct gl_array_attrib
    struct gl_client_array Index;
    struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
    struct gl_client_array EdgeFlag;
+   /*@}*/
+
+   /** Generic arrays for vertex programs/shaders */
+   struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX];
+
+   /** Mask of _NEW_ARRAY_* values indicating which arrays are enabled */
+   GLbitfield _Enabled;
+};
 
-   struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX];  /**< GL_NV_vertex_program */
+
+/**
+ * Vertex array state
+ */
+struct gl_array_attrib
+{
+   struct gl_array_object *ArrayObj;
+   struct gl_array_object *DefaultArrayObj;
 
    GLint ActiveTexture;                /**< Client Active Texture */
    GLuint LockFirst;            /**< GL_EXT_compiled_vertex_array */
    GLuint LockCount;            /**< GL_EXT_compiled_vertex_array */
 
-   GLbitfield _Enabled;                /**< _NEW_ARRAY_* - bit set if array enabled */
-   GLbitfield NewState;                /**< _NEW_ARRAY_* */
+   GLbitfield NewState;                /**< mask of _NEW_ARRAY_* values */
 
 #if FEATURE_ARB_vertex_buffer_object
    struct gl_buffer_object *NullBufferObj;
@@ -1761,18 +1809,6 @@ struct gl_evaluators
 };
 
 
-/**
- * State used during execution of fragment programs.
- */
-struct fp_machine
-{
-   GLfloat Temporaries[MAX_NV_FRAGMENT_PROGRAM_TEMPS][4];
-   GLfloat Inputs[MAX_NV_FRAGMENT_PROGRAM_INPUTS][4];
-   GLfloat Outputs[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS][4];
-   GLuint CondCodes[4];
-};
-
-
 /**
  * Names of the various vertex/fragment program register files, etc.
  * NOTE: first four tokens must fit into 2 bits (see t_vb_arbprogram.c)
@@ -1790,19 +1826,20 @@ enum register_file
    PROGRAM_CONSTANT = 7,
    PROGRAM_WRITE_ONLY = 8,
    PROGRAM_ADDRESS = 9,
-   PROGRAM_UNDEFINED = 15  /* invalid value */
+   PROGRAM_UNDEFINED = 10,  /* invalid value */
+   PROGRAM_FILE_MAX
 };
 
 
 /** Vertex and fragment instructions */
 struct prog_instruction;
-struct program_parameter_list;
+struct gl_program_parameter_list;
 
 
 /**
  * Base class for any kind of program object
  */
-struct program
+struct gl_program
 {
    GLuint Id;
    GLubyte *String;          /**< Null-terminated program text */
@@ -1817,7 +1854,7 @@ struct program
    GLbitfield OutputsWritten; /* Bitmask of which output regs are written to */
 
    /** Named parameters, constants, etc. from program text */
-   struct program_parameter_list *Parameters;
+   struct gl_program_parameter_list *Parameters;
    /** Numbered local parameters */
    GLfloat LocalParams[MAX_PROGRAM_LOCAL_PARAMS][4];
 
@@ -1841,19 +1878,19 @@ struct program
 
 
 /** Vertex program object */
-struct vertex_program
+struct gl_vertex_program
 {
-   struct program Base;   /* base class */
-   GLboolean IsNVProgram; /* GL_NV_vertex_program ? */
-   GLboolean IsPositionInvariant;  /* GL_ARB_vertex_program / GL_NV_vertex_program1_1 */
-   void *TnlData;              /* should probably use Base.DriverData */
+   struct gl_program Base;   /**< base class */
+   GLboolean IsNVProgram;    /**< is this a GL_NV_vertex_program program? */
+   GLboolean IsPositionInvariant;
+   void *TnlData;              /**< should probably use Base.DriverData */
 };
 
 
 /** Fragment program object */
-struct fragment_program
+struct gl_fragment_program
 {
-   struct program Base;   /**< base class */
+   struct gl_program Base;   /**< base class */
    GLbitfield TexturesUsed[MAX_TEXTURE_IMAGE_UNITS];  /**< TEXTURE_x_BIT bitmask */
    GLuint NumAluInstructions; /**< GL_ARB_fragment_program */
    GLuint NumTexInstructions;
@@ -1877,30 +1914,25 @@ struct gl_program_state
 
 
 /**
- * State vars for GL_ARB/GL_NV_vertex_program
+ * Context state for vertex programs.
  */
 struct gl_vertex_program_state
 {
-   GLboolean Enabled;                  /**< GL_VERTEX_PROGRAM_ARB/NV */
-   GLboolean _Enabled;                 /**< Enabled and valid program? */
-   GLboolean PointSizeEnabled;         /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */
-   GLboolean TwoSideEnabled;           /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
-   struct vertex_program *Current;     /**< ptr to currently bound program */
-   struct vertex_program *_Current;    /**< ptr to currently bound
-                                          program, including internal
-                                          (t_vp_build.c) programs */
+   GLboolean Enabled;               /**< GL_VERTEX_PROGRAM_ARB/NV */
+   GLboolean _Enabled;              /**< Enabled and valid program? */
+   GLboolean PointSizeEnabled;      /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */
+   GLboolean TwoSideEnabled;        /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
+   struct gl_vertex_program *Current;  /**< ptr to currently bound program */
+   const struct gl_vertex_program *_Current;    /**< ptr to currently bound
+                                                 program, including internal
+                                                 (t_vp_build.c) programs */
 
+   GLfloat Parameters[MAX_NV_VERTEX_PROGRAM_PARAMS][4]; /**< Env params */
+
+   /* For GL_NV_vertex_program only: */
    GLenum TrackMatrix[MAX_NV_VERTEX_PROGRAM_PARAMS / 4];
    GLenum TrackMatrixTransform[MAX_NV_VERTEX_PROGRAM_PARAMS / 4];
 
-   GLfloat Parameters[MAX_NV_VERTEX_PROGRAM_PARAMS][4]; /* Env params */
-   /* Only used during program execution (may be moved someday): */
-   GLfloat Temporaries[MAX_NV_VERTEX_PROGRAM_TEMPS][4];
-   GLfloat Inputs[MAX_NV_VERTEX_PROGRAM_INPUTS][4];
-   GLuint InputsSize[MAX_NV_VERTEX_PROGRAM_INPUTS];
-   GLfloat Outputs[MAX_NV_VERTEX_PROGRAM_OUTPUTS][4];
-   GLint AddressReg[4];
-
 #if FEATURE_MESA_program_debug
    GLprogramcallbackMESA Callback;
    GLvoid *CallbackData;
@@ -1911,18 +1943,17 @@ struct gl_vertex_program_state
 
 
 /**
- * Context state for GL_ARB/NV_fragment_program
+ * Context state for fragment programs.
  */
 struct gl_fragment_program_state
 {
-   GLboolean Enabled;                    /* GL_VERTEX_PROGRAM_NV */
-   GLboolean _Enabled;                   /* Enabled and valid program? */
-   GLboolean _Active;
-   struct fragment_program *Current;     /* ptr to currently bound program */
-   struct fragment_program *_Current;    /* ptr to currently active program 
-                                           (including internal programs) */
-   struct fp_machine Machine;            /* machine state */
-   GLfloat Parameters[MAX_NV_FRAGMENT_PROGRAM_PARAMS][4]; /* Env params */
+   GLboolean Enabled;     /**< User-set fragment program enable flag */
+   GLboolean _Enabled;    /**< Fragment program enabled and valid? */
+   GLboolean _Active;     /**< Is a user program or internal program active? */
+   struct gl_fragment_program *Current;  /**< User-bound program */
+   const struct gl_fragment_program *_Current; /**< currently active program 
+                                              (including internal programs) */
+   GLfloat Parameters[MAX_NV_FRAGMENT_PROGRAM_PARAMS][4]; /**< Env params */
 
 #if FEATURE_MESA_program_debug
    GLprogramcallbackMESA Callback;
@@ -1942,17 +1973,6 @@ struct gl_fragment_program_state
 struct atifs_instruction;
 struct atifs_setupinst;
 
-/**
- * State for executing ATI fragment shader.
- */
-struct atifs_machine
-{
-   GLfloat Registers[6][4];         /** six temporary registers */
-   GLfloat PrevPassRegisters[6][4];
-   GLfloat Inputs[2][4];   /** Primary, secondary input colors */
-};
-
-
 /**
  * ATI fragment shader
  */
@@ -1983,7 +2003,6 @@ struct gl_ati_fragment_shader_state
    GLboolean _Enabled;                      /** enabled and valid shader? */
    GLboolean Compiling;
    GLfloat GlobalConstants[8][4];
-   struct atifs_machine Machine;            /* machine state */
    struct ati_fragment_shader *Current;
 };
 
@@ -2043,16 +2062,29 @@ struct gl_shared_state
    struct gl_texture_object *DefaultRect;
    /*@}*/
 
+   /**
+    * \name Thread safety and statechange notification for texture
+    * objects. 
+    *
+    * \todo Improve the granularity of locking.
+    */
+   /*@{*/
+   _glthread_Mutex TexMutex;              /**< texobj thread safety */
+   GLuint TextureStateStamp;              /**< state notification for shared tex  */
+   /*@}*/
+
+
+
    /**
     * \name Vertex/fragment programs
     */
    /*@{*/
    struct _mesa_HashTable *Programs; /**< All vertex/fragment programs */
 #if FEATURE_ARB_vertex_program
-   struct program *DefaultVertexProgram;
+   struct gl_program *DefaultVertexProgram;
 #endif
 #if FEATURE_ARB_fragment_program
-   struct program *DefaultFragmentProgram;
+   struct gl_program *DefaultFragmentProgram;
 #endif
    /*@}*/
 
@@ -2065,13 +2097,18 @@ struct gl_shared_state
    struct _mesa_HashTable *BufferObjects;
 #endif
 
+#if FEATURE_ARB_shader_objects
    struct _mesa_HashTable *GL2Objects;
+#endif
 
 #if FEATURE_EXT_framebuffer_object
    struct _mesa_HashTable *RenderBuffers;
    struct _mesa_HashTable *FrameBuffers;
 #endif
 
+   /** Objects associated with the GL_APPLE_vertex_array_object extension. */
+   struct _mesa_HashTable *ArrayObjects;
+
    void *DriverData;  /**< Device driver shared state */
 };
 
@@ -2287,6 +2324,8 @@ struct gl_program_constants
    GLuint MaxNativeTemps;
    GLuint MaxNativeAddressRegs; /* vertex program only, for now */
    GLuint MaxNativeParameters;
+   /* For shaders */
+   GLuint MaxUniformComponents;
 };
 
 
@@ -2336,6 +2375,9 @@ struct gl_constants
    /* GL_EXT_framebuffer_object */
    GLuint MaxColorAttachments;
    GLuint MaxRenderbufferSize;
+   /* GL_ARB_vertex_shader */
+   GLuint MaxVertexTextureImageUnits;
+   GLuint MaxVaryingFloats;
 };
 
 
@@ -2364,6 +2406,7 @@ struct gl_extensions
    GLboolean ARB_point_sprite;
    GLboolean ARB_shader_objects;
    GLboolean ARB_shading_language_100;
+   GLboolean ARB_shading_language_120;
    GLboolean ARB_shadow;
    GLboolean ARB_texture_border_clamp;
    GLboolean ARB_texture_compression;
@@ -2397,6 +2440,7 @@ struct gl_extensions
    GLboolean EXT_framebuffer_object;
    GLboolean EXT_fog_coord;
    GLboolean EXT_framebuffer_blit;
+   GLboolean EXT_gpu_program_parameters;
    GLboolean EXT_histogram;
    GLboolean EXT_multi_draw_arrays;
    GLboolean EXT_paletted_texture;
@@ -2423,12 +2467,14 @@ struct gl_extensions
    GLboolean EXT_texture_filter_anisotropic;
    GLboolean EXT_texture_lod_bias;
    GLboolean EXT_texture_mirror_clamp;
+   GLboolean EXT_texture_sRGB;
    GLboolean EXT_timer_query;
    GLboolean EXT_vertex_array;
    GLboolean EXT_vertex_array_set;
    /* vendor extensions */
    GLboolean APPLE_client_storage;
    GLboolean APPLE_packed_pixels;
+   GLboolean APPLE_vertex_array_object;
    GLboolean ATI_texture_mirror_once;
    GLboolean ATI_texture_env_combine3;
    GLboolean ATI_fragment_shader;
@@ -2564,7 +2610,7 @@ struct matrix_stack
 #define _NEW_ARRAY_COLOR0           VERT_BIT_COLOR0
 #define _NEW_ARRAY_COLOR1           VERT_BIT_COLOR1
 #define _NEW_ARRAY_FOGCOORD         VERT_BIT_FOG
-#define _NEW_ARRAY_INDEX            VERT_BIT_SIX
+#define _NEW_ARRAY_INDEX            VERT_BIT_COLOR_INDEX
 #define _NEW_ARRAY_EDGEFLAG         VERT_BIT_SEVEN
 #define _NEW_ARRAY_TEXCOORD_0       VERT_BIT_TEX0
 #define _NEW_ARRAY_TEXCOORD_1       VERT_BIT_TEX1
@@ -2869,8 +2915,8 @@ struct __GLcontextRec
    struct gl_fragment_program_state FragmentProgram;  /**< GL_ARB/NV_vertex_program */
    struct gl_ati_fragment_shader_state ATIFragmentShader;  /**< GL_ATI_fragment_shader */
 
-   struct fragment_program *_TexEnvProgram;     /**< Texture state as fragment program */
-   struct vertex_program *_TnlProgram;          /**< Fixed func TNL state as vertex program */
+   struct gl_fragment_program *_TexEnvProgram;     /**< Texture state as fragment program */
+   struct gl_vertex_program *_TnlProgram;          /**< Fixed func TNL state as vertex program */
 
    GLboolean _MaintainTnlProgram;
    GLboolean _MaintainTexEnvProgram;
@@ -2899,6 +2945,8 @@ struct __GLcontextRec
    GLboolean _ForceEyeCoords; 
    GLenum _CurrentProgram;    /* currently executing program */
 
+   GLuint TextureStateTimestamp; /* detect changes to shared state */
+
    struct gl_shine_tab *_ShineTable[2]; /**< Active shine tables */
    struct gl_shine_tab *_ShineTabList;  /**< MRU list of inactive shine tables */
    /**@}*/