diff options
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r-- | src/mesa/swrast/s_span.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index b0c04ad0216..c6efea30753 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -69,14 +69,23 @@ _swrast_span_default_z( GLcontext *ctx, SWspan *span ) /** - * Init span's fog interpolation values to the RasterPos fog. + * Init span's fogcoord interpolation values to the RasterPos fog. * Used during setup for glDraw/CopyPixels. */ void _swrast_span_default_fog( GLcontext *ctx, SWspan *span ) { - span->attrStart[FRAG_ATTRIB_FOGC][0] - = _swrast_z_to_fogfactor(ctx, ctx->Current.RasterDistance); + const SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLfloat fogVal; /* a coord or a blend factor */ + if (swrast->_PreferPixelFog) { + /* fog blend factors will be computed from fog coordinates per pixel */ + fogVal = ctx->Current.RasterDistance; + } + else { + /* fog blend factor should be computed from fogcoord now */ + fogVal = _swrast_z_to_fogfactor(ctx, ctx->Current.RasterDistance); + } + span->attrStart[FRAG_ATTRIB_FOGC][0] = fogVal; span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0; span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0; span->interpMask |= SPAN_FOG; |