From 884af408644e3fa9aa0ffc544f84ec4a7f3a93b9 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 18 Apr 2007 12:09:40 -0600 Subject: check _PreferPixelFog in _swrast_span_default_fog(), see bug 10669 --- src/mesa/swrast/s_span.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index b0c04ad021..c6efea3075 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; -- cgit v1.2.3