summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2015-10-17 20:22:14 +1100
committerTimothy Arceri <[email protected]>2015-10-20 11:58:28 +1100
commit2832ca95ecce064c7d841a3a374c2179f56161be (patch)
treef467520c99cc83259c82f7f9bb1ab8d7972c9699
parentaa9f06b3ea99b318469c3d140651f4b4986896a6 (diff)
glsl: fix stream qualifier for blocks with an instance name
This also removes the validation from the parser as it is not required and once arb_enhanced_layouts comes along we wont be able to do validation on the stream qualifier in the parser anyway as it adds constant expression support to the stream qualifier. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Cc: 11.0 <[email protected]>
-rw-r--r--src/glsl/ast_to_hir.cpp26
-rw-r--r--src/glsl/glsl_parser.yy11
-rw-r--r--src/glsl/lower_named_interface_blocks.cpp1
3 files changed, 16 insertions, 22 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index ede02d94cb2..db9229f6ae3 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -6293,6 +6293,18 @@ ast_interface_block::hir(exec_list *instructions,
state->struct_specifier_depth--;
+ for (unsigned i = 0; i < num_variables; i++) {
+ if (fields[i].stream != -1 &&
+ (unsigned) fields[i].stream != this->layout.stream) {
+ _mesa_glsl_error(&loc, state,
+ "stream layout qualifier on "
+ "interface block member `%s' does not match "
+ "the interface block (%d vs %d)",
+ fields[i].name, fields[i].stream,
+ this->layout.stream);
+ }
+ }
+
if (!redeclaring_per_vertex) {
validate_identifier(this->block_name, loc, state);
@@ -6633,6 +6645,8 @@ ast_interface_block::hir(exec_list *instructions,
var->data.explicit_binding = this->layout.flags.q.explicit_binding;
var->data.binding = this->layout.binding;
+ var->data.stream = this->layout.stream;
+
state->symbols->add_variable(var);
instructions->push_tail(var);
}
@@ -6651,6 +6665,7 @@ ast_interface_block::hir(exec_list *instructions,
var->data.centroid = fields[i].centroid;
var->data.sample = fields[i].sample;
var->data.patch = fields[i].patch;
+ var->data.stream = this->layout.stream;
var->init_interface_type(block_type);
if (var_mode == ir_var_shader_in || var_mode == ir_var_uniform)
@@ -6663,17 +6678,6 @@ ast_interface_block::hir(exec_list *instructions,
var->data.matrix_layout = fields[i].matrix_layout;
}
- if (fields[i].stream != -1 &&
- ((unsigned)fields[i].stream) != this->layout.stream) {
- _mesa_glsl_error(&loc, state,
- "stream layout qualifier on "
- "interface block member `%s' does not match "
- "the interface block (%d vs %d)",
- var->name, fields[i].stream, this->layout.stream);
- }
-
- var->data.stream = this->layout.stream;
-
if (var->data.mode == ir_var_shader_storage) {
var->data.image_read_only = fields[i].image_read_only;
var->data.image_write_only = fields[i].image_write_only;
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index cd00f6e085b..2f2e10d7992 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -2609,17 +2609,6 @@ interface_block:
block->layout.is_default_qualifier = false;
- foreach_list_typed (ast_declarator_list, member, link, &block->declarations) {
- ast_type_qualifier& qualifier = member->type->qualifier;
- if (qualifier.flags.q.stream && qualifier.stream != block->layout.stream) {
- _mesa_glsl_error(& @1, state,
- "stream layout qualifier on "
- "interface block member does not match "
- "the interface block (%d vs %d)",
- qualifier.stream, block->layout.stream);
- YYERROR;
- }
- }
$$ = block;
}
| memory_qualifier interface_block
diff --git a/src/glsl/lower_named_interface_blocks.cpp b/src/glsl/lower_named_interface_blocks.cpp
index 276a2dedf47..114bb5811b4 100644
--- a/src/glsl/lower_named_interface_blocks.cpp
+++ b/src/glsl/lower_named_interface_blocks.cpp
@@ -186,6 +186,7 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions)
new_var->data.centroid = iface_t->fields.structure[i].centroid;
new_var->data.sample = iface_t->fields.structure[i].sample;
new_var->data.patch = iface_t->fields.structure[i].patch;
+ new_var->data.stream = var->data.stream;
new_var->init_interface_type(iface_t);
hash_table_insert(interface_namespace, new_var,