[Mesa-dev] [PATCH v2 08/15] glsl ast_to_hir: support in/out for interface blocks

Jordan Justen jordan.l.justen at intel.com
Mon Mar 18 16:35:05 PDT 2013


Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/glsl/ast_to_hir.cpp |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 40f3188..ee54c70 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4293,6 +4293,17 @@ ast_interface_block::hir(exec_list *instructions,
     */
    assert(declared_variables.is_empty());
 
+   ir_variable_mode var_mode;
+   if (this->layout.flags.q.in) {
+      var_mode = ir_var_shader_in;
+   } else if (this->layout.flags.q.out) {
+      var_mode = ir_var_shader_out;
+   } else if (this->layout.flags.q.uniform) {
+      var_mode = ir_var_uniform;
+   } else {
+      assert(!"interface block layout qualifier not found!");
+   }
+
    /* Page 39 (page 45 of the PDF) of section 4.3.7 in the GLSL ES 3.00 spec
     * says:
     *
@@ -4309,11 +4320,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;
@@ -4329,7 +4340,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);
-- 
1.7.10.4



More information about the mesa-dev mailing list