aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast/s_masking.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/swrast/s_masking.c')
-rw-r--r--mesalib/src/mesa/swrast/s_masking.c51
1 files changed, 10 insertions, 41 deletions
diff --git a/mesalib/src/mesa/swrast/s_masking.c b/mesalib/src/mesa/swrast/s_masking.c
index df779b073..e38d90f19 100644
--- a/mesalib/src/mesa/swrast/s_masking.c
+++ b/mesalib/src/mesa/swrast/s_masking.c
@@ -41,7 +41,7 @@
*/
void
_swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
- SWspan *span)
+ SWspan *span, GLuint buf)
{
const GLuint n = span->end;
void *rbPixels;
@@ -58,7 +58,7 @@ _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
*/
if (span->array->ChanType == GL_UNSIGNED_BYTE) {
/* treat 4xGLubyte as 1xGLuint */
- const GLuint srcMask = *((GLuint *) ctx->Color.ColorMask);
+ const GLuint srcMask = *((GLuint *) ctx->Color.ColorMask[buf]);
const GLuint dstMask = ~srcMask;
const GLuint *dst = (const GLuint *) rbPixels;
GLuint *src = (GLuint *) span->array->rgba8;
@@ -70,10 +70,10 @@ _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
/* 2-byte components */
/* XXX try to use 64-bit arithmetic someday */
- const GLushort rMask = ctx->Color.ColorMask[RCOMP] ? 0xffff : 0x0;
- const GLushort gMask = ctx->Color.ColorMask[GCOMP] ? 0xffff : 0x0;
- const GLushort bMask = ctx->Color.ColorMask[BCOMP] ? 0xffff : 0x0;
- const GLushort aMask = ctx->Color.ColorMask[ACOMP] ? 0xffff : 0x0;
+ const GLushort rMask = ctx->Color.ColorMask[buf][RCOMP] ? 0xffff : 0x0;
+ const GLushort gMask = ctx->Color.ColorMask[buf][GCOMP] ? 0xffff : 0x0;
+ const GLushort bMask = ctx->Color.ColorMask[buf][BCOMP] ? 0xffff : 0x0;
+ const GLushort aMask = ctx->Color.ColorMask[buf][ACOMP] ? 0xffff : 0x0;
const GLushort (*dst)[4] = (const GLushort (*)[4]) rbPixels;
GLushort (*src)[4] = span->array->rgba16;
GLuint i;
@@ -86,10 +86,10 @@ _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
}
else {
/* 4-byte components */
- const GLuint rMask = ctx->Color.ColorMask[RCOMP] ? ~0x0 : 0x0;
- const GLuint gMask = ctx->Color.ColorMask[GCOMP] ? ~0x0 : 0x0;
- const GLuint bMask = ctx->Color.ColorMask[BCOMP] ? ~0x0 : 0x0;
- const GLuint aMask = ctx->Color.ColorMask[ACOMP] ? ~0x0 : 0x0;
+ const GLuint rMask = ctx->Color.ColorMask[buf][RCOMP] ? ~0x0 : 0x0;
+ const GLuint gMask = ctx->Color.ColorMask[buf][GCOMP] ? ~0x0 : 0x0;
+ const GLuint bMask = ctx->Color.ColorMask[buf][BCOMP] ? ~0x0 : 0x0;
+ const GLuint aMask = ctx->Color.ColorMask[buf][ACOMP] ? ~0x0 : 0x0;
const GLuint (*dst)[4] = (const GLuint (*)[4]) rbPixels;
GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[FRAG_ATTRIB_COL0];
GLuint i;
@@ -101,34 +101,3 @@ _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
}
}
}
-
-
-/**
- * Apply the index mask to a span of color index values.
- */
-void
-_swrast_mask_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb,
- SWspan *span)
-{
- const GLuint srcMask = ctx->Color.IndexMask;
- const GLuint dstMask = ~srcMask;
- GLuint *index = span->array->index;
- GLuint dest[MAX_WIDTH];
- GLuint i;
-
- ASSERT(span->arrayMask & SPAN_INDEX);
- ASSERT(span->end <= MAX_WIDTH);
- ASSERT(rb->DataType == GL_UNSIGNED_INT);
-
- if (span->arrayMask & SPAN_XY) {
- _swrast_get_values(ctx, rb, span->end, span->array->x, span->array->y,
- dest, sizeof(GLuint));
- }
- else {
- _swrast_read_index_span(ctx, rb, span->end, span->x, span->y, dest);
- }
-
- for (i = 0; i < span->end; i++) {
- index[i] = (index[i] & srcMask) | (dest[i] & dstMask);
- }
-}