glsl: parse component layout qualifier
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -502,6 +502,12 @@ struct ast_type_qualifier {
|
|||||||
*/
|
*/
|
||||||
unsigned explicit_index:1;
|
unsigned explicit_index:1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag set if GL_ARB_enhanced_layouts "component" layout
|
||||||
|
* qualifier is used.
|
||||||
|
*/
|
||||||
|
unsigned explicit_component:1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag set if GL_ARB_shading_language_420pack "binding" layout
|
* Flag set if GL_ARB_shading_language_420pack "binding" layout
|
||||||
* qualifier is used.
|
* qualifier is used.
|
||||||
@@ -621,6 +627,14 @@ struct ast_type_qualifier {
|
|||||||
*/
|
*/
|
||||||
ast_expression *index;
|
ast_expression *index;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component specified via GL_ARB_enhaced_layouts
|
||||||
|
*
|
||||||
|
* \note
|
||||||
|
* This field is only valid if \c explicit_component is set.
|
||||||
|
*/
|
||||||
|
ast_expression *component;
|
||||||
|
|
||||||
/** Maximum output vertices in GLSL 1.50 geometry shaders. */
|
/** Maximum output vertices in GLSL 1.50 geometry shaders. */
|
||||||
ast_layout_expression *max_vertices;
|
ast_layout_expression *max_vertices;
|
||||||
|
|
||||||
|
@@ -337,6 +337,9 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
|
|||||||
if (q.flags.q.explicit_index)
|
if (q.flags.q.explicit_index)
|
||||||
this->index = q.index;
|
this->index = q.index;
|
||||||
|
|
||||||
|
if (q.flags.q.explicit_component)
|
||||||
|
this->component = q.component;
|
||||||
|
|
||||||
if (q.flags.q.explicit_binding)
|
if (q.flags.q.explicit_binding)
|
||||||
this->binding = q.binding;
|
this->binding = q.binding;
|
||||||
|
|
||||||
|
@@ -1497,6 +1497,17 @@ layout_qualifier_id:
|
|||||||
$$.location = $3;
|
$$.location = $3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (match_layout_qualifier("component", $1, state) == 0) {
|
||||||
|
if (!state->has_enhanced_layouts()) {
|
||||||
|
_mesa_glsl_error(& @1, state,
|
||||||
|
"component qualifier requires "
|
||||||
|
"GLSL 4.40 or ARB_enhanced_layouts");
|
||||||
|
} else {
|
||||||
|
$$.flags.q.explicit_component = 1;
|
||||||
|
$$.component = $3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (match_layout_qualifier("index", $1, state) == 0) {
|
if (match_layout_qualifier("index", $1, state) == 0) {
|
||||||
if (state->es_shader && !state->EXT_blend_func_extended_enable) {
|
if (state->es_shader && !state->EXT_blend_func_extended_enable) {
|
||||||
_mesa_glsl_error(& @3, state, "index layout qualifier requires EXT_blend_func_extended");
|
_mesa_glsl_error(& @3, state, "index layout qualifier requires EXT_blend_func_extended");
|
||||||
|
Reference in New Issue
Block a user