Allow different max texture sizes for 1/2D, 3D and cube maps.
[mesa.git] / src / mesa / tnl / t_context.h
index db315e69f76117da7360a34c7666c6f90b2829ef..226b877d8525d705b6edf6fd996ce05478ab2375 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t_context.h,v 1.19 2001/04/09 14:47:34 keithw Exp $ */
+/* $Id: t_context.h,v 1.28 2001/06/04 16:09:28 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -176,6 +176,9 @@ struct immediate
    GLuint ArrayEltFlags;       /* precalc'ed for glArrayElt */
    GLuint ArrayEltIncr;
    GLuint ArrayEltFlush;
+
+#define FLUSH_ELT_EAGER 0x1
+#define FLUSH_ELT_LAZY 0x2
    GLuint FlushElt;
 
    GLuint MaxTextureUnits;     /* precalc'ed for glMultiTexCoordARB */
@@ -201,14 +204,14 @@ struct immediate
    GLuint  Primitive[IMM_SIZE];            /* BEGIN/END */
    GLuint  PrimitiveLength[IMM_SIZE]; /* BEGIN/END */
    GLuint  Flag[IMM_SIZE];         /* VERT_* flags */
-   GLchan  Color[IMM_SIZE][4];
+   GLfloat Color[IMM_SIZE][4];
    GLfloat Obj[IMM_SIZE][4];
    GLfloat Normal[IMM_SIZE][3];
    GLfloat TexCoord0[IMM_SIZE][4];  /* just VERT_TEX0 */
    GLuint  Elt[IMM_SIZE];
    GLubyte EdgeFlag[IMM_SIZE];
    GLuint  Index[IMM_SIZE];
-   GLchan  SecondaryColor[IMM_SIZE][4];
+   GLfloat SecondaryColor[IMM_SIZE][4];
    GLfloat FogCoord[IMM_SIZE];
 };
 
@@ -217,8 +220,8 @@ struct vertex_arrays
 {
    GLvector4f  Obj;
    GLvector3f  Normal;
-   GLvector4chan Color;
-   GLvector4chan SecondaryColor;
+   struct gl_client_array Color;
+   struct gl_client_array SecondaryColor;
    GLvector1ui Index;
    GLvector1ub EdgeFlag;
    GLvector4f  TexCoord[MAX_TEXTURE_UNITS];
@@ -256,8 +259,8 @@ typedef struct vertex_buffer
    GLboolean   *EdgeFlag;                      /* VERT_EDGE */
    GLvector4f  *TexCoordPtr[MAX_TEXTURE_UNITS];        /* VERT_TEX_0..n */
    GLvector1ui *IndexPtr[2];                   /* VERT_INDEX */
-   GLvector4chan *ColorPtr[2];                 /* VERT_RGBA */
-   GLvector4chan *SecondaryColorPtr[2];         /* VERT_SPEC_RGB */
+   struct gl_client_array *ColorPtr[2];                        /* VERT_RGBA */
+   struct gl_client_array *SecondaryColorPtr[2];         /* VERT_SPEC_RGB */
    GLvector1f  *FogCoordPtr;                   /* VERT_FOG_COORD */
    GLvector1f  *PointSizePtr;                  /* VERT_POINT_SIZE */
    GLmaterial (*Material)[2];                   /* VERT_MATERIAL, optional */
@@ -268,6 +271,7 @@ typedef struct vertex_buffer
 
 
    GLuint importable_data;
+   void *import_source;
    void (*import_data)( GLcontext *ctx, GLuint flags, GLuint vecflags );
    /* Callback to the provider of the untransformed input for the
     * render stage (or other stages) to call if they need to write into
@@ -345,7 +349,7 @@ struct gl_pipeline {
    GLuint run_state_changes;     /* state changes since last run */
    GLuint run_input_changes;     /* VERT_* changes since last run */
    GLuint inputs;                /* VERT_* inputs to pipeline */
-   struct gl_pipeline_stage stages[MAX_PIPELINE_STAGES];
+   struct gl_pipeline_stage stages[MAX_PIPELINE_STAGES+1];
    GLuint nr_stages;
 };
 
