diff options
author | Eric Anholt <[email protected]> | 2012-05-17 15:31:40 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-05-23 10:45:43 -0700 |
commit | 175ad8050e3337f7065306017ea4eb8eae599f6d (patch) | |
tree | 9aa14587f323a5b4db3cb130866f50686165c241 /src/mesa/main/context.c | |
parent | 68216f35814ab8d292f37b8c0fa0a5f181b7f20d (diff) |
mesa: Keep a computed value for dual source blend func with each buffer.
The i965 driver needed this as well for hardware setup, so instead of
duplicating the logic, just save it off.
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main/context.c')
-rw-r--r-- | src/mesa/main/context.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index df0452cd114..3bcedecd9ba 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1703,13 +1703,6 @@ _mesa_set_mvp_with_dp4( struct gl_context *ctx, ctx->mvp_with_dp4 = flag; } -static GLboolean -blend_factor_is_dual_src(GLenum factor) -{ - return factor == GL_SRC1_COLOR || factor == GL_SRC1_ALPHA || - factor == GL_ONE_MINUS_SRC1_COLOR || factor == GL_ONE_MINUS_SRC1_ALPHA; -} - /* * ARB_blend_func_extended - ERRORS section * "The error INVALID_OPERATION is generated by Begin or any procedure that @@ -1722,16 +1715,13 @@ static GLboolean _mesa_check_blend_func_error(struct gl_context *ctx) { GLuint i; - for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { - if (blend_factor_is_dual_src(ctx->Color.Blend[i].SrcRGB) || - blend_factor_is_dual_src(ctx->Color.Blend[i].DstRGB) || - blend_factor_is_dual_src(ctx->Color.Blend[i].SrcA) || - blend_factor_is_dual_src(ctx->Color.Blend[i].DstA)) { - if (i >= ctx->Const.MaxDualSourceDrawBuffers) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "dual source blend on illegal attachment"); - return GL_FALSE; - } + for (i = ctx->Const.MaxDualSourceDrawBuffers; + i < ctx->DrawBuffer->_NumColorDrawBuffers; + i++) { + if (ctx->Color.Blend[i]._UsesDualSrc) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "dual source blend on illegal attachment"); + return GL_FALSE; } } return GL_TRUE; |