mesa: Branch 'master' - 2 commits

Brian Paul brianp at kemper.freedesktop.org
Mon Mar 26 17:30:12 UTC 2007


 src/mesa/shader/slang/slang_emit.c |    2 --
 src/mesa/swrast/s_bitmap.c         |    2 ++
 src/mesa/swrast/s_copypix.c        |    7 ++++++-
 src/mesa/swrast/s_drawpix.c        |    7 ++++++-
 src/mesa/swrast/s_span.c           |   29 +++++++++++++++++++++++++++++
 src/mesa/swrast/s_span.h           |    3 +++
 6 files changed, 46 insertions(+), 4 deletions(-)

New commits:
diff-tree 38a1c2b4959d35236933c14d3944cce94283ca30 (from b5d988dd19291e4e1e6f18e4163c2acac66729de)
Author: Brian <brian at yutani.localnet.net>
Date:   Mon Mar 26 11:30:05 2007 -0600

    Add _swrast_span_default_secondary_color() for use with glBitmap, glDrawPixels, etc.
    
    Secondary color wasn't getting added to post-texture color when drawing
    bitmaps, images.  See bug 10409.

diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c
index 25a1ef8..59c42e5 100644
--- a/src/mesa/swrast/s_bitmap.c
+++ b/src/mesa/swrast/s_bitmap.c
@@ -85,6 +85,8 @@ _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);
    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 2051e1f..7ba7424 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -109,7 +109,8 @@ 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);
 
    /* allocate space for GLfloat image */
    tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
@@ -244,6 +245,8 @@ 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);
 
    if (overlapping) {
       tmpImage = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat) * 4);
@@ -489,6 +492,8 @@ 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);
    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 50147f3..70b57b9 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -71,6 +71,8 @@ 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);
    if (ctx->Depth.Test)
       _swrast_span_default_z(ctx, &span);
    if (swrast->_FogEnabled)
@@ -441,7 +443,8 @@ 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);
    if (swrast->_FogEnabled)
       _swrast_span_default_fog(ctx, &span);
    if (ctx->Texture._EnabledCoordUnits)
@@ -562,6 +565,8 @@ 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);
    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 fa77612..dab3d54 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -121,6 +121,35 @@ _swrast_span_default_color( GLcontext *c
 }
 
 
+void
+_swrast_span_default_secondary_color(GLcontext *ctx, SWspan *span)
+{
+   if (ctx->Visual.rgbMode) {
+      GLchan r, g, b, a;
+      UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterSecondaryColor[0]);
+      UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.RasterSecondaryColor[1]);
+      UNCLAMPED_FLOAT_TO_CHAN(b, ctx->Current.RasterSecondaryColor[2]);
+      UNCLAMPED_FLOAT_TO_CHAN(a, ctx->Current.RasterSecondaryColor[3]);
+#if CHAN_TYPE == GL_FLOAT
+      span->specRed = r;
+      span->specGreen = g;
+      span->specBlue = b;
+      /8span->specAlpha = a;*/
+#else
+      span->specRed   = IntToFixed(r);
+      span->specGreen = IntToFixed(g);
+      span->specBlue  = IntToFixed(b);
+      /*span->specAlpha = IntToFixed(a);*/
+#endif
+      span->specRedStep = 0;
+      span->specGreenStep = 0;
+      span->specBlueStep = 0;
+      /*span->specAlphaStep = 0;*/
+      span->interpMask |= SPAN_SPEC;
+   }
+}
+
+
 /**
  * Init span's texcoord interpolation values to the RasterPos texcoords.
  * Used during setup for glDraw/CopyPixels.
diff --git a/src/mesa/swrast/s_span.h b/src/mesa/swrast/s_span.h
index 8a9b9eb..f650a27 100644
--- a/src/mesa/swrast/s_span.h
+++ b/src/mesa/swrast/s_span.h
@@ -223,6 +223,9 @@ extern void
 _swrast_span_default_color( GLcontext *ctx, SWspan *span );
 
 extern void
+_swrast_span_default_secondary_color(GLcontext *ctx, SWspan *span);
+
+extern void
 _swrast_span_default_texcoords( GLcontext *ctx, SWspan *span );
 
 extern GLfloat
diff-tree b5d988dd19291e4e1e6f18e4163c2acac66729de (from b67d93111da01c30317f4642e041e5c8c111d3d3)
Author: Brian <brian at yutani.localnet.net>
Date:   Mon Mar 26 10:39:56 2007 -0600

    remove incorrect assertions

diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index ace68d1..4bbc7c9 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -519,9 +519,7 @@ emit_compare(slang_emit_info *emitInfo, 
       opcode = n->Opcode == IR_EQUAL ? OPCODE_SEQ : OPCODE_SNE;
       inst = new_instruction(emitInfo, opcode);
       storage_to_src_reg(&inst->SrcReg[0], n->Children[0]->Store);
-      ASSERT(inst->SrcReg[0].Swizzle != SWIZZLE_XYZW);
       storage_to_src_reg(&inst->SrcReg[1], n->Children[1]->Store);
-      ASSERT(inst->SrcReg[1].Swizzle != SWIZZLE_XYZW);
       storage_to_dst_reg(&inst->DstReg, n->Store, n->Writemask);
    }
    else if (size <= 4) {



More information about the mesa-commit mailing list