@@ -354,15 +358,7 @@ struct tnl_eval_store {
    GLuint EvalMap1Flags;
    GLuint EvalMap2Flags;
    GLuint EvalNewState;
-
-   GLfloat Coord[IMM_SIZE][4];
-   GLfloat Obj[IMM_SIZE][4];
-   GLfloat TexCoord[IMM_SIZE][4];
-   GLfloat Normal[IMM_SIZE][3];
-   GLchan  Color[IMM_SIZE][4];
-   GLuint  Index[IMM_SIZE];
-   GLuint  Flag[IMM_SIZE];
-   GLuint  Elts[IMM_SIZE];
+   struct immediate *im;       /* used for temporary data */
 };
 
 
@@ -375,7 +371,7 @@ typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2,
 typedef void (*render_func)( GLcontext *ctx, GLuint start, GLuint count,
                             GLuint flags );
 typedef void (*interp_func)( GLcontext *ctx,
-                            GLfloat t, GLuint dst, GLuint in, GLuint out,
+                            GLfloat t, GLuint dst, GLuint out, GLuint in,
                             GLboolean force_boundary );
 typedef void (*copy_pv_func)( GLcontext *ctx, GLuint dst, GLuint src );
 
@@ -385,10 +381,10 @@ struct tnl_device_driver {
     *** TNL Pipeline
     ***/
 
-   void (*PipelineStart)(GLcontext *ctx);
-   void (*PipelineFinish)(GLcontext *ctx);
-   /* Called before and after all pipeline stages.
-    * These are a suitable place for grabbing/releasing hardware locks.
+   void (*RunPipeline)(GLcontext *ctx);
+   /* Replaces PipelineStart/PipelineFinish -- intended to allow
+    * drivers to wrap _tnl_run_pipeline() with code to validate state
+    * and grab/release hardware locks.  
     */
 
    /***
@@ -409,13 +405,25 @@ struct tnl_device_driver {
     */
 
    interp_func RenderInterp;
+   /* The interp function is called by the clipping routines when we need
+    * to generate an interpolated vertex.  All pertinant vertex ancilliary
+    * data should be computed by interpolating between the 'in' and 'out'
+    * vertices.
+    */
+
    copy_pv_func RenderCopyPV;
+   /* The copy function is used to make a copy of a vertex.  All pertinant
+    * vertex attributes should be copied.
+    */
+
    void (*RenderClippedPolygon)( GLcontext *ctx, const GLuint *elts, GLuint n );
-   void (*RenderClippedLine)( GLcontext *ctx, GLuint v0, GLuint v1 );
-   /* Functions to interpolate between prebuilt vertices, copy flat-shade
-    * provoking color, and to render clipped primitives.
+   /* Render a polygon with <n> vertices whose indexes are in the <elts>
+    * array.
     */
 
+   void (*RenderClippedLine)( GLcontext *ctx, GLuint v0, GLuint v1 );
+   /* Render a line between the two vertices given by indexes v0 and v1. */
+
    points_func           PointsFunc; /* must now respect vb->elts */
    line_func             LineFunc;
    triangle_func         TriangleFunc;
@@ -428,7 +436,9 @@ struct tnl_device_driver {
    render_func          *RenderTabElts;
    /* Render whole unclipped primitives (points, lines, linestrips,
     * lineloops, etc).  The tables are indexed by the GL enum of the
-    * primitive to be rendered.
+    * primitive to be rendered.  RenderTabVerts is used for non-indexed
+    * arrays of vertices.  RenderTabElts is used for indexed arrays of
+    * vertices.
     */
 
    void (*ResetLineStipple)( GLcontext *ctx );
@@ -492,7 +502,6 @@ typedef struct {
     * objects.  
     */
    GLboolean ReplayHardBeginEnd;
-   GLenum CurrentPrimitive;
 
    /* Note which vertices need copying over succesive immediates.
     * Will add save versions to precompute vertex copying where
@@ -508,9 +517,14 @@ typedef struct {
    GLuint DlistPrimitiveLength;
    GLuint DlistLastPrimitive;
 
+   /* Cache a single free immediate (refcount == 0)
+    */
+   struct immediate *freed_immediate;   
+
    /* Probably need a better configuration mechanism:
     */
    GLboolean NeedProjCoords;
+   GLboolean LoopbackDListCassettes;
 
    /* Derived state and storage for _tnl_eval_vb:
     */