mesa: add support for ARB_blend_func_extended (v4)
Add implementations of the two API functions, Add a new strings to uint mapping for index bindings Add the blending mode validation for SRC1 + SRC_ALPHA_SATURATE Add get for MAX_DUAL_SOURCE_DRAW_BUFFERS v2: Add check in valid_to_render to address case in spec ERRORS. v3: Add index to ir.h so this patch compiles on its own fixup comment v4: fixup Brian's comments The GLSL patch will setup the indices. Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -1695,7 +1695,39 @@ _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
|
||||
* implicitly calls Begin if any draw buffer has a blend function requiring the
|
||||
* second color input (SRC1_COLOR, ONE_MINUS_SRC1_COLOR, SRC1_ALPHA or
|
||||
* ONE_MINUS_SRC1_ALPHA), and a framebuffer is bound that has more than
|
||||
* the value of MAX_DUAL_SOURCE_DRAW_BUFFERS-1 active color attachements."
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prior to drawing anything with glBegin, glDrawArrays, etc. this function
|
||||
@@ -1816,6 +1848,10 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (_mesa_check_blend_func_error(ctx) == GL_FALSE) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (ctx->Shader.Flags & GLSL_LOG) {
|
||||
struct gl_shader_program *shProg[MESA_SHADER_TYPES];
|
||||
|
Reference in New Issue
Block a user