%type <type_qualifier> subroutine_qualifier
%type <subroutine_list> subroutine_type_list
%type <type_qualifier> interface_qualifier
-%type <type_qualifier> uniform_interface_qualifier
-%type <type_qualifier> buffer_interface_qualifier
%type <type_specifier> type_specifier
%type <type_specifier> type_specifier_nonarray
%type <array_specifier> array_specifier
}
}
- if ($$.flags.i && !state->has_geometry_shader()) {
+ if ($$.flags.i && !state->has_geometry_shader() &&
+ !state->has_tessellation_shader()) {
_mesa_glsl_error(& @1, state, "#version 150 layout "
"qualifier `%s' used", $1);
}
/* Layout qualifiers for tessellation evaluation shaders. */
if (!$$.flags.i) {
- struct {
+ static const struct {
const char *s;
GLenum e;
} map[] = {
}
}
- if ($$.flags.i &&
- !state->ARB_tessellation_shader_enable &&
- !state->is_version(400, 0)) {
+ if ($$.flags.i && !state->has_tessellation_shader()) {
_mesa_glsl_error(& @1, state,
"primitive mode qualifier `%s' requires "
"GLSL 4.00 or ARB_tessellation_shader", $1);
}
}
if (!$$.flags.i) {
- struct {
+ static const struct {
const char *s;
GLenum e;
} map[] = {
}
}
- if ($$.flags.i &&
- !state->ARB_tessellation_shader_enable &&
- !state->is_version(400, 0)) {
+ if ($$.flags.i && !state->has_tessellation_shader()) {
_mesa_glsl_error(& @1, state,
"vertex spacing qualifier `%s' requires "
"GLSL 4.00 or ARB_tessellation_shader", $1);
$$.ordering = GL_CCW;
}
- if ($$.flags.i &&
- !state->ARB_tessellation_shader_enable &&
- !state->is_version(400, 0)) {
+ if ($$.flags.i && !state->has_tessellation_shader()) {
_mesa_glsl_error(& @1, state,
"ordering qualifier `%s' requires "
"GLSL 4.00 or ARB_tessellation_shader", $1);
$$.point_mode = true;
}
- if ($$.flags.i &&
- !state->ARB_tessellation_shader_enable &&
- !state->is_version(400, 0)) {
+ if ($$.flags.i && !state->has_tessellation_shader()) {
_mesa_glsl_error(& @1, state,
"qualifier `point_mode' requires "
"GLSL 4.00 or ARB_tessellation_shader");
$$.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 (state->es_shader && !state->EXT_blend_func_extended_enable) {
_mesa_glsl_error(& @3, state, "index layout qualifier requires EXT_blend_func_extended");
}
}
+ if (state->has_enhanced_layouts()) {
+ if (match_layout_qualifier("xfb_buffer", $1, state) == 0) {
+ $$.flags.q.xfb_buffer = 1;
+ $$.flags.q.explicit_xfb_buffer = 1;
+ $$.xfb_buffer = $3;
+ }
+
+ if (match_layout_qualifier("xfb_offset", $1, state) == 0) {
+ $$.flags.q.explicit_xfb_offset = 1;
+ $$.offset = $3;
+ }
+
+ if (match_layout_qualifier("xfb_stride", $1, state) == 0) {
+ $$.flags.q.xfb_stride = 1;
+ $$.flags.q.explicit_xfb_stride = 1;
+ $$.xfb_stride = $3;
+ }
+ }
+
static const char * const local_size_qualifiers[3] = {
"local_size_x",
"local_size_y",
if (match_layout_qualifier("vertices", $1, state) == 0) {
$$.flags.q.vertices = 1;
$$.vertices = new(ctx) ast_layout_expression(@1, $3);
- if (!state->ARB_tessellation_shader_enable &&
- !state->is_version(400, 0)) {
+ if (!state->has_tessellation_shader()) {
_mesa_glsl_error(& @1, state,
"vertices qualifier requires GLSL 4.00 or "
"ARB_tessellation_shader");
* variables. As only outputs can be declared as invariant, an invariant
* output from one shader stage will still match an input of a subsequent
* stage without the input being declared as invariant."
+ *
+ * On the desktop side, this text first appears in GLSL 4.30.
*/
- if (state->es_shader && state->language_version >= 300 && $$.flags.q.in)
+ if (state->is_version(430, 300) && $$.flags.q.in)
_mesa_glsl_error(&@1, state, "invariant qualifiers cannot be used with shader inputs");
}
| interpolation_qualifier type_qualifier
$$.flags.q.explicit_stream = 0;
$$.stream = state->out_qualifier->stream;
}
+
+ if (state->has_enhanced_layouts()) {
+ $$.flags.q.xfb_buffer = 1;
+ $$.flags.q.explicit_xfb_buffer = 0;
+ $$.xfb_buffer = state->out_qualifier->xfb_buffer;
+ }
}
| UNIFORM
{
{
ast_interface_block *const block = $6;
- block->block_name = $2;
- block->declarations.push_degenerate_list_at_head(& $4->link);
-
- _mesa_ast_process_interface_block(& @1, state, block, $1);
-
- $$ = block;
- }
- | uniform_interface_qualifier NEW_IDENTIFIER '{' member_list '}' instance_name_opt ';'
- {
- ast_interface_block *const block = $6;
-
- block->layout = *state->default_uniform_qualifier;
- block->block_name = $2;
- block->declarations.push_degenerate_list_at_head(& $4->link);
-
- _mesa_ast_process_interface_block(& @1, state, block, $1);
-
- $$ = block;
- }
- | buffer_interface_qualifier NEW_IDENTIFIER '{' member_list '}' instance_name_opt ';'
- {
- ast_interface_block *const block = $6;
-
- block->layout = *state->default_shader_storage_qualifier;
+ if ($1.flags.q.uniform) {
+ block->layout = *state->default_uniform_qualifier;
+ } else if ($1.flags.q.buffer) {
+ block->layout = *state->default_shader_storage_qualifier;
+ }
block->block_name = $2;
block->declarations.push_degenerate_list_at_head(& $4->link);
memset(& $$, 0, sizeof($$));
$$.flags.q.out = 1;
}
- ;
-
-uniform_interface_qualifier:
- UNIFORM
+ | UNIFORM
{
memset(& $$, 0, sizeof($$));
$$.flags.q.uniform = 1;
}
- ;
-
-buffer_interface_qualifier:
- BUFFER
+ | BUFFER
{
memset(& $$, 0, sizeof($$));
$$.flags.q.buffer = 1;
merge_in_qualifier(& @1, state, $1, $$, false)) {
YYERROR;
}
+ $$ = $2;
}
}
| layout_qualifier IN_TOK ';'
merge_out_qualifier(& @1, state, $1, $$, false)) {
YYERROR;
}
+ $$ = $2;
}
}
| layout_qualifier OUT_TOK ';'