diff options
author | Ian Romanick <[email protected]> | 2012-07-24 19:52:53 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2012-08-29 15:09:34 -0700 |
commit | 01497a356048ce23e089ad8ab8ab0102aae97b3c (patch) | |
tree | d7149b4e27c2e81e95031e15047a597fd4127285 /src/mesa/main/blend.c | |
parent | e58c19a204a028b0c3db7416250387ba98ed0a2d (diff) |
mesa/es: Validate blend function enums in Mesa code rather than the ES wrapper
v2: Add proper core-profile filtering.
v3: Allow GL_SRC_ALPHA_SATURATE as a destination factor in GLES3. Based
on review feedback from Eric Anholt.
Signed-off-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main/blend.c')
-rw-r--r-- | src/mesa/main/blend.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 5bc40a028bd..de871a92a39 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -58,16 +58,18 @@ legal_src_factor(const struct gl_context *ctx, GLenum factor) case GL_DST_ALPHA: case GL_ONE_MINUS_DST_ALPHA: case GL_SRC_ALPHA_SATURATE: + return GL_TRUE; case GL_CONSTANT_COLOR: case GL_ONE_MINUS_CONSTANT_COLOR: case GL_CONSTANT_ALPHA: case GL_ONE_MINUS_CONSTANT_ALPHA: - return GL_TRUE; + return _mesa_is_desktop_gl(ctx) || ctx->API == API_OPENGLES2; case GL_SRC1_COLOR: case GL_SRC1_ALPHA: case GL_ONE_MINUS_SRC1_COLOR: case GL_ONE_MINUS_SRC1_ALPHA: - return ctx->Extensions.ARB_blend_func_extended; + return _mesa_is_desktop_gl(ctx) + && ctx->Extensions.ARB_blend_func_extended; default: return GL_FALSE; } @@ -93,17 +95,22 @@ legal_dst_factor(const struct gl_context *ctx, GLenum factor) case GL_ONE_MINUS_SRC_ALPHA: case GL_DST_ALPHA: case GL_ONE_MINUS_DST_ALPHA: + return GL_TRUE; case GL_CONSTANT_COLOR: case GL_ONE_MINUS_CONSTANT_COLOR: case GL_CONSTANT_ALPHA: case GL_ONE_MINUS_CONSTANT_ALPHA: - return GL_TRUE; + return _mesa_is_desktop_gl(ctx) || ctx->API == API_OPENGLES2; case GL_SRC_ALPHA_SATURATE: + return (_mesa_is_desktop_gl(ctx) + && ctx->Extensions.ARB_blend_func_extended) + || _mesa_is_gles3(ctx); case GL_SRC1_COLOR: case GL_SRC1_ALPHA: case GL_ONE_MINUS_SRC1_COLOR: case GL_ONE_MINUS_SRC1_ALPHA: - return ctx->Extensions.ARB_blend_func_extended; + return _mesa_is_desktop_gl(ctx) + && ctx->Extensions.ARB_blend_func_extended; default: return GL_FALSE; } |