mesa: Branch 'master' - 2 commits

Brian Paul brianp at kemper.freedesktop.org
Sat Apr 21 21:59:22 UTC 2007


 src/mesa/main/rastpos.c     |    2 +-
 src/mesa/swrast/s_bitmap.c  |    3 +--
 src/mesa/swrast/s_copypix.c |    9 +++------
 src/mesa/swrast/s_drawpix.c |    9 +++------
 src/mesa/swrast/s_span.c    |    7 ++++++-
 5 files changed, 14 insertions(+), 16 deletions(-)

New commits:
diff-tree f793e90e823a58c0408771c38f3a6209f78a3617 (from 112e1f2b5ab86626eb9b3de9075e9f165a397e7b)
Author: Brian <brian at yutani.localnet.net>
Date:   Sat Apr 21 15:58:37 2007 -0600

    Fix color sum bug 10688.

diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c
index 59c42e5..4c23705 100644
--- a/src/mesa/swrast/s_bitmap.c
+++ b/src/mesa/swrast/s_bitmap.c
@@ -85,8 +85,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px
    INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_XY);
 
    _swrast_span_default_color(ctx, &span);
-   if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
-      _swrast_span_default_secondary_color(ctx, &span);
+   _swrast_span_default_secondary_color(ctx, &span);
    if (ctx->Depth.Test)
       _swrast_span_default_z(ctx, &span);
    if (swrast->_FogEnabled)
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index dbbfc58..012839c 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -109,8 +109,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GL
       _swrast_span_default_z(ctx, &span);
    if (swrast->_FogEnabled)
       _swrast_span_default_fog(ctx, &span);
-   if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
-      _swrast_span_default_secondary_color(ctx, &span);
+   _swrast_span_default_secondary_color(ctx, &span);
 
    /* allocate space for GLfloat image */
    tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
@@ -245,8 +244,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint s
       _swrast_span_default_z(ctx, &span);
    if (swrast->_FogEnabled)
       _swrast_span_default_fog(ctx, &span);
-   if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
-      _swrast_span_default_secondary_color(ctx, &span);
+   _swrast_span_default_secondary_color(ctx, &span);
 
    if (overlapping) {
       tmpImage = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat) * 4);
@@ -492,8 +490,7 @@ copy_depth_pixels( GLcontext *ctx, GLint
    }
 
    _swrast_span_default_color(ctx, &span);
-   if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
-      _swrast_span_default_secondary_color(ctx, &span);
+   _swrast_span_default_secondary_color(ctx, &span);
    if (swrast->_FogEnabled)
       _swrast_span_default_fog(ctx, &span);
 
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index 70b57b9..cd5b7bc 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -71,8 +71,7 @@ fast_draw_rgba_pixels(GLcontext *ctx, GL
    }
 
    INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
-   if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
-      _swrast_span_default_secondary_color(ctx, &span);
+   _swrast_span_default_secondary_color(ctx, &span);
    if (ctx->Depth.Test)
       _swrast_span_default_z(ctx, &span);
    if (swrast->_FogEnabled)
@@ -443,8 +442,7 @@ draw_depth_pixels( GLcontext *ctx, GLint
    INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z);
 
    _swrast_span_default_color(ctx, &span);
-   if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
-      _swrast_span_default_secondary_color(ctx, &span);
+   _swrast_span_default_secondary_color(ctx, &span);
    if (swrast->_FogEnabled)
       _swrast_span_default_fog(ctx, &span);
    if (ctx->Texture._EnabledCoordUnits)
@@ -565,8 +563,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint 
       return;
 
    INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
-   if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
-      _swrast_span_default_secondary_color(ctx, &span);
+   _swrast_span_default_secondary_color(ctx, &span);
    if (ctx->Depth.Test)
       _swrast_span_default_z(ctx, &span);
    if (swrast->_FogEnabled)
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index f3b7998..0b17791 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -130,10 +130,15 @@ _swrast_span_default_color( GLcontext *c
 }
 
 
+/**
+ * Set the span's secondary color info to the current raster position's
+ * secondary color, when needed (lighting enabled or colorsum enabled).
+ */
 void
 _swrast_span_default_secondary_color(GLcontext *ctx, SWspan *span)
 {
-   if (ctx->Visual.rgbMode) {
+   if (ctx->Visual.rgbMode && (ctx->Light.Enabled || ctx->Fog.ColorSumEnabled))
+   {
       GLchan r, g, b, a;
       UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterSecondaryColor[0]);
       UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.RasterSecondaryColor[1]);
diff-tree 112e1f2b5ab86626eb9b3de9075e9f165a397e7b (from e5cf37c1786057252a4db28d4ae75bd24a0e020b)
Author: Brian <brian at yutani.localnet.net>
Date:   Sat Apr 21 15:56:10 2007 -0600

    specularColor.alpha should default to 1, not 0

diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index 4a0c24f..2d71014 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -138,7 +138,7 @@ shade_rastpos(GLcontext *ctx,
    COPY_3V(diffuseColor, base[0]);
    diffuseColor[3] = CLAMP( 
       ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3], 0.0F, 1.0F );
-   ASSIGN_4V(specularColor, 0.0, 0.0, 0.0, 0.0);
+   ASSIGN_4V(specularColor, 0.0, 0.0, 0.0, 1.0);
 
    foreach (light, &ctx->Light.EnabledList) {
       GLfloat attenuation = 1.0;



More information about the mesa-commit mailing list