summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/glide
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2001-01-05 02:26:48 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2001-01-05 02:26:48 +0000
commit58e991705392a2e17a1c8b034f4083a0adaf1943 (patch)
tree828804ca2671809e92a10642030ecd2d21a27b6d /src/mesa/drivers/glide
parentf22c04cdaec47dfef1068af0e90822062478631b (diff)
Remove 'pv' parameter from Line/Tri/Point funcs. The provoking vertex
is always the last vertex parameter. Modify clipping to preserve pv colors. Modify swrast and X11 driver to expect the pv in the last vertex (was looking in the first vertex previously). Remove all handling of flatshading from swrast_setup. Allow drivers to override the unclipped render tabs in tnl_render_stage directly. (Like in 3.4). Removed fxsimplerender stage. Modified t_vb_rendertmp.h to remove the need for 'parity' arguments in RENDER_TRI macros.
Diffstat (limited to 'src/mesa/drivers/glide')
-rw-r--r--src/mesa/drivers/glide/fxdd.c7
-rw-r--r--src/mesa/drivers/glide/fxdrv.h2
-rw-r--r--src/mesa/drivers/glide/fxtris.c63
-rw-r--r--src/mesa/drivers/glide/fxvb.c66
-rw-r--r--src/mesa/drivers/glide/fxvbtmp.h2
5 files changed, 103 insertions, 37 deletions
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index 306e0be3b9..b36cbee47c 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -651,8 +651,7 @@ static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name)
}
static const struct gl_pipeline_stage *fx_pipeline[] = {
- &_tnl_update_material_stage,
- /* TODO: Add the fastpath here */
+ &_tnl_update_material_stage, /* TODO: Add the fastpath here */
&_tnl_vertex_transform_stage,
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
@@ -660,8 +659,7 @@ static const struct gl_pipeline_stage *fx_pipeline[] = {
&_tnl_texgen_stage,
&_tnl_texture_transform_stage,
&_tnl_point_attenuation_stage,
- &fx_render_stage, /* ADD: render simple unclipped vb's */
- &_tnl_render_stage, /* KEEP: the old render stage for fallbacks */
+ &_tnl_render_stage,
0,
};
@@ -680,7 +678,6 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
if (firsttime) {
fxDDSetupInit();
fxDDTrifuncInit();
-/* fxDDFastPathInit(); */
firsttime = 0;
}
diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h
index 38ce0ce2da..cefd6d0e1a 100644
--- a/src/mesa/drivers/glide/fxdrv.h
+++ b/src/mesa/drivers/glide/fxdrv.h
@@ -509,7 +509,7 @@ struct tfxMesaContext {
GLuint size;
};
-typedef void (*tfxSetupFunc)(GLcontext *ctx, GLuint, GLuint, GLuint);
+typedef void (*tfxSetupFunc)(GLcontext *ctx, GLuint, GLuint );
extern GrHwConfiguration glbHWConfig;
extern int glbCurrentBoard;
diff --git a/src/mesa/drivers/glide/fxtris.c b/src/mesa/drivers/glide/fxtris.c
index 7d887133b6..11072a2601 100644
--- a/src/mesa/drivers/glide/fxtris.c
+++ b/src/mesa/drivers/glide/fxtris.c
@@ -11,6 +11,7 @@
#include "swrast_setup/swrast_setup.h"
#include "tnl/t_context.h"
+#include "tnl/t_pipeline.h"
#include "fxdrv.h"
#include "fxglidew.h"
@@ -469,6 +470,56 @@ fx_null_tri( GLcontext *ctx,
+
+/**********************************************************************/
+/* Render whole begin/end objects */
+/**********************************************************************/
+
+
+/* Vertices, no clipping.
+ */
+#define RENDER_POINTS( start, count ) \
+ for ( ; start < count ; start++) \
+ grDrawPoint( &v[ELT(start)].v );
+
+#define RENDER_LINE( i1, i ) \
+ grDrawLine( &v[i1].v, &v[i].v )
+
+#define RENDER_TRI( i2, i1, i ) \
+ grDrawTriangle( &v[i2].v, &v[i1].v, &v[i].v )
+
+#define RENDER_QUAD( i3, i2, i1, i ) \
+ grDrawTriangle( &v[i3].v, &v[i2].v, &v[i].v ); \
+ grDrawTriangle( &v[i2].v, &v[i1].v, &v[i].v )
+
+#define TAG(x) fx_##x##_verts
+#define LOCAL_VARS \
+ fxVertex *v = FX_CONTEXT(ctx)->verts;
+
+/* Verts, no clipping.
+ */
+#define ELT(x) x
+#define RESET_STIPPLE
+#define RESET_OCCLUSION
+#define PRESERVE_VB_DEFS
+#include "tnl/t_vb_rendertmp.h"
+
+
+/* Elts, no clipping.
+ */
+#undef ELT
+#undef TAG
+#undef LOCAL_VARS
+#define TAG(x) fx_##x##_elts
+#define ELT(x) elt[x]
+#define LOCAL_VARS \
+ fxVertex *v = FX_CONTEXT(ctx)->verts; \
+ const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts;
+#include "tnl/t_vb_rendertmp.h"
+
+
+
+
/* Setup the Point, Line, Triangle and Quad functions based on the
* current rendering state. Wherever possible, use the hardware to
* render the primitive. Otherwise, fallback to software rendering.
@@ -487,6 +538,8 @@ void fxDDChooseRenderState( GLcontext *ctx )
ctx->Driver.LineFunc = _swsetup_Line;
ctx->Driver.TriangleFunc = _swsetup_Triangle;
ctx->Driver.QuadFunc = _swsetup_Quad;
+ ctx->Driver.RenderTabVerts = _tnl_render_tab_verts;
+ ctx->Driver.RenderTabElts = _tnl_render_tab_elts;
fxMesa->render_index = FX_FALLBACK_BIT;
return;
@@ -549,9 +602,19 @@ void fxDDChooseRenderState( GLcontext *ctx )
ctx->Driver.TriangleFunc = rast_tab[index].triangle;
ctx->Driver.QuadFunc = rast_tab[index].quad;
fxMesa->render_index = index;
+
+ if (fxMesa->render_index == 0) {
+ ctx->Driver.RenderTabVerts = fx_render_tab_verts;
+ ctx->Driver.RenderTabElts = fx_render_tab_elts;
+ } else {
+ ctx->Driver.RenderTabVerts = _tnl_render_tab_verts;
+ ctx->Driver.RenderTabElts = _tnl_render_tab_elts;
+ }
}
+
+
#else
diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c
index 22128e61f6..3138d59649 100644
--- a/src/mesa/drivers/glide/fxvb.c
+++ b/src/mesa/drivers/glide/fxvb.c
@@ -238,10 +238,10 @@ static tfxSetupFunc setupfuncs[MAX_SETUP];
static void
-fxsetup_invalid( GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs )
+fxsetup_invalid( GLcontext *ctx, GLuint start, GLuint end )
{
fprintf(stderr, "fxMesa: invalid setup function\n");
- (void) (ctx && start && end && newinputs);
+ (void) (ctx && start && end);
}
@@ -334,43 +334,49 @@ void fx_BuildProjVerts( GLcontext *ctx, GLuint start, GLuint count,
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint ind = fxMesa->setup_gone;
- fxMesa->setup_gone = 0;
+ if (newinputs == ~0) {
+ /* build interpolated vertices */
+ setupfuncs[fxMesa->setupindex]( ctx, start, count );
+ } else {
+ GLuint ind = fxMesa->setup_gone;
+ fxMesa->setup_gone = 0;
- if (newinputs & VERT_CLIP)
- ind = fxMesa->setupindex; /* clipmask has changed - invalidated all */
- else {
- if (newinputs & VERT_TEX0)
- ind |= fxMesa->tex_dest[0];
+ if (newinputs & VERT_CLIP)
+ ind = fxMesa->setupindex; /* clipmask has potentially changed */
+ else {
+ if (newinputs & VERT_TEX0)
+ ind |= fxMesa->tex_dest[0];
- if (newinputs & VERT_TEX1)
- ind |= fxMesa->tex_dest[1];
-
- if (newinputs & VERT_RGBA)
- ind |= SETUP_RGBA;
-
- ind &= fxMesa->setupindex;
- }
+ if (newinputs & VERT_TEX1)
+ ind |= fxMesa->tex_dest[1];
- if (0) {
- _tnl_print_vert_flags("newinputs", newinputs);
- fxPrintSetupFlags("setup function", ind);
- }
+ if (newinputs & VERT_RGBA)
+ ind |= SETUP_RGBA;
- if (fxMesa->new_state)
- fxSetupFXUnits( ctx );
+ ind &= fxMesa->setupindex;
+ }
- if (VB->importable_data)
- VB->import_data( ctx, VB->importable_data & newinputs,
- (VB->ClipOrMask
- ? VEC_NOT_WRITEABLE|VEC_BAD_STRIDE
- : VEC_BAD_STRIDE));
+ if (0) {
+ _tnl_print_vert_flags("newinputs", newinputs);
+ fxPrintSetupFlags("setup function", ind);
+ }
- setupfuncs[ind]( ctx, start, count, newinputs );
+ if (ind) {
+ if (fxMesa->new_state)
+ fxSetupFXUnits( ctx );
+
+ if (VB->importable_data)
+ VB->import_data( ctx, VB->importable_data & newinputs,
+ (VB->ClipOrMask
+ ? VEC_NOT_WRITEABLE|VEC_BAD_STRIDE
+ : VEC_BAD_STRIDE));
+
+ setupfuncs[ind]( ctx, start, count );
+ }
+ }
}
-
void fxAllocVB( GLcontext *ctx )
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h
index af21fc40af..0133758295 100644
--- a/src/mesa/drivers/glide/fxvbtmp.h
+++ b/src/mesa/drivers/glide/fxvbtmp.h
@@ -27,7 +27,7 @@
*/
-static void NAME(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs)
+static void NAME(GLcontext *ctx, GLuint start, GLuint end )
{
fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
fxVertex *verts = fxMesa->verts;