summaryrefslogtreecommitdiff
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2001-07-12 22:09:21 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2001-07-12 22:09:21 +0000
commit1182ffeec39bf419928ba862c225e80a439fee7a (patch)
treeaf9e3f9019e3c59cb73d770eb60e94c5c77bdd25 /src/mesa/tnl
parentfae7b778b81b686ef419f971064b5fe12fb4ead3 (diff)
Rename some of the tnl->Driver.* functions to tnl->Driver.Render.*, to make it
clear that these are owned by t_vb_render.c. Make swrast_setup opaque - it now hooks itself directly into tnl->Driver.Render.*. Add a _swsetup_Wakeup() call that does this. Update X11 (tested), osmesa and FX drivers for this change. FX compiles but is probably broken as the changes there are large. It was the only remaining driver that used the internal _swsetup_ functions for interp and copy_pv. This usage has been replaced with code from the DRI tdfx driver.
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_context.c6
-rw-r--r--src/mesa/tnl/t_context.h162
-rw-r--r--src/mesa/tnl/t_pipeline.h8
-rw-r--r--src/mesa/tnl/t_vb_cliptmp.h20
-rw-r--r--src/mesa/tnl/t_vb_render.c102
5 files changed, 160 insertions, 138 deletions
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index 0acb9f9db2..76f4180b65 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -1,4 +1,4 @@
-/* $Id: t_context.c,v 1.20 2001/06/28 17:34:14 keithw Exp $ */
+/* $Id: t_context.c,v 1.21 2001/07/12 22:09:21 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -123,8 +123,8 @@ _tnl_CreateContext( GLcontext *ctx )
ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
- tnl->Driver.RenderTabElts = _tnl_render_tab_elts;
- tnl->Driver.RenderTabVerts = _tnl_render_tab_verts;
+ tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
+ tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
return GL_TRUE;
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index a7ecb346b7..7142f31616 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.29 2001/06/28 17:34:14 keithw Exp $ */
+/* $Id: t_context.h,v 1.30 2001/07/12 22:09:22 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -376,6 +376,9 @@ 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 );
+typedef void (*setup_func)( GLcontext *ctx,
+ GLuint start, GLuint end,
+ GLuint new_inputs);
struct tnl_device_driver {
@@ -390,87 +393,86 @@ struct tnl_device_driver {
*/
/***
- *** Rendering
+ *** Rendering -- These functions called only from t_vb_render.c
***/
-
- 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 <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;
- 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.
- */
+ struct {
+ void (*Start)(GLcontext *ctx);
+ void (*Finish)(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 (*PrimitiveNotify)(GLcontext *ctx, GLenum mode);
+ /* Called between RenderStart() 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 Interp;
+ /* 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 CopyPV;
+ /* The copy function is used to make a copy of a vertex. All pertinant
+ * vertex attributes should be copied.
+ */
+
+ void (*ClippedPolygon)( GLcontext *ctx, const GLuint *elts, GLuint n );
+ /* Render a polygon with <n> vertices whose indexes are in the <elts>
+ * array.
+ */
+
+ void (*ClippedLine)( GLcontext *ctx, GLuint v0, GLuint v1 );
+ /* Render a line between the two vertices given by indexes v0 and v1. */
+
+ points_func Points; /* must now respect vb->elts */
+ line_func Line;
+ triangle_func Triangle;
+ quad_func Quad;
+ /* These functions are called in order to render points, lines,
+ * triangles and quads. These are only called via the T&L module.
+ */
+
+ render_func *PrimTabVerts;
+ render_func *PrimTabElts;
+ /* 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.
+ */
+
+ setup_func BuildVertices;
+ /* 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 (*Multipass)( 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.
+ */
+ } Render;
};
-
+
typedef struct {
diff --git a/src/mesa/tnl/t_pipeline.h b/src/mesa/tnl/t_pipeline.h
index 60b349d0e0..cb057df810 100644
--- a/src/mesa/tnl/t_pipeline.h
+++ b/src/mesa/tnl/t_pipeline.h
@@ -1,4 +1,4 @@
-/* $Id: t_pipeline.h,v 1.7 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_pipeline.h,v 1.8 2001/07/12 22:09:22 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -66,4 +66,10 @@ extern const struct gl_pipeline_stage *_tnl_default_pipeline[];
extern render_func _tnl_render_tab_elts[];
extern render_func _tnl_render_tab_verts[];
+extern void _tnl_RenderClippedPolygon( GLcontext *ctx,
+ const GLuint *elts, GLuint n );
+
+extern void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj );
+
+
#endif
diff --git a/src/mesa/tnl/t_vb_cliptmp.h b/src/mesa/tnl/t_vb_cliptmp.h
index 90b9b82f53..8a26ad2de7 100644
--- a/src/mesa/tnl/t_vb_cliptmp.h
+++ b/src/mesa/tnl/t_vb_cliptmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_vb_cliptmp.h,v 1.12 2001/05/09 12:25:40 keithw Exp $ */
+/* $Id: t_vb_cliptmp.h,v 1.13 2001/07/12 22:09:22 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -124,7 +124,7 @@ static __inline void TAG(clip_line)( GLcontext *ctx,
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- interp_func interp = tnl->Driver.RenderInterp;
+ interp_func interp = tnl->Driver.Render.Interp;
GLfloat (*coord)[4] = VB->ClipPtr->data;
GLuint ii = i, jj = j, p;
@@ -152,9 +152,9 @@ static __inline void TAG(clip_line)( GLcontext *ctx,
}
if ((ctx->_TriangleCaps & DD_FLATSHADE) && j != jj)
- tnl->Driver.RenderCopyPV( ctx, jj, j );
+ tnl->Driver.Render.CopyPV( ctx, jj, j );
- tnl->Driver.RenderClippedLine( ctx, ii, jj );
+ tnl->Driver.Render.ClippedLine( ctx, ii, jj );
}
@@ -166,7 +166,7 @@ static __inline void TAG(clip_tri)( GLcontext *ctx,
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- interp_func interp = tnl->Driver.RenderInterp;
+ interp_func interp = tnl->Driver.Render.Interp;
GLfloat (*coord)[4] = VB->ClipPtr->data;
GLuint pv = v2;
GLuint vlist[2][MAX_CLIPPED_VERTICES];
@@ -203,11 +203,11 @@ static __inline void TAG(clip_tri)( GLcontext *ctx,
if (ctx->_TriangleCaps & DD_FLATSHADE) {
if (pv != inlist[0]) {
ASSERT( inlist[0] >= VB->FirstClipped );
- tnl->Driver.RenderCopyPV( ctx, inlist[0], pv );
+ tnl->Driver.Render.CopyPV( ctx, inlist[0], pv );
}
}
- tnl->Driver.RenderClippedPolygon( ctx, inlist, n );
+ tnl->Driver.Render.ClippedPolygon( ctx, inlist, n );
}
@@ -219,7 +219,7 @@ static __inline void TAG(clip_quad)( GLcontext *ctx,
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- interp_func interp = tnl->Driver.RenderInterp;
+ interp_func interp = tnl->Driver.Render.Interp;
GLfloat (*coord)[4] = VB->ClipPtr->data;
GLuint pv = v3;
GLuint vlist[2][MAX_CLIPPED_VERTICES];
@@ -256,11 +256,11 @@ static __inline void TAG(clip_quad)( GLcontext *ctx,
if (ctx->_TriangleCaps & DD_FLATSHADE) {
if (pv != inlist[0]) {
ASSERT( inlist[0] >= VB->FirstClipped );
- tnl->Driver.RenderCopyPV( ctx, inlist[0], pv );
+ tnl->Driver.Render.CopyPV( ctx, inlist[0], pv );
}
}
- tnl->Driver.RenderClippedPolygon( ctx, inlist, n );
+ tnl->Driver.Render.ClippedPolygon( ctx, inlist, n );
}
#undef W
diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c
index ec3cb02bb6..5ad8c3e5be 100644
--- a/src/mesa/tnl/t_vb_render.c
+++ b/src/mesa/tnl/t_vb_render.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_render.c,v 1.21 2001/06/15 15:22:08 brianp Exp $ */
+/* $Id: t_vb_render.c,v 1.22 2001/07/12 22:09:22 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -35,17 +35,8 @@
* This file makes calls to project vertices and to the point, line
* and triangle rasterizers via the function pointers:
*
- * context->Driver.BuildProjectedVertices()
+ * context->Driver.Render.*
*
- * context->Driver.PointsFunc()
- * context->Driver.LineFunc()
- * context->Driver.TriangleFunc()
- * context->Driver.QuadFunc()
- *
- * context->Driver.RenderTabVerts[]
- * context->Driver.RenderTabElts[]
- *
- * None of these may be null.
*/
@@ -102,7 +93,7 @@
/* Vertices, with the possibility of clipping.
*/
#define RENDER_POINTS( start, count ) \
- tnl->Driver.PointsFunc( ctx, start, count )
+ tnl->Driver.Render.Points( ctx, start, count )
#define RENDER_LINE( v1, v2 ) \
do { \
@@ -142,16 +133,16 @@ do { \
const GLuint * const elt = VB->Elts; \
const GLubyte *mask = VB->ClipMask; \
const GLuint sz = VB->ClipPtr->size; \
- const line_func LineFunc = tnl->Driver.LineFunc; \
- const triangle_func TriangleFunc = tnl->Driver.TriangleFunc; \
- const quad_func QuadFunc = tnl->Driver.QuadFunc; \
+ const line_func LineFunc = tnl->Driver.Render.Line; \
+ const triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \
+ const quad_func QuadFunc = tnl->Driver.Render.Quad; \
const GLboolean stipple = ctx->Line.StippleFlag; \
(void) (LineFunc && TriangleFunc && QuadFunc); \
(void) elt; (void) mask; (void) sz; (void) stipple;
#define TAG(x) clip_##x##_verts
-#define INIT(x) tnl->Driver.RenderPrimitive( ctx, x )
-#define RESET_STIPPLE if (stipple) tnl->Driver.ResetLineStipple( ctx )
+#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
+#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx )
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE
#define PRESERVE_VB_DEFS
#include "t_vb_rendertmp.h"
@@ -174,7 +165,7 @@ static void clip_elt_triangles( GLcontext *ctx,
GLuint flags )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
- render_func render_tris = tnl->Driver.RenderTabElts[GL_TRIANGLES];
+ render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES];
struct vertex_buffer *VB = &tnl->vb;
const GLuint * const elt = VB->Elts;
GLubyte *mask = VB->ClipMask;
@@ -182,7 +173,7 @@ static void clip_elt_triangles( GLcontext *ctx,
GLuint j;
(void) flags;
- tnl->Driver.RenderPrimitive( ctx, GL_TRIANGLES );
+ tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES );
for (j=start; j < last; j+=3 ) {
GLubyte c1 = mask[elt[j]];
@@ -214,7 +205,7 @@ static void clip_elt_triangles( GLcontext *ctx,
/* Vertices, no clipping.
*/
#define RENDER_POINTS( start, count ) \
- tnl->Driver.PointsFunc( ctx, start, count )
+ tnl->Driver.Render.Points( ctx, start, count )
#define RENDER_LINE( v1, v2 ) \
LineFunc( ctx, v1, v2 )
@@ -231,15 +222,15 @@ static void clip_elt_triangles( GLcontext *ctx,
TNLcontext *tnl = TNL_CONTEXT(ctx); \
struct vertex_buffer *VB = &tnl->vb; \
const GLuint * const elt = VB->Elts; \
- const line_func LineFunc = tnl->Driver.LineFunc; \
- const triangle_func TriangleFunc = tnl->Driver.TriangleFunc; \
- const quad_func QuadFunc = tnl->Driver.QuadFunc; \
+ const line_func LineFunc = tnl->Driver.Render.Line; \
+ const triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \
+ const quad_func QuadFunc = tnl->Driver.Render.Quad; \
(void) (LineFunc && TriangleFunc && QuadFunc); \
(void) elt;
-#define RESET_STIPPLE tnl->Driver.ResetLineStipple( ctx )
+#define RESET_STIPPLE tnl->Driver.Render.ResetLineStipple( ctx )
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE
-#define INIT(x) tnl->Driver.RenderPrimitive( ctx, x )
+#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
#define RENDER_TAB_QUALIFIER
#define PRESERVE_VB_DEFS
#include "t_vb_rendertmp.h"
@@ -253,6 +244,27 @@ static void clip_elt_triangles( GLcontext *ctx,
#include "t_vb_rendertmp.h"
+/**********************************************************************/
+/* Helper functions for drivers */
+/**********************************************************************/
+
+void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n )
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *VB = &tnl->vb;
+ GLuint *tmp = VB->Elts;
+
+ VB->Elts = (GLuint *)elts;
+ tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
+ VB->Elts = tmp;
+}
+
+void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ tnl->Driver.Render.Line( ctx, ii, jj );
+}
+
/**********************************************************************/
@@ -274,31 +286,33 @@ static GLboolean run_render( GLcontext *ctx,
* that window coordinates are guarenteed not to change before
* rendering.
*/
- ASSERT(tnl->Driver.RenderStart);
+ ASSERT(tnl->Driver.Render.Start);
- tnl->Driver.RenderStart( ctx );
+ tnl->Driver.Render.Start( ctx );
- ASSERT(tnl->Driver.BuildProjectedVertices);
- ASSERT(tnl->Driver.RenderPrimitive);
- ASSERT(tnl->Driver.PointsFunc);
- ASSERT(tnl->Driver.LineFunc);
- ASSERT(tnl->Driver.TriangleFunc);
- ASSERT(tnl->Driver.QuadFunc);
- ASSERT(tnl->Driver.ResetLineStipple);
- ASSERT(tnl->Driver.RenderInterp);
- ASSERT(tnl->Driver.RenderCopyPV);
- ASSERT(tnl->Driver.RenderClippedLine);
- ASSERT(tnl->Driver.RenderClippedPolygon);
- ASSERT(tnl->Driver.RenderFinish);
+ ASSERT(tnl->Driver.Render.BuildVertices);
+ ASSERT(tnl->Driver.Render.PrimitiveNotify);
+ ASSERT(tnl->Driver.Render.Points);
+ ASSERT(tnl->Driver.Render.Line);
+ ASSERT(tnl->Driver.Render.Triangle);
+ ASSERT(tnl->Driver.Render.Quad);
+ ASSERT(tnl->Driver.Render.ResetLineStipple);
+ ASSERT(tnl->Driver.Render.Interp);
+ ASSERT(tnl->Driver.Render.CopyPV);
+ ASSERT(tnl->Driver.Render.ClippedLine);
+ ASSERT(tnl->Driver.Render.ClippedPolygon);
+ ASSERT(tnl->Driver.Render.Finish);
- tnl->Driver.BuildProjectedVertices( ctx, 0, VB->Count, new_inputs );
+ tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, new_inputs );
if (VB->ClipOrMask) {
tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts;
clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles;
}
else {
- tab = VB->Elts ? tnl->Driver.RenderTabElts : tnl->Driver.RenderTabVerts;
+ tab = (VB->Elts ?
+ tnl->Driver.Render.PrimTabElts :
+ tnl->Driver.Render.PrimTabVerts);
}
do
@@ -313,11 +327,11 @@ static GLboolean run_render( GLcontext *ctx,
if (length)
tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
}
- } while (tnl->Driver.MultipassFunc &&
- tnl->Driver.MultipassFunc( ctx, ++pass ));
+ } while (tnl->Driver.Render.Multipass &&
+ tnl->Driver.Render.Multipass( ctx, ++pass ));
- tnl->Driver.RenderFinish( ctx );
+ tnl->Driver.Render.Finish( ctx );
/* _swrast_flush(ctx); */
/* usleep(1000000); */
return GL_FALSE; /* finished the pipe */