diff options
author | Brian <[email protected]> | 2007-05-20 12:27:39 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-05-20 12:27:39 -0600 |
commit | 9e8a961dd7d7b717a9fb4ecdea1c1b60ea355efe (patch) | |
tree | 60c87644ec38f4693ceecbf440b120b02e2d07e6 /src/mesa/swrast/s_points.c | |
parent | aa133a9dae53bc6aa50b88ee43deb8b34e8d0029 (diff) |
Overhaul/simplify SWvertex and SWspan attribute handling.
Instead of separate fog/specular/texcoord/varying code, just treat all of
them as generic attributes. Simplifies the point/line/triangle functions.
Diffstat (limited to 'src/mesa/swrast/s_points.c')
-rw-r--r-- | src/mesa/swrast/s_points.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c index 1401b772caf..02c9d9b4251 100644 --- a/src/mesa/swrast/s_points.c +++ b/src/mesa/swrast/s_points.c @@ -34,7 +34,6 @@ #include "s_span.h" - #define RGBA 0x1 #define INDEX 0x2 #define SMOOTH 0x4 @@ -154,16 +153,26 @@ #include "s_pointtemp.h" - -void _swrast_add_spec_terms_point( GLcontext *ctx, - const SWvertex *v0 ) +void +_swrast_add_spec_terms_point(GLcontext *ctx, const SWvertex *v0) { - SWvertex *ncv0 = (SWvertex *)v0; - GLchan c[1][4]; - COPY_CHAN4( c[0], ncv0->color ); - ACC_3V( ncv0->color, ncv0->specular ); - SWRAST_CONTEXT(ctx)->SpecPoint( ctx, ncv0 ); - COPY_CHAN4( ncv0->color, c[0] ); + SWvertex *ncv0 = (SWvertex *) v0; + GLfloat rSum, gSum, bSum; + GLchan cSave[4]; + + /* save */ + COPY_CHAN4( cSave, ncv0->color ); + /* sum */ + rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2]; + UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum); + UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum); + UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum); + /* draw */ + SWRAST_CONTEXT(ctx)->SpecPoint(ctx, ncv0); + /* restore */ + COPY_CHAN4(ncv0->color, cSave); } @@ -196,6 +205,9 @@ _swrast_choose_point( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLboolean rgbMode = ctx->Visual.rgbMode; + GLboolean specular = (ctx->Fog.ColorSumEnabled || + (ctx->Light.Enabled && + ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)); if (ctx->RenderMode==GL_RENDER) { if (ctx->Point.PointSprite) { @@ -242,8 +254,10 @@ _swrast_choose_point( GLcontext *ctx ) USE(atten_general_ci_point); } } - else if (ctx->Texture._EnabledCoordUnits && rgbMode) { - /* textured */ + else if ((ctx->Texture._EnabledCoordUnits + || specular + || swrast->_FogEnabled) && rgbMode) { + /* textured, fogged */ USE(textured_rgba_point); } else if (ctx->Point._Size != 1.0) { @@ -258,6 +272,7 @@ _swrast_choose_point( GLcontext *ctx ) else { /* single pixel points */ if (rgbMode) { + assert((swrast->_ActiveAttribMask & FRAG_BIT_COL1) == 0); USE(size1_rgba_point); } else { |