X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Ftnl%2Ft_context.h;h=226b877d8525d705b6edf6fd996ce05478ab2375;hb=cd1cefae9146fc14b35ee93a04bdb1b1590fba7b;hp=22d0423d162dead8faed9ce779176635cf300124;hpb=22144ab7552f0799bcfca506bf4ffa7f70a06649;p=mesa.git diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index 22d0423d162..226b877d852 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -1,4 +1,4 @@ -/* $Id: t_context.h,v 1.17 2001/03/12 00:48:43 gareth 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 */ @@ -194,20 +197,21 @@ struct immediate GLuint *MaterialMask; GLuint LastMaterial; GLuint MaterialOrMask; + GLuint MaterialAndMask; GLfloat (*TexCoord[MAX_TEXTURE_UNITS])[4]; 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]; }; @@ -216,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]; @@ -255,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 */ @@ -267,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 @@ -344,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; }; @@ -353,19 +358,124 @@ struct tnl_eval_store { GLuint EvalMap1Flags; GLuint EvalMap2Flags; GLuint EvalNewState; + struct immediate *im; /* used for temporary data */ +}; - 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]; + +typedef void (*points_func)( GLcontext *ctx, GLuint first, GLuint last ); +typedef void (*line_func)( GLcontext *ctx, GLuint v1, GLuint v2 ); +typedef void (*triangle_func)( GLcontext *ctx, + GLuint v1, GLuint v2, GLuint v3 ); +typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2, + GLuint v3, GLuint v4 ); +typedef void (*render_func)( GLcontext *ctx, GLuint start, GLuint count, + GLuint flags ); +typedef void (*interp_func)( GLcontext *ctx, + GLfloat t, GLuint dst, GLuint out, GLuint in, + GLboolean force_boundary ); +typedef void (*copy_pv_func)( GLcontext *ctx, GLuint dst, GLuint src ); + + +struct tnl_device_driver { + /*** + *** TNL Pipeline + ***/ + + 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. + */ + + /*** + *** Rendering + ***/ + + void (*RenderStart)(GLcontext *ctx); + void (*RenderFinish)(GLcontext *ctx); + /* Called before and after all rendering operations, including DrawPixels, + * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands. + * These are a suitable place for grabbing/releasing hardware locks. + */ + + void (*RenderPrimitive)(GLcontext *ctx, GLenum mode); + /* Called between RednerStart() and RenderFinish() to indicate the + * type of primitive we're about to draw. Mode will be one of the + * modes accepted by glBegin(). + */ + + 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 ); + /* Render a polygon with vertices whose indexes are in the + * 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; + quad_func QuadFunc; + /* These functions are called in order to render points, lines, + * triangles and quads. These are only called via the T&L module. + */ + + render_func *RenderTabVerts; + 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. RenderTabVerts is used for non-indexed + * arrays of vertices. RenderTabElts is used for indexed arrays of + * vertices. + */ + + void (*ResetLineStipple)( GLcontext *ctx ); + /* Reset the hardware's line stipple counter. + */ + + void (*BuildProjectedVertices)( GLcontext *ctx, + GLuint start, GLuint end, + GLuint new_inputs); + /* This function is called whenever new vertices are required for + * rendering. The vertices in question are those n such that start + * <= n < end. The new_inputs parameter indicates those fields of + * the vertex which need to be updated, if only a partial repair of + * the vertex is required. + * + * This function is called only from _tnl_render_stage in tnl/t_render.c. + */ + + + GLboolean (*MultipassFunc)( GLcontext *ctx, GLuint passno ); + /* Driver may request additional render passes by returning GL_TRUE + * when this function is called. This function will be called + * after the first pass, and passes will be made until the function + * returns GL_FALSE. If no function is registered, only one pass + * is made. + * + * This function will be first invoked with passno == 1. + */ }; + typedef struct { + /* Driver interface. + */ + struct tnl_device_driver Driver; + /* Track whether the module is active. */ GLboolean bound_exec; @@ -386,10 +496,12 @@ typedef struct { GLuint *tmp_primitive; GLuint *tmp_primitive_length; - /* Set when executing an internally generated immediate. + /* Set when executing an internally generated begin/end object. If + * such an object is encountered in a display list, it will be + * replayed only if the list is outside any existing begin/end + * objects. */ GLboolean ReplayHardBeginEnd; - GLenum CurrentPrimitive; /* Note which vertices need copying over succesive immediates. * Will add save versions to precompute vertex copying where @@ -405,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: */