diff options
author | Jordan Justen <[email protected]> | 2013-03-09 16:34:55 -0800 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2013-05-23 09:37:12 -0700 |
commit | b24eeb078f3d24b9b90f32c93708aeabcad0a697 (patch) | |
tree | 4d9447f05c74c5c4cfe8dab232d2c564dbf38d97 /src/glsl/ast_to_hir.cpp | |
parent | cb29a7095f6cf3700eb3d2c575640ea129388782 (diff) |
glsl ast_to_hir: support in/out for interface blocks
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index b2a18114ac0..e918adeef1d 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -4162,16 +4162,32 @@ ast_interface_block::hir(exec_list *instructions, true, block_row_major); + ir_variable_mode var_mode; + const char *iface_type_name; + if (this->layout.flags.q.in) { + var_mode = ir_var_shader_in; + iface_type_name = "in"; + } else if (this->layout.flags.q.out) { + var_mode = ir_var_shader_out; + iface_type_name = "out"; + } else if (this->layout.flags.q.uniform) { + var_mode = ir_var_uniform; + iface_type_name = "uniform"; + } else { + assert(!"interface block layout qualifier not found!"); + } + const glsl_type *block_type = glsl_type::get_interface_instance(fields, num_variables, packing, this->block_name); - if (!state->symbols->add_interface(block_type->name, block_type, ir_var_uniform)) { + if (!state->symbols->add_interface(block_type->name, block_type, var_mode)) { YYLTYPE loc = this->get_location(); - _mesa_glsl_error(&loc, state, "Uniform block name `%s' already taken in " - "the current scope.\n", this->block_name); + _mesa_glsl_error(&loc, state, "Interface block `%s' with type `%s' " + "already taken in the current scope.\n", + this->block_name, iface_type_name); } /* Since interface blocks cannot contain statements, it should be @@ -4195,11 +4211,11 @@ ast_interface_block::hir(exec_list *instructions, var = new(state) ir_variable(block_array_type, this->instance_name, - ir_var_uniform); + var_mode); } else { var = new(state) ir_variable(block_type, this->instance_name, - ir_var_uniform); + var_mode); } var->interface_type = block_type; @@ -4215,7 +4231,7 @@ ast_interface_block::hir(exec_list *instructions, ir_variable *var = new(state) ir_variable(fields[i].type, ralloc_strdup(state, fields[i].name), - ir_var_uniform); + var_mode); var->interface_type = block_type; state->symbols->add_variable(var); |