diff options
Diffstat (limited to 'src/mesa/drivers/common/meta.c')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index a48f7000269..a7dd139500f 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -515,10 +515,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) _mesa_set_enable(ctx, GL_DITHER, GL_TRUE); } - if (state & MESA_META_COLOR_MASK) { - memcpy(save->ColorMask, ctx->Color.ColorMask, - sizeof(ctx->Color.ColorMask)); - } + if (state & MESA_META_COLOR_MASK) + save->ColorMask = ctx->Color.ColorMask; if (state & MESA_META_DEPTH_TEST) { save->Depth = ctx->Depth; /* struct copy */ @@ -880,17 +878,20 @@ _mesa_meta_end(struct gl_context *ctx) if (state & MESA_META_COLOR_MASK) { GLuint i; for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) { - if (!TEST_EQ_4V(ctx->Color.ColorMask[i], save->ColorMask[i])) { + if (GET_COLORMASK(ctx->Color.ColorMask, i) != + GET_COLORMASK(save->ColorMask, i)) { if (i == 0) { - _mesa_ColorMask(save->ColorMask[i][0], save->ColorMask[i][1], - save->ColorMask[i][2], save->ColorMask[i][3]); + _mesa_ColorMask(GET_COLORMASK_BIT(save->ColorMask, i, 0), + GET_COLORMASK_BIT(save->ColorMask, i, 1), + GET_COLORMASK_BIT(save->ColorMask, i, 2), + GET_COLORMASK_BIT(save->ColorMask, i, 3)); } else { _mesa_ColorMaski(i, - save->ColorMask[i][0], - save->ColorMask[i][1], - save->ColorMask[i][2], - save->ColorMask[i][3]); + GET_COLORMASK_BIT(save->ColorMask, i, 0), + GET_COLORMASK_BIT(save->ColorMask, i, 1), + GET_COLORMASK_BIT(save->ColorMask, i, 2), + GET_COLORMASK_BIT(save->ColorMask, i, 3)); } } } @@ -1631,18 +1632,6 @@ _mesa_meta_drawbuffers_from_bitfield(GLbitfield bits) } /** - * Return if all of the color channels are masked. - */ -static inline GLboolean -is_color_disabled(struct gl_context *ctx, int i) -{ - return !ctx->Color.ColorMask[i][0] && - !ctx->Color.ColorMask[i][1] && - !ctx->Color.ColorMask[i][2] && - !ctx->Color.ColorMask[i][3]; -} - -/** * Given a bitfield of BUFFER_BIT_x draw buffers, call glDrawBuffers to * set GL to only draw to those buffers. Also, update color masks to * reflect the new draw buffer ordering. @@ -1666,7 +1655,8 @@ _mesa_meta_drawbuffers_and_colormask(struct gl_context *ctx, GLbitfield mask) gl_buffer_index b = ctx->DrawBuffer->_ColorDrawBufferIndexes[i]; int colormask_idx = ctx->Extensions.EXT_draw_buffers2 ? i : 0; - if (b < 0 || !(mask & (1 << b)) || is_color_disabled(ctx, colormask_idx)) + if (b < 0 || !(mask & (1 << b)) || + GET_COLORMASK(ctx->Color.ColorMask, colormask_idx) == 0) continue; switch (b) { @@ -1689,7 +1679,8 @@ _mesa_meta_drawbuffers_and_colormask(struct gl_context *ctx, GLbitfield mask) } for (int k = 0; k < 4; k++) - colormask[num_bufs][k] = ctx->Color.ColorMask[colormask_idx][k]; + colormask[num_bufs][k] = GET_COLORMASK_BIT(ctx->Color.ColorMask, + colormask_idx, k); num_bufs++; } |