Change logicop, blend, masking functions to use the colors/indexes in the
authorBrian Paul <brian.paul@tungstengraphics.com>
Sun, 24 Sep 2006 19:59:30 +0000 (19:59 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sun, 24 Sep 2006 19:59:30 +0000 (19:59 +0000)
sw_span object, rather than an explicit parameter.

src/mesa/swrast/s_accum.c
src/mesa/swrast/s_blend.c
src/mesa/swrast/s_blend.h
src/mesa/swrast/s_buffers.c
src/mesa/swrast/s_logic.c
src/mesa/swrast/s_logic.h
src/mesa/swrast/s_masking.c
src/mesa/swrast/s_masking.h
src/mesa/swrast/s_span.c

index 9b48f8b..46da9b8 100644 (file)
@@ -524,7 +524,7 @@ accum_return(GLcontext *ctx, GLfloat value,
          for (buffer = 0; buffer < fb->_NumColorDrawBuffers[0]; buffer++) {
             struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[0][buffer];
             if (masking) {
-               _swrast_mask_rgba_span(ctx, rb, &span, span.array->rgba);
+               _swrast_mask_rgba_span(ctx, rb, &span);
             }
             rb->PutRow(ctx, rb, width, xpos, ypos + i, span.array->rgba, NULL);
          }
index d94ff39..91ec513 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.3
+ * Version:  6.5.2
  *
- * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2006  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"),
@@ -847,7 +847,7 @@ void _swrast_choose_blend_func( GLcontext *ctx )
  */
 void
 _swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb,
-                   const struct sw_span *span, GLchan rgba[][4])
+                   struct sw_span *span)
 {
    GLchan framebuffer[MAX_WIDTH][4];
 
@@ -867,6 +867,7 @@ _swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb,
                              framebuffer);
    }
 
-   SWRAST_CONTEXT(ctx)->BlendFunc( ctx, span->end, span->array->mask, rgba,
+   SWRAST_CONTEXT(ctx)->BlendFunc( ctx, span->end, span->array->mask,
+                                   span->array->rgba,
                                   (const GLchan (*)[4]) framebuffer );
 }
index c951932..8baa8cd 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.3
+ * Version:  6.5.2
  *
- * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2006  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"),
@@ -33,7 +33,7 @@
 
 extern void
 _swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb,
-                   const struct sw_span *span, GLchan rgba[][4]);
+                   struct sw_span *span);
 
 
 extern void
index 85ce093..67a9665 100644 (file)
@@ -72,7 +72,7 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
    for (i = 0; i < height; i++) {
       span.x = x;
       span.y = y + i;
-      _swrast_mask_rgba_span(ctx, rb, &span, span.array->rgba);
+      _swrast_mask_rgba_span(ctx, rb, &span);
       /* write masked row */
       rb->PutRow(ctx, rb, width, x, y + i, span.array->rgba, NULL);
    }
@@ -109,7 +109,7 @@ clear_ci_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
    for (i = 0; i < height;i++) {
       span.x = x;
       span.y = y + i;
-      _swrast_mask_ci_span(ctx, rb, &span, span.array->index);
+      _swrast_mask_ci_span(ctx, rb, &span);
       /* write masked row */
       rb->PutRow(ctx, rb, width, x, y + i, span.array->index, NULL);
    }
index 60458c2..b791117 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.3
+ * Version:  6.5.2
  *
- * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2006  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"),
@@ -183,9 +183,10 @@ logicop_uint(GLcontext *ctx, GLuint n, GLuint src[], const GLuint dest[],
  */
 void
 _swrast_logicop_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb,
-                        const struct sw_span *span, GLuint index[])
+                        struct sw_span *span)
 {
    GLuint dest[MAX_WIDTH];
+   GLuint *index = span->array->index;
 
    ASSERT(span->end < MAX_WIDTH);
    ASSERT(rb->DataType == GL_UNSIGNED_INT);
@@ -210,7 +211,7 @@ _swrast_logicop_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb,
  */
 void
 _swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
-                          const struct sw_span *span, GLchan rgba[][4])
+                          struct sw_span *span)
 {
    GLchan dest[MAX_WIDTH][4];
 
@@ -229,13 +230,13 @@ _swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
    /* XXX make this a runtime test */
 #if CHAN_TYPE == GL_UNSIGNED_BYTE
    /* treat 4*GLubyte as GLuint */
-   logicop_uint(ctx, span->end, (GLuint *) rgba,
+   logicop_uint(ctx, span->end, (GLuint *) span->array->rgba,
                 (const GLuint *) dest, span->array->mask);
 #elif CHAN_TYPE == GL_UNSIGNED_SHORT
-   logicop_ushort(ctx, 4 * span->end, (GLushort *) rgba,
+   logicop_ushort(ctx, 4 * span->end, (GLushort *) span->array->rgba,
                   (const GLushort *) dest, span->array->mask);
 #elif CHAN_TYPE == GL_FLOAT
-   logicop_uint(ctx, 4 * span->end, (GLuint *) rgba,
+   logicop_uint(ctx, 4 * span->end, (GLuint *) span->array->rgba,
                 (const GLuint *) dest, span->array->mask);
 #endif
    (void) logicop_ubyte;
index ce5f183..55fbf66 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.3
+ * Version:  6.5.2
  *
- * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2006  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"),
 
 extern void
 _swrast_logicop_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb,
-                        const struct sw_span *span, GLuint index[]);
+                        struct sw_span *span);
 
 
 extern void
 _swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
-                          const struct sw_span *span, GLchan rgba[][4]);
+                          struct sw_span *span);
 
 
 #endif
index 0f2bde1..f83e305 100644 (file)
 
 /**
  * Apply the color mask to a span of rgba values.
- * \param rgba  the array of incoming colors
  */
 void
 _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
-                       const struct sw_span *span, GLchan rgba[][4])
+                       struct sw_span *span)
 {
    GLchan dest[MAX_WIDTH][4];
 #if CHAN_BITS == 8
    GLuint srcMask = *((GLuint*)ctx->Color.ColorMask);
    GLuint dstMask = ~srcMask;
-   GLuint *rgba32 = (GLuint *) rgba;
+   GLuint *rgba32 = (GLuint *) span->array->rgba;
    GLuint *dest32 = (GLuint *) dest;
 #else
    const GLboolean rMask = ctx->Color.ColorMask[RCOMP];
@@ -76,10 +75,10 @@ _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
    }
 #else
    for (i = 0; i < n; i++) {
-      if (!rMask)  rgba[i][RCOMP] = dest[i][RCOMP];
-      if (!gMask)  rgba[i][GCOMP] = dest[i][GCOMP];
-      if (!bMask)  rgba[i][BCOMP] = dest[i][BCOMP];
-      if (!aMask)  rgba[i][ACOMP] = dest[i][ACOMP];
+      if (!rMask)  span->array->rgba[i][RCOMP] = dest[i][RCOMP];
+      if (!gMask)  span->array->rgba[i][GCOMP] = dest[i][GCOMP];
+      if (!bMask)  span->array->rgba[i][BCOMP] = dest[i][BCOMP];
+      if (!aMask)  span->array->rgba[i][ACOMP] = dest[i][ACOMP];
    }
 #endif
 }
@@ -87,14 +86,14 @@ _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
 
 /**
  * Apply the index mask to a span of color index values.
- * \param index  the array of incoming color indexes
  */
 void
 _swrast_mask_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb,
-                     const struct sw_span *span, GLuint index[])
+                     struct sw_span *span)
 {
    const GLuint srcMask = ctx->Color.IndexMask;
    const GLuint dstMask = ~srcMask;
+   GLuint *index = span->array->index;
    GLuint dest[MAX_WIDTH];
    GLuint i;
 
index daffc20..2dba6ce 100644 (file)
 
 extern void
 _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
-                       const struct sw_span *span, GLchan rgba[][4]);
+                       struct sw_span *span);
 
 
 extern void
 _swrast_mask_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb,
-                     const struct sw_span *span, GLuint index[]);
+                     struct sw_span *span);
 
 #endif
index f67f083..009945e 100644 (file)
@@ -949,11 +949,11 @@ _swrast_write_index_span( GLcontext *ctx, struct sw_span *span)
          ASSERT(rb->_BaseFormat == GL_COLOR_INDEX);
 
          if (ctx->Color.IndexLogicOpEnabled) {
-            _swrast_logicop_ci_span(ctx, rb, span, span->array->index);
+            _swrast_logicop_ci_span(ctx, rb, span);
          }
 
          if (ctx->Color.IndexMask != 0xffffffff) {
-            _swrast_mask_ci_span(ctx, rb, span, span->array->index);
+            _swrast_mask_ci_span(ctx, rb, span);
          }
 
          if ((span->interpMask & SPAN_INDEX) && span->indexStep == 0) {
@@ -1327,14 +1327,14 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span)
          ASSERT(rb->_BaseFormat == GL_RGBA);
 
          if (ctx->Color._LogicOpEnabled) {
-            _swrast_logicop_rgba_span(ctx, rb, span, span->array->rgba);
+            _swrast_logicop_rgba_span(ctx, rb, span);
          }
          else if (ctx->Color.BlendEnabled) {
-            _swrast_blend_span(ctx, rb, span, span->array->rgba);
+            _swrast_blend_span(ctx, rb, span);
          }
 
          if (colorMask != 0xffffffff) {
-            _swrast_mask_rgba_span(ctx, rb, span, span->array->rgba);
+            _swrast_mask_rgba_span(ctx, rb, span);
          }
 
          if (span->arrayMask & SPAN_XY) {