diff options
-rw-r--r-- | src/mesa/drivers/common/t_dd_vb.c | 75 | ||||
-rw-r--r-- | src/mesa/drivers/common/t_dd_vbtmp.h | 37 | ||||
-rw-r--r-- | src/mesa/swrast/s_context.c | 20 | ||||
-rw-r--r-- | src/mesa/swrast/swrast.h | 7 | ||||
-rw-r--r-- | src/mesa/swrast_setup/ss_context.c | 12 | ||||
-rw-r--r-- | src/mesa/swrast_setup/ss_context.h | 7 |
6 files changed, 112 insertions, 46 deletions
diff --git a/src/mesa/drivers/common/t_dd_vb.c b/src/mesa/drivers/common/t_dd_vb.c index f4cfe7c5241..3ba8fb3d8be 100644 --- a/src/mesa/drivers/common/t_dd_vb.c +++ b/src/mesa/drivers/common/t_dd_vb.c @@ -1,4 +1,3 @@ -/* $Id: t_dd_vb.c,v 1.16 2001/12/13 10:51:41 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -195,22 +194,78 @@ void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v ) LOCALVARS GLuint format = GET_VERTEX_FORMAT(); - if (format == TINY_VERTEX_FORMAT) { - fprintf(stderr, "x %f y %f z %f\n", v->v.x, v->v.y, v->v.z); - fprintf(stderr, "r %d g %d b %d a %d\n", + fprintf(stderr, "(%x) ", format); + + switch (format) { +#if HAVE_TINY_VERTICES + case TINY_VERTEX_FORMAT: + fprintf(stderr, "xyz %.4f,%.4f,%.4f rgba %x:%x:%x:%x\n", + v->v.x, v->v.y, v->v.z, v->tv.color.red, v->tv.color.green, v->tv.color.blue, v->tv.color.alpha); - } - else { - fprintf(stderr, "x %f y %f z %f oow %f\n", - v->v.x, v->v.y, v->v.z, v->v.w); - fprintf(stderr, "r %d g %d b %d a %d\n", + break; +#endif +#if HAVE_NOTEX_VERTICES + case NOTEX_VERTEX_FORMAT: + fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x spec %x:%x:%x:%x\n", + v->v.x, v->v.y, v->v.z, v->v.w, + v->v.color.red, + v->v.color.green, + v->v.color.blue, + v->v.color.alpha, + v->v.specular.red, + v->v.specular.green, + v->v.specular.blue, + v->v.specular.alpha); + break; +#endif +#if HAVE_TEX0_VERTICES + case TEX0_VERTEX_FORMAT: + fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x st %.4f,%.4f\n", + v->v.x, v->v.y, v->v.z, v->v.w, + v->v.color.red, + v->v.color.green, + v->v.color.blue, + v->v.color.alpha, + v->v.u0, + v->v.v0); + break; +#endif +#if HAVE_TEX1_VERTICES + case TEX1_VERTEX_FORMAT: + fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x st %.4f,%.4f st %.4f,%.4f\n", + v->v.x, v->v.y, v->v.z, v->v.w, + v->v.color.red, + v->v.color.green, + v->v.color.blue, + v->v.color.alpha, + v->v.u0, + v->v.v0, + v->v.u1, + v->v.u2); + break; +#endif +#if HAVE_PTEX_VERTICES + case PROJ_TEX1_VERTEX_FORMAT: + fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x stq %.4f,%.4f,%.4f stq %.4f,%.4f,%.4f\n", + v->v.x, v->v.y, v->v.z, v->v.w, v->v.color.red, v->v.color.green, v->v.color.blue, - v->v.color.alpha); + v->v.color.alpha, + v->pv.u0, + v->pv.v0, + v->pv.q0, + v->pv.u1, + v->pv.v1, + v->pv.q1); + break; +#endif + default: + fprintf(stderr, "???\n"); + break; } fprintf(stderr, "\n"); diff --git a/src/mesa/drivers/common/t_dd_vbtmp.h b/src/mesa/drivers/common/t_dd_vbtmp.h index c8b82ec2c47..39c496509b5 100644 --- a/src/mesa/drivers/common/t_dd_vbtmp.h +++ b/src/mesa/drivers/common/t_dd_vbtmp.h @@ -1,4 +1,4 @@ -/* $Id: t_dd_vbtmp.h,v 1.19 2002/08/21 02:59:00 brianp Exp $ */ +/* $Id: t_dd_vbtmp.h,v 1.20 2002/09/17 15:46:37 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -61,7 +61,10 @@ * unsigned char ub4[4][16]; * } * - + + * VERTEX: hw vertex type as above + * VERTEX_COLOR: hw color struct type in VERTEX + * * DO_XYZW: Emit xyz and maybe w coordinates. * DO_RGBA: Emit color. * DO_SPEC: Emit specular color. @@ -459,11 +462,11 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, *(GLuint *)&v[3] = LE32_TO_CPU(*(GLuint *)col); } else { - GLubyte *b = (GLubyte *)&v[3]; - b[0] = col[0][2]; - b[1] = col[0][1]; - b[2] = col[0][0]; - b[3] = col[0][3]; + VERTEX_COLOR *c = (VERTEX_COLOR *)&v[3]; + c->blue = col[0][2]; + c->green = col[0][1]; + c->red = col[0][0]; + c->alpha = col[0][3]; } STRIDE_4UB( col, col_stride ); } @@ -483,11 +486,11 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, *(GLuint *)&v[3] = LE32_TO_CPU(*(GLuint *)&col[i]); } else { - GLubyte *b = (GLubyte *)&v[3]; - b[0] = col[i][2]; - b[1] = col[i][1]; - b[2] = col[i][0]; - b[3] = col[i][3]; + VERTEX_COLOR *c = (VERTEX_COLOR *)&v[3]; + c->blue = col[i][2]; + c->green = col[i][1]; + c->red = col[i][0]; + c->alpha = col[i][3]; } } /* fprintf(stderr, "vert %d: %.2f %.2f %.2f %x\n", */ @@ -528,11 +531,11 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, *(GLuint *)v = LE32_TO_CPU(*(GLuint *)col[0]); } else { - GLubyte *b = (GLubyte *)v; - b[0] = col[0][2]; - b[1] = col[0][1]; - b[2] = col[0][0]; - b[3] = col[0][3]; + VERTEX_COLOR *c = (VERTEX_COLOR *)v; + c->blue = col[0][2]; + c->green = col[0][1]; + c->red = col[0][0]; + c->alpha = col[0][3]; } STRIDE_4UB( col, col_stride ); } diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index c80c92798b5..e85741953e7 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -1,4 +1,4 @@ -/* $Id: s_context.c,v 1.37 2002/08/07 00:45:07 brianp Exp $ */ +/* $Id: s_context.c,v 1.38 2002/09/17 15:46:34 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -559,6 +559,24 @@ _swrast_GetDeviceDriverReference( GLcontext *ctx ) return &swrast->Driver; } + +void +_swrast_render_start( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + if (swrast->Driver.SpanRenderStart) + swrast->Driver.SpanRenderStart( ctx ); +} + +void +_swrast_render_finish( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + if (swrast->Driver.SpanRenderFinish) + swrast->Driver.SpanRenderFinish( ctx ); +} + + #define SWRAST_DEBUG_VERTICES 0 void diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index 493534c4bab..4db055b6fe1 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -1,4 +1,4 @@ -/* $Id: swrast.h,v 1.26 2002/08/07 00:45:07 brianp Exp $ */ +/* $Id: swrast.h,v 1.27 2002/09/17 15:46:36 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -302,6 +302,11 @@ _swrast_Quad( GLcontext *ctx, extern void _swrast_flush( GLcontext *ctx ); +extern void +_swrast_render_start( GLcontext *ctx ); + +extern void +_swrast_render_finish( GLcontext *ctx ); /* Tell the software rasterizer about core state changes. */ diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c index 6adcef9b75c..58d85faa1f8 100644 --- a/src/mesa/swrast_setup/ss_context.c +++ b/src/mesa/swrast_setup/ss_context.c @@ -1,4 +1,3 @@ -/* $Id: ss_context.c,v 1.16 2002/08/08 00:41:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -49,7 +48,6 @@ #define _SWSETUP_NEW_RENDERINDEX (_NEW_POLYGON|_NEW_LIGHT) - GLboolean _swsetup_CreateContext( GLcontext *ctx ) { @@ -117,19 +115,13 @@ _swsetup_RenderStart( GLcontext *ctx ) swsetup->NewState = 0; - if (swsetup->Driver.Start) - swsetup->Driver.Start( ctx ); + _swrast_render_start( ctx ); } static void _swsetup_RenderFinish( GLcontext *ctx ) { - SScontext *swsetup = SWSETUP_CONTEXT(ctx); - - _swrast_flush( ctx ); - - if (swsetup->Driver.Finish) - swsetup->Driver.Finish( ctx ); + _swrast_render_finish( ctx ); } void diff --git a/src/mesa/swrast_setup/ss_context.h b/src/mesa/swrast_setup/ss_context.h index ed4da78d629..3174c95de12 100644 --- a/src/mesa/swrast_setup/ss_context.h +++ b/src/mesa/swrast_setup/ss_context.h @@ -1,4 +1,3 @@ -/* $Id: ss_context.h,v 1.9 2001/07/17 19:39:32 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -44,12 +43,6 @@ typedef struct { */ struct gl_client_array ChanColor; struct gl_client_array ChanSecondaryColor; - - - struct { - void (*Start)( GLcontext * ); - void (*Finish)( GLcontext * ); - } Driver; } SScontext; #define SWSETUP_CONTEXT(ctx) ((SScontext *)ctx->swsetup_context) |