[Mesa-dev] [PATCH 1/2] glsl: mark variables produced by lower_named_interface_blocks.

Paul Berry stereotype441 at gmail.com
Tue Oct 22 06:53:38 CEST 2013


These variables will need to be treated specially by
program_resource_visitor, so that they can be addressed through the
API using their interface block name (and array index, for interface
block arrays).
---
 src/glsl/ir.h                             | 12 ++++++++++++
 src/glsl/lower_named_interface_blocks.cpp |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index aac8cbb..91eb4c6 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -579,6 +579,18 @@ public:
    unsigned location_frac:2;
 
    /**
+    * Non-zero if this variable was created by lowering a named interface
+    * block which was not an array.
+    */
+   unsigned from_named_ifc_block_nonarray:1;
+
+   /**
+    * Non-zero if this variable was created by lowering a named interface
+    * block which was an array.
+    */
+   unsigned from_named_ifc_block_array:1;
+
+   /**
     * \brief Layout qualifier for gl_FragDepth.
     *
     * This is not equal to \c ir_depth_layout_none if and only if this
diff --git a/src/glsl/lower_named_interface_blocks.cpp b/src/glsl/lower_named_interface_blocks.cpp
index f415252..6329d5a 100644
--- a/src/glsl/lower_named_interface_blocks.cpp
+++ b/src/glsl/lower_named_interface_blocks.cpp
@@ -140,6 +140,7 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions)
                   new(mem_ctx) ir_variable(iface_t->fields.structure[i].type,
                                            var_name,
                                            (ir_variable_mode) var->mode);
+               new_var->from_named_ifc_block_nonarray = 1;
             } else {
                const glsl_type *new_array_type =
                   glsl_type::get_array_instance(
@@ -149,6 +150,7 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions)
                   new(mem_ctx) ir_variable(new_array_type,
                                            var_name,
                                            (ir_variable_mode) var->mode);
+               new_var->from_named_ifc_block_array = 1;
             }
             new_var->location = iface_t->fields.structure[i].location;
 
-- 
1.8.4.1



More information about the mesa-dev mailing list