}
}
+ 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);
this->in_qualifier = new(this) ast_type_qualifier();
this->out_qualifier = new(this) ast_type_qualifier();
this->fs_early_fragment_tests = false;
+ this->fs_blend_support = 0;
memset(this->atomic_counter_offsets, 0,
sizeof(this->atomic_counter_offsets));
this->allow_extension_directive_midshader =
shader->info.ARB_fragment_coord_conventions_enable =
state->ARB_fragment_coord_conventions_enable;
shader->info.EarlyFragmentTests = state->fs_early_fragment_tests;
+ shader->info.BlendSupport = state->fs_blend_support;
break;
default:
ACCESS_VOLATILE = 4,
};
+/**
+ * \brief Blend support qualifiers
+ */
+enum gl_advanced_blend_mode
+{
+ BLEND_NONE = 0x0000,
+
+ BLEND_MULTIPLY = 0x0001,
+ BLEND_SCREEN = 0x0002,
+ BLEND_OVERLAY = 0x0004,
+ BLEND_DARKEN = 0x0008,
+ BLEND_LIGHTEN = 0x0010,
+ BLEND_COLORDODGE = 0x0020,
+ BLEND_COLORBURN = 0x0040,
+ BLEND_HARDLIGHT = 0x0080,
+ BLEND_SOFTLIGHT = 0x0100,
+ BLEND_DIFFERENCE = 0x0200,
+ BLEND_EXCLUSION = 0x0400,
+ BLEND_HSL_HUE = 0x0800,
+ BLEND_HSL_SATURATION = 0x1000,
+ BLEND_HSL_COLOR = 0x2000,
+ BLEND_HSL_LUMINOSITY = 0x4000,
+
+ BLEND_ALL = 0x7fff,
+};
+
#ifdef __cplusplus
} /* extern "C" */
#endif