From 88f3b89a2cb77766d2009b9868c44e03abe2dbb2 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 28 Dec 2000 22:11:04 +0000 Subject: Add render stage for unclipped vb's to fx driver. Bump MAX_TEXTURE_UNITS to 8 Fix mem. leak in destroy_lists Fix crash in q3 (cva generally) --- src/mesa/drivers/glide/fxdd.c | 28 ++++++++++++++++---------- src/mesa/drivers/glide/fxdrv.h | 5 ++++- src/mesa/drivers/glide/fxvbtmp.h | 43 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 62 insertions(+), 14 deletions(-) (limited to 'src/mesa/drivers/glide') diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index 3bbe42328a..0f1ace3ee0 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -61,6 +61,8 @@ #include "tnl/tnl.h" #include "array_cache/acache.h" +#include "tnl/t_pipeline.h" + /* These lookup table are used to extract RGB values in [0,255] from * 16-bit pixel values. */ @@ -645,25 +647,21 @@ static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name) } } -#if 0 -static const struct gl_pipeline_stage * const fx_pipeline[] = { +static const struct gl_pipeline_stage *fx_pipeline[] = { &_tnl_update_material_stage, + /* TODO: Add the fastpath here */ &_tnl_vertex_transform_stage, &_tnl_normal_transform_stage, - &_tnl_lighting_stage, /* OMIT: fog coordinate stage */ + &_tnl_lighting_stage, + &_tnl_fog_coordinate_stage, /* TODO: Omit fog stage */ &_tnl_texgen_stage, &_tnl_texture_transform_stage, &_tnl_point_attenuation_stage, - &_fx_fast_render_stage, /* ADD: the fastpath as a render stage */ + &fx_render_stage, /* ADD: render simple unclipped vb's */ &_tnl_render_stage, /* KEEP: the old render stage for fallbacks */ - 0 + 0, }; -#else -/* Need to turn off tnl fogging, both the stage and the clipping in - * _tnl_render_stage. Could insert a dummy stage that did nothing but - * provided storage that clipping could spin on? - */ -#endif + @@ -771,6 +769,9 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa ) _tnl_CreateContext( fxMesa->glCtx ); _swsetup_CreateContext( fxMesa->glCtx ); + _tnl_destroy_pipeline( fxMesa->glCtx ); + _tnl_install_pipeline( fxMesa->glCtx, fx_pipeline ); + fxAllocVB( fxMesa->glCtx ); fxSetupDDPointers(fxMesa->glCtx); @@ -780,6 +781,11 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa ) _swrast_allow_vertex_fog( fxMesa->glCtx, GL_FALSE ); _swrast_allow_pixel_fog( fxMesa->glCtx, GL_TRUE ); + /* Tell tnl not to calculate or use vertex fog factors. (Needed to + * tell render stage not to clip fog coords). + */ +/* _tnl_calculate_vertex_fog( fxMesa->glCtx, GL_FALSE ); */ + fxDDInitExtensions(fxMesa->glCtx); #ifdef FXVTXFMT diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h index 4e4eea96a3..2f62133221 100644 --- a/src/mesa/drivers/glide/fxdrv.h +++ b/src/mesa/drivers/glide/fxdrv.h @@ -100,7 +100,6 @@ typedef union { typedef struct { GrVertex v; GLfloat clip[4]; - GLfloat win[4]; GLfloat texcoord[2][2]; GLubyte mask; GLfloat normal[3]; /* for replay & fallback */ @@ -630,4 +629,8 @@ extern void fxDDCheckVtxfmt( GLcontext *ctx ); extern void fx_update_lighting( GLcontext *ctx ); extern void fxDDInitVtxfmt( GLcontext *ctx ); +/* fxsimplerender + */ +extern const struct gl_pipeline_stage fx_render_stage; + #endif diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h index 5f3a293650..af21fc40af 100644 --- a/src/mesa/drivers/glide/fxvbtmp.h +++ b/src/mesa/drivers/glide/fxvbtmp.h @@ -56,8 +56,47 @@ static void NAME(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs) if (IND & SETUP_RGBA) color = VB->ColorPtr[0]->data; - for (i = start ; i < end ; i++, v++) { - if (!clipmask[i]) { + if (VB->ClipOrMask) { + for (i = start ; i < end ; i++, v++) { + if (!clipmask[i]) { + if (IND & SETUP_XYZW) { + v->v.x = s[0] * proj[i][0] + s[12]; + v->v.y = s[5] * proj[i][1] + s[13]; + v->v.ooz = s[10] * proj[i][2] + s[14]; + v->v.oow = proj[i][3]; + + if (IND & SETUP_SNAP) { +#if defined(USE_IEEE) + const float snapper = (3L<<18); + v->v.x += snapper; + v->v.x -= snapper; + v->v.y += snapper; + v->v.y -= snapper; +#else + v->v.x = ((int)(v->v.x*16.0f)) * (1.0f/16.0f); + v->v.y = ((int)(v->v.y*16.0f)) * (1.0f/16.0f); +#endif + } + } + if (IND & SETUP_RGBA) { + UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.r, color[i][0]); + UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.g, color[i][1]); + UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.b, color[i][2]); + UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.a, color[i][3]); + } + if (IND & SETUP_TMU0) { + v->v.tmuvtx[0].sow = sscale0*tmu0_data[i][0]*v->v.oow; + v->v.tmuvtx[0].tow = tscale0*tmu0_data[i][1]*v->v.oow; + } + if (IND & SETUP_TMU1) { + v->v.tmuvtx[1].sow = sscale1*tmu1_data[i][0]*v->v.oow; + v->v.tmuvtx[1].tow = tscale1*tmu1_data[i][1]*v->v.oow; + } + } + } + } + else { + for (i = start ; i < end ; i++, v++) { if (IND & SETUP_XYZW) { v->v.x = s[0] * proj[i][0] + s[12]; v->v.y = s[5] * proj[i][1] + s[13]; -- cgit v1.2.3