From f515c78a2320369ead087c4e0efd583f17b4b78b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 24 Sep 2006 19:59:30 +0000 Subject: [PATCH] Change logicop, blend, masking functions to use the colors/indexes in the sw_span object, rather than an explicit parameter. --- src/mesa/swrast/s_accum.c | 2 +- src/mesa/swrast/s_blend.c | 9 +++++---- src/mesa/swrast/s_blend.h | 6 +++--- src/mesa/swrast/s_buffers.c | 4 ++-- src/mesa/swrast/s_logic.c | 15 ++++++++------- src/mesa/swrast/s_logic.h | 8 ++++---- src/mesa/swrast/s_masking.c | 17 ++++++++--------- src/mesa/swrast/s_masking.h | 4 ++-- src/mesa/swrast/s_span.c | 10 +++++----- 9 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c index 9b48f8b..46da9b8 100644 --- a/src/mesa/swrast/s_accum.c +++ b/src/mesa/swrast/s_accum.c @@ -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); } diff --git a/src/mesa/swrast/s_blend.c b/src/mesa/swrast/s_blend.c index d94ff39..91ec513 100644 --- a/src/mesa/swrast/s_blend.c +++ b/src/mesa/swrast/s_blend.c @@ -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 ); } diff --git a/src/mesa/swrast/s_blend.h b/src/mesa/swrast/s_blend.h index c951932..8baa8cd 100644 --- a/src/mesa/swrast/s_blend.h +++ b/src/mesa/swrast/s_blend.h @@ -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 diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_buffers.c index 85ce093..67a9665 100644 --- a/src/mesa/swrast/s_buffers.c +++ b/src/mesa/swrast/s_buffers.c @@ -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); } diff --git a/src/mesa/swrast/s_logic.c b/src/mesa/swrast/s_logic.c index 60458c2..b791117 100644 --- a/src/mesa/swrast/s_logic.c +++ b/src/mesa/swrast/s_logic.c @@ -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; diff --git a/src/mesa/swrast/s_logic.h b/src/mesa/swrast/s_logic.h index ce5f183..55fbf66 100644 --- a/src/mesa/swrast/s_logic.h +++ b/src/mesa/swrast/s_logic.h @@ -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,12 +33,12 @@ 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 diff --git a/src/mesa/swrast/s_masking.c b/src/mesa/swrast/s_masking.c index 0f2bde1..f83e305 100644 --- a/src/mesa/swrast/s_masking.c +++ b/src/mesa/swrast/s_masking.c @@ -38,17 +38,16 @@ /** * 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; diff --git a/src/mesa/swrast/s_masking.h b/src/mesa/swrast/s_masking.h index daffc20..2dba6ce 100644 --- a/src/mesa/swrast/s_masking.h +++ b/src/mesa/swrast/s_masking.h @@ -33,11 +33,11 @@ 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 diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index f67f083..009945e 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -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) { -- 2.7.4