diff options
author | Michal Krol <michal@vmware.com> | 2010-01-05 11:04:50 +0100 |
---|---|---|
committer | Michal Krol <michal@vmware.com> | 2010-01-05 11:04:50 +0100 |
commit | 9b21b3c52a8a7d58d08151d1a6bf25c472dec213 (patch) | |
tree | d9083b6af4e2e9b70a7fa6cd31bac45a36e0f6b6 /src/mesa/drivers/common/meta.c | |
parent | 543b9566bdaa48fea2df1866fa1310c1cdbcde27 (diff) | |
parent | 1f9aa38f4e2be47229d92be2c1189c2b8d9c7133 (diff) |
Merge branch 'master' into instanced-arrays
Conflicts:
src/gallium/auxiliary/tgsi/tgsi_dump.c
src/gallium/include/pipe/p_shader_tokens.h
Diffstat (limited to 'src/mesa/drivers/common/meta.c')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 60 |
1 files changed, 46 insertions, 14 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index cd9075b393..c4dbfa6d7d 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -107,11 +107,11 @@ struct save_state GLboolean AlphaEnabled; /** META_BLEND */ - GLboolean BlendEnabled; + GLbitfield BlendEnabled; GLboolean ColorLogicOpEnabled; /** META_COLOR_MASK */ - GLubyte ColorMask[4]; + GLubyte ColorMask[MAX_DRAW_BUFFERS][4]; /** META_DEPTH_TEST */ struct gl_depthbuffer_attrib Depth; @@ -335,19 +335,29 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state) if (state & META_BLEND) { save->BlendEnabled = ctx->Color.BlendEnabled; - if (ctx->Color.BlendEnabled) - _mesa_set_enable(ctx, GL_BLEND, GL_FALSE); + if (ctx->Color.BlendEnabled) { + if (ctx->Extensions.EXT_draw_buffers2) { + GLuint i; + for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) { + _mesa_set_enablei(ctx, GL_BLEND, i, GL_FALSE); + } + } + else { + _mesa_set_enable(ctx, GL_BLEND, GL_FALSE); + } + } save->ColorLogicOpEnabled = ctx->Color.ColorLogicOpEnabled; if (ctx->Color.ColorLogicOpEnabled) _mesa_set_enable(ctx, GL_COLOR_LOGIC_OP, GL_FALSE); } if (state & META_COLOR_MASK) { - COPY_4V(save->ColorMask, ctx->Color.ColorMask); - if (!ctx->Color.ColorMask[0] || - !ctx->Color.ColorMask[1] || - !ctx->Color.ColorMask[2] || - !ctx->Color.ColorMask[3]) + memcpy(save->ColorMask, ctx->Color.ColorMask, + sizeof(ctx->Color.ColorMask)); + if (!ctx->Color.ColorMask[0][0] || + !ctx->Color.ColorMask[0][1] || + !ctx->Color.ColorMask[0][2] || + !ctx->Color.ColorMask[0][3]) _mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } @@ -566,16 +576,38 @@ _mesa_meta_end(GLcontext *ctx) } if (state & META_BLEND) { - if (ctx->Color.BlendEnabled != save->BlendEnabled) - _mesa_set_enable(ctx, GL_BLEND, save->BlendEnabled); + if (ctx->Color.BlendEnabled != save->BlendEnabled) { + if (ctx->Extensions.EXT_draw_buffers2) { + GLuint i; + for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) { + _mesa_set_enablei(ctx, GL_BLEND, i, (save->BlendEnabled >> i) & 1); + } + } + else { + _mesa_set_enable(ctx, GL_BLEND, (save->BlendEnabled & 1)); + } + } if (ctx->Color.ColorLogicOpEnabled != save->ColorLogicOpEnabled) _mesa_set_enable(ctx, GL_COLOR_LOGIC_OP, save->ColorLogicOpEnabled); } if (state & META_COLOR_MASK) { - if (!TEST_EQ_4V(ctx->Color.ColorMask, save->ColorMask)) - _mesa_ColorMask(save->ColorMask[0], save->ColorMask[1], - save->ColorMask[2], save->ColorMask[3]); + GLuint i; + for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) { + if (!TEST_EQ_4V(ctx->Color.ColorMask[i], save->ColorMask[i])) { + if (i == 0) { + _mesa_ColorMask(save->ColorMask[i][0], save->ColorMask[i][1], + save->ColorMask[i][2], save->ColorMask[i][3]); + } + else { + _mesa_ColorMaskIndexed(i, + save->ColorMask[i][0], + save->ColorMask[i][1], + save->ColorMask[i][2], + save->ColorMask[i][3]); + } + } + } } if (state & META_DEPTH_TEST) { |