On 03/20/2013 05:19 PM, Eric Anholt wrote:
Jordan Justen <jordan.l.jus...@intel.com> writes:
Previously only 'uniform' was allowed for uniform blocks.
Now, in/out can be parsed, but it will only be allowed for
GLSL >= 150.
basic_interface_block:
- UNIFORM NEW_IDENTIFIER '{' member_list '}' instance_name_opt ';'
+ interface_qualifier NEW_IDENTIFIER '{' member_list '}'
instance_name_opt ';'
{
ast_interface_block *const block = $6;
block->block_name = $2;
block->declarations.push_degenerate_list_at_head(& $4->link);
- if (!state->ARB_uniform_buffer_object_enable) {
- _mesa_glsl_error(& @1, state,
- "#version 140 / GL_ARB_uniform_buffer_object "
- "required for defining uniform blocks\n");
- } else if (state->ARB_uniform_buffer_object_warn) {
- _mesa_glsl_warning(& @1, state,
- "#version 140 / GL_ARB_uniform_buffer_object "
- "required for defining uniform blocks\n");
+ if ($1.flags.q.uniform) {
+ if (!state->ARB_uniform_buffer_object_enable) {
+ _mesa_glsl_error(& @1, state,
+ "#version 140 / GL_ARB_uniform_buffer_object "
+ "required for defining uniform blocks\n");
+ } else if (state->ARB_uniform_buffer_object_warn) {
+ _mesa_glsl_warning(& @1, state,
+ "#version 140 / GL_ARB_uniform_buffer_object
"
+ "required for defining uniform blocks\n");
+ }
+ } else {
+ if (state->es_shader || state->language_version < 150) {
+ _mesa_glsl_error(& @1, state,
+ "#version 150 required for using "
+ "interface blocks.\n");
+ }
}
/* Since block arrays require names, and both features are added in
@@ -1937,10 +1946,39 @@ basic_interface_block:
"blocks with an instance name\n");
}
+ unsigned interface_type_mask, interface_type_flags;
+ struct ast_type_qualifier temp_type_qualifier;
+
+ temp_type_qualifier.flags.i = 0;
+ temp_type_qualifier.flags.q.uniform = true;
+ temp_type_qualifier.flags.q.in = true;
+ temp_type_qualifier.flags.q.out = true;
+ interface_type_mask = temp_type_qualifier.flags.i;
+ interface_type_flags = $1.flags.i & interface_type_mask;
+ block->layout.flags.i |= interface_type_flags;
Given that an interface_qualifier ($1) only has either uniform, in, or
out set, I don't see why this masking is needed.
Agreed. If you wanted to sanity check this, you could do:
assert(q.uniform + q.in + q.out == 1);
--Ken
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev