summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/glsl_parser.yy
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2016-04-01 22:51:39 -0400
committerKenneth Graunke <kenneth@whitecape.org>2016-08-25 19:22:09 -0700
commit4b6819b407220f5d7d97a40ed9474d7673448370 (patch)
treec538c2b84f567ad4ec1f6393d1f588d910266d05 /src/compiler/glsl/glsl_parser.yy
parente682f945944d7411a87acb4361b11d3ff09aac9f (diff)
downloadexternal_mesa3d-4b6819b407220f5d7d97a40ed9474d7673448370.zip
external_mesa3d-4b6819b407220f5d7d97a40ed9474d7673448370.tar.gz
external_mesa3d-4b6819b407220f5d7d97a40ed9474d7673448370.tar.bz2
glsl: process blend_support_* qualifiers
v2 (Ken): Add a BLEND_NONE enum value (no qualifiers in use). v3 (Ken): Rename gl_blend_support_qualifier to gl_advanced_blend_mode. v4 (Ken): Mark map[] as static const (Ilia). Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Diffstat (limited to 'src/compiler/glsl/glsl_parser.yy')
-rw-r--r--src/compiler/glsl/glsl_parser.yy45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index f2853da..4043dae 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -1447,6 +1447,51 @@ layout_qualifier_id:
}
if (!$$.flags.i) {
+ static const struct {
+ const char *s;
+ uint32_t mask;
+ } map[] = {
+ { "blend_support_multiply", BLEND_MULTIPLY },
+ { "blend_support_screen", BLEND_SCREEN },
+ { "blend_support_overlay", BLEND_OVERLAY },
+ { "blend_support_darken", BLEND_DARKEN },
+ { "blend_support_lighten", BLEND_LIGHTEN },
+ { "blend_support_colordodge", BLEND_COLORDODGE },
+ { "blend_support_colorburn", BLEND_COLORBURN },
+ { "blend_support_hardlight", BLEND_HARDLIGHT },
+ { "blend_support_softlight", BLEND_SOFTLIGHT },
+ { "blend_support_difference", BLEND_DIFFERENCE },
+ { "blend_support_exclusion", BLEND_EXCLUSION },
+ { "blend_support_hsl_hue", BLEND_HSL_HUE },
+ { "blend_support_hsl_saturation", BLEND_HSL_SATURATION },
+ { "blend_support_hsl_color", BLEND_HSL_COLOR },
+ { "blend_support_hsl_luminosity", BLEND_HSL_LUMINOSITY },
+ { "blend_support_all_equations", BLEND_ALL },
+ };
+ for (unsigned i = 0; i < ARRAY_SIZE(map); i++) {
+ if (match_layout_qualifier($1, map[i].s, state) == 0) {
+ $$.flags.q.blend_support = 1;
+ state->fs_blend_support |= map[i].mask;
+ break;
+ }
+ }
+
+ if ($$.flags.i &&
+ !state->KHR_blend_equation_advanced_enable &&
+ !state->is_version(0, 320)) {
+ _mesa_glsl_error(& @1, state,
+ "advanced blending layout qualifiers require "
+ "ESSL 3.20 or KHR_blend_equation_advanced");
+ }
+
+ if ($$.flags.i && state->stage != MESA_SHADER_FRAGMENT) {
+ _mesa_glsl_error(& @1, state,
+ "advanced blending layout qualifiers only "
+ "valid in fragment shaders");
+ }
+ }
+
+ if (!$$.flags.i) {
_mesa_glsl_error(& @1, state, "unrecognized layout identifier "
"`%s'", $1);
YYERROR;