From 2a182a98973edc9ecf2936b1288485bb2b3fa722 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Jan 2002 18:32:03 +0000 Subject: LOTS of changes, building upon Klaus's work. struct sw_span is used throughout span/fragment processing. This is leading to less code and more chances for optimization. --- src/mesa/swrast/s_fog.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'src/mesa/swrast/s_fog.c') diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c index 5a8ac878cd..4d9af9bb52 100644 --- a/src/mesa/swrast/s_fog.c +++ b/src/mesa/swrast/s_fog.c @@ -1,4 +1,4 @@ -/* $Id: s_fog.c,v 1.17 2002/01/21 18:12:34 brianp Exp $ */ +/* $Id: s_fog.c,v 1.18 2002/01/27 18:32:03 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -85,9 +85,10 @@ _mesa_fog_rgba_pixels( const GLcontext *ctx, struct sw_span *span, GLfloat fog = span->fog, Dfog = span->fogStep; GLchan rFog, gFog, bFog; + /* printf("%s\n", __FUNCTION__);*/ ASSERT(ctx->Fog.Enabled); - ASSERT(span->activeMask & SPAN_FOG); - ASSERT(span->filledColor == GL_TRUE); + ASSERT(span->interpMask & SPAN_FOG); + ASSERT(span->filledColor == GL_TRUE || (span->arrayMask & SPAN_RGBA)); UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]); UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]); @@ -118,9 +119,10 @@ _mesa_fog_rgba_pixels_with_array( const GLcontext *ctx, struct sw_span *span, GLuint i; GLchan rFog, gFog, bFog; + /* printf("%s\n", __FUNCTION__);*/ ASSERT(fog != NULL); ASSERT(ctx->Fog.Enabled); - ASSERT(span->filledColor == GL_TRUE); + ASSERT(span->filledColor == GL_TRUE || (span->arrayMask & SPAN_RGBA)); UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]); UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]); @@ -151,6 +153,7 @@ _old_fog_rgba_pixels( const GLcontext *ctx, GLuint i; GLchan rFog, gFog, bFog; + /* printf("%s\n", __FUNCTION__);*/ UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]); UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]); UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]); @@ -181,8 +184,8 @@ _mesa_fog_ci_pixels( const GLcontext *ctx, struct sw_span *span, GLfloat fog = span->fog, Dfog = span->fogStep; ASSERT(ctx->Fog.Enabled); - ASSERT(span->activeMask & SPAN_FOG); - ASSERT(span->filledColor == GL_TRUE); + ASSERT(span->interpMask & SPAN_FOG); + ASSERT(span->interpMask & SPAN_INDEX); for (i = 0; i < span->end; i++) { const GLfloat f = CLAMP(fog, 0.0F, 1.0F); @@ -209,7 +212,7 @@ _mesa_fog_ci_pixels_with_array( const GLcontext *ctx, struct sw_span *span, ASSERT(fog != NULL); ASSERT(ctx->Fog.Enabled); - ASSERT(span->filledColor == GL_TRUE); + ASSERT((span->filledColor == GL_TRUE) || (span->arrayMask & SPAN_INDEX)); for (i = span->start; i < span->end; i++) { const GLfloat f = CLAMP(fog[i], 0.0F, 1.0F); @@ -383,7 +386,7 @@ compute_fog_factors_from_z( const GLcontext *ctx, /** * Apply fog to a span of RGBA pixels. * Input: ctx - - * span - where span->depth has to be filled. + * span - where span->zArray has to be filled. * red, green, blue, alpha - pixel colors * Output: red, green, blue, alpha - fogged pixel colors */ @@ -393,13 +396,13 @@ _mesa_depth_fog_rgba_pixels(const GLcontext *ctx, struct sw_span *span, { GLfloat fogFact[PB_SIZE]; + /* printf("%s\n", __FUNCTION__);*/ ASSERT(ctx->Fog.Enabled); - ASSERT(span->activeMask & SPAN_Z); + ASSERT(span->arrayMask & SPAN_Z); ASSERT(span->end <= PB_SIZE); - ASSERT(span->filledDepth == GL_TRUE); - ASSERT(span->filledColor == GL_TRUE); + ASSERT((span->filledDepth) == GL_TRUE || (span->arrayMask & SPAN_Z)); - compute_fog_factors_from_z(ctx, span->end, span->depth, fogFact ); + compute_fog_factors_from_z(ctx, span->end, span->zArray, fogFact ); _mesa_fog_rgba_pixels_with_array( ctx, span, fogFact, rgba ); } @@ -417,6 +420,7 @@ _old_depth_fog_rgba_pixels( const GLcontext *ctx, { GLfloat fogFact[PB_SIZE]; ASSERT(n <= PB_SIZE); + /* printf("%s\n", __FUNCTION__);*/ compute_fog_factors_from_z( ctx, n, z, fogFact ); _old_fog_rgba_pixels( ctx, n, fogFact, rgba ); } @@ -425,7 +429,7 @@ _old_depth_fog_rgba_pixels( const GLcontext *ctx, /** * Apply fog to a span of color index pixels. * Input: ctx - - * span - where span->depth has to be filled. + * span - where span->zArray has to be filled. * index - pixel color indexes * Output: index - fogged pixel color indexes */ @@ -436,12 +440,11 @@ _mesa_depth_fog_ci_pixels( const GLcontext *ctx, struct sw_span *span, GLfloat fogFact[PB_SIZE]; ASSERT(ctx->Fog.Enabled); - ASSERT(span->activeMask & SPAN_Z); + ASSERT(span->arrayMask & SPAN_Z); ASSERT(span->end <= PB_SIZE); - ASSERT(span->filledDepth == GL_TRUE); - ASSERT(span->filledColor == GL_TRUE); + ASSERT((span->filledDepth == GL_TRUE) || (span->arrayMask & SPAN_Z)); - compute_fog_factors_from_z(ctx, span->end, span->depth, fogFact ); + compute_fog_factors_from_z(ctx, span->end, span->zArray, fogFact ); _mesa_fog_ci_pixels_with_array( ctx, span, fogFact, index ); } -- cgit v1.2.3