summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2012-07-24 19:52:53 -0700
committerIan Romanick <[email protected]>2012-08-29 15:09:34 -0700
commit01497a356048ce23e089ad8ab8ab0102aae97b3c (patch)
treed7149b4e27c2e81e95031e15047a597fd4127285
parente58c19a204a028b0c3db7416250387ba98ed0a2d (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]>
-rw-r--r--src/mesa/main/APIspec.xml111
-rw-r--r--src/mesa/main/blend.c15
2 files changed, 11 insertions, 115 deletions
diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index 44dcd210078..34e41b49e17 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -631,43 +631,6 @@
<param name="sfactor" type="GLenum"/>
<param name="dfactor" type="GLenum"/>
</proto>
-
- <desc name="sfactor">
- <value name="GL_ZERO"/>
- <value name="GL_ONE"/>
- <value name="GL_SRC_COLOR"/>
- <value name="GL_ONE_MINUS_SRC_COLOR"/>
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- <value name="GL_DST_ALPHA"/>
- <value name="GL_ONE_MINUS_DST_ALPHA"/>
- <value name="GL_DST_COLOR"/>
- <value name="GL_ONE_MINUS_DST_COLOR"/>
- <value name="GL_SRC_ALPHA_SATURATE"/>
-
- <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
- </desc>
-
- <desc name="dfactor">
- <value name="GL_ZERO"/>
- <value name="GL_ONE"/>
- <value name="GL_SRC_COLOR"/>
- <value name="GL_ONE_MINUS_SRC_COLOR"/>
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- <value name="GL_DST_ALPHA"/>
- <value name="GL_ONE_MINUS_DST_ALPHA"/>
- <value name="GL_DST_COLOR"/>
- <value name="GL_ONE_MINUS_DST_COLOR"/>
-
- <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
- </desc>
</template>
<template name="LogicOp">
@@ -1600,80 +1563,6 @@
<param name="srcAlpha" type="GLenum"/>
<param name="dstAlpha" type="GLenum"/>
</proto>
-
- <desc name="srcRGB">
- <value name="GL_ZERO"/>
- <value name="GL_ONE"/>
- <value name="GL_SRC_COLOR"/>
- <value name="GL_ONE_MINUS_SRC_COLOR"/>
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- <value name="GL_DST_ALPHA"/>
- <value name="GL_ONE_MINUS_DST_ALPHA"/>
- <value name="GL_DST_COLOR"/>
- <value name="GL_ONE_MINUS_DST_COLOR"/>
- <value name="GL_SRC_ALPHA_SATURATE"/>
-
- <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
- </desc>
-
- <desc name="dstRGB">
- <value name="GL_ZERO"/>
- <value name="GL_ONE"/>
- <value name="GL_SRC_COLOR"/>
- <value name="GL_ONE_MINUS_SRC_COLOR"/>
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- <value name="GL_DST_ALPHA"/>
- <value name="GL_ONE_MINUS_DST_ALPHA"/>
- <value name="GL_DST_COLOR"/>
- <value name="GL_ONE_MINUS_DST_COLOR"/>
-
- <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
- </desc>
-
- <desc name="srcAlpha">
- <value name="GL_ZERO"/>
- <value name="GL_ONE"/>
- <value name="GL_SRC_COLOR"/>
- <value name="GL_ONE_MINUS_SRC_COLOR"/>
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- <value name="GL_DST_ALPHA"/>
- <value name="GL_ONE_MINUS_DST_ALPHA"/>
- <value name="GL_DST_COLOR"/>
- <value name="GL_ONE_MINUS_DST_COLOR"/>
- <value name="GL_SRC_ALPHA_SATURATE"/>
-
- <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
- </desc>
-
- <desc name="dstAlpha">
- <value name="GL_ZERO"/>
- <value name="GL_ONE"/>
- <value name="GL_SRC_COLOR"/>
- <value name="GL_ONE_MINUS_SRC_COLOR"/>
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- <value name="GL_DST_ALPHA"/>
- <value name="GL_ONE_MINUS_DST_ALPHA"/>
- <value name="GL_DST_COLOR"/>
- <value name="GL_ONE_MINUS_DST_COLOR"/>
-
- <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
- </desc>
</template>
<template name="PointParameter">
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;
}