diff options
Diffstat (limited to 'src/mesa/swrast/s_context.c')
-rw-r--r-- | src/mesa/swrast/s_context.c | 91 |
1 files changed, 64 insertions, 27 deletions
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index c018bfc0a56..d994e60029d 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.19 2001/03/29 16:50:32 brianp Exp $ */ +/* $Id: s_context.c,v 1.20 2001/03/29 17:08:27 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -367,7 +367,7 @@ _swrast_validate_derived( GLcontext *ctx ) } } - +#define SWRAST_DEBUG 0 /* Public entrypoints: See also s_accum.c, s_bitmap.c, etc. */ @@ -376,6 +376,13 @@ _swrast_Quad( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2, const SWvertex *v3 ) { + if (SWRAST_DEBUG) { + fprintf(stderr, "_swrast_Quad\n"); + _swrast_print_vertex( ctx, v0 ); + _swrast_print_vertex( ctx, v1 ); + _swrast_print_vertex( ctx, v2 ); + _swrast_print_vertex( ctx, v3 ); + } SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 ); SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v2, v3 ); } @@ -384,45 +391,60 @@ void _swrast_Triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ) { -/* fprintf(stderr, "%s\n", __FUNCTION__); */ -/* _swrast_print_vertex( ctx, v0 ); */ -/* _swrast_print_vertex( ctx, v1 ); */ -/* _swrast_print_vertex( ctx, v2 ); */ + if (SWRAST_DEBUG) { + fprintf(stderr, "_swrast_Triangle\n"); + _swrast_print_vertex( ctx, v0 ); + _swrast_print_vertex( ctx, v1 ); + _swrast_print_vertex( ctx, v2 ); + } SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 ); } void _swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) { -/* fprintf(stderr, "%s\n", __FUNCTION__); */ -/* _swrast_print_vertex( ctx, v0 ); */ -/* _swrast_print_vertex( ctx, v1 ); */ + if (SWRAST_DEBUG) { + fprintf(stderr, "_swrast_Line\n"); + _swrast_print_vertex( ctx, v0 ); + _swrast_print_vertex( ctx, v1 ); + } SWRAST_CONTEXT(ctx)->Line( ctx, v0, v1 ); } void _swrast_Point( GLcontext *ctx, const SWvertex *v0 ) { -/* fprintf(stderr, "%s\n", __FUNCTION__); */ -/* _swrast_print_vertex( ctx, v0 ); */ + if (SWRAST_DEBUG) { + fprintf(stderr, "_swrast_Point\n"); + _swrast_print_vertex( ctx, v0 ); + } SWRAST_CONTEXT(ctx)->Point( ctx, v0 ); } void _swrast_InvalidateState( GLcontext *ctx, GLuint new_state ) { + if (SWRAST_DEBUG) { + fprintf(stderr, "_swrast_InvalidateState\n"); + } SWRAST_CONTEXT(ctx)->InvalidateState( ctx, new_state ); } void _swrast_ResetLineStipple( GLcontext *ctx ) { + if (SWRAST_DEBUG) { + fprintf(stderr, "_swrast_ResetLineStipple\n"); + } SWRAST_CONTEXT(ctx)->StippleCounter = 0; } void _swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ) { + if (SWRAST_DEBUG) { + fprintf(stderr, "_swrast_allow_vertex_fog %d\n", value); + } SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT ); SWRAST_CONTEXT(ctx)->AllowVertexFog = value; } @@ -430,6 +452,9 @@ _swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ) void _swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value ) { + if (SWRAST_DEBUG) { + fprintf(stderr, "_swrast_allow_pixel_fog %d\n", value); + } SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT ); SWRAST_CONTEXT(ctx)->AllowPixelFog = value; } @@ -440,6 +465,11 @@ _swrast_CreateContext( GLcontext *ctx ) { GLuint i; SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext)); + + if (SWRAST_DEBUG) { + fprintf(stderr, "_swrast_CreateContext\n"); + } + if (!swrast) return GL_FALSE; @@ -485,6 +515,10 @@ _swrast_DestroyContext( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); + if (SWRAST_DEBUG) { + fprintf(stderr, "_swrast_DestroyContext\n"); + } + FREE( swrast->PB ); FREE( swrast ); @@ -499,26 +533,29 @@ _swrast_GetDeviceDriverReference( GLcontext *ctx ) return &swrast->Driver; } +#define SWRAST_DEBUG_VERTICES 0 void _swrast_print_vertex( GLcontext *ctx, const SWvertex *v ) { GLuint i; - fprintf(stderr, "win %f %f %f %f\n", - v->win[0], v->win[1], v->win[2], v->win[3]); - - for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) - fprintf(stderr, "texcoord[%d] %f %f %f %f\n", i, - v->texcoord[i][0], v->texcoord[i][1], - v->texcoord[i][2], v->texcoord[i][3]); - - fprintf(stderr, "color %d %d %d %d\n", - v->color[0], v->color[1], v->color[2], v->color[3]); - fprintf(stderr, "spec %d %d %d %d\n", - v->specular[0], v->specular[1], v->specular[2], v->specular[3]); - fprintf(stderr, "fog %f\n", v->fog); - fprintf(stderr, "index %d\n", v->index); - fprintf(stderr, "pointsize %f\n", v->pointSize); - fprintf(stderr, "\n"); + if (SWRAST_DEBUG_VERTICES) { + fprintf(stderr, "win %f %f %f %f\n", + v->win[0], v->win[1], v->win[2], v->win[3]); + + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + fprintf(stderr, "texcoord[%d] %f %f %f %f\n", i, + v->texcoord[i][0], v->texcoord[i][1], + v->texcoord[i][2], v->texcoord[i][3]); + + fprintf(stderr, "color %d %d %d %d\n", + v->color[0], v->color[1], v->color[2], v->color[3]); + fprintf(stderr, "spec %d %d %d %d\n", + v->specular[0], v->specular[1], v->specular[2], v->specular[3]); + fprintf(stderr, "fog %f\n", v->fog); + fprintf(stderr, "index %d\n", v->index); + fprintf(stderr, "pointsize %f\n", v->pointSize); + fprintf(stderr, "\n"); + } } |