X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fswrast%2Fs_masking.c;h=2e68f8c4bd7d0f72c1e754fc8e26a33c0e7d6d62;hb=4c502e05e803dc45bb01510683fb86cf7f30e431;hp=4a82bbe8e6b42758541d729bf482dd4609e1c277;hpb=a50b7dbc3ba1db8c92b4bbb4f7f06de8d6c039c4;p=mesa.git diff --git a/src/mesa/swrast/s_masking.c b/src/mesa/swrast/s_masking.c index 4a82bbe8e6b..2e68f8c4bd7 100644 --- a/src/mesa/swrast/s_masking.c +++ b/src/mesa/swrast/s_masking.c @@ -28,8 +28,8 @@ */ -#include "glheader.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/macros.h" #include "s_context.h" #include "s_masking.h" @@ -40,8 +40,8 @@ * Apply the color mask to a span of rgba values. */ void -_swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, - struct sw_span *span) +_swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, + SWspan *span, GLuint buf) { const GLuint n = span->end; void *rbPixels; @@ -58,10 +58,10 @@ _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->color.sz1.rgba; + GLuint *src = (GLuint *) span->array->rgba8; GLuint i; for (i = 0; i < n; i++) { src[i] = (src[i] & srcMask) | (dst[i] & dstMask); @@ -70,12 +70,12 @@ _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->color.sz2.rgba; + GLushort (*src)[4] = span->array->rgba16; GLuint i; for (i = 0; i < n; i++) { src[i][RCOMP] = (src[i][RCOMP] & rMask) | (dst[i][RCOMP] & ~rMask); @@ -86,12 +86,12 @@ _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->color.sz4.rgba; + GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[FRAG_ATTRIB_COL0]; GLuint i; for (i = 0; i < n; i++) { src[i][RCOMP] = (src[i][RCOMP] & rMask) | (dst[i][RCOMP] & ~rMask); @@ -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, - 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; - - 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); - } -}