<div dir="ltr">On 22 January 2013 00:52, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>

<br>
For variables that are in an interface block or are an instance of an<br>
interface block, this is the GLSL_TYPE_INTERFACE type for that block.<br>
<br>
Convert the ir_variable::is_in_uniform_block method added in the<br>
previous commit to use this field instead of ir_variable::uniform_block.<br>
<br>
Signed-off-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
---<br>
 src/glsl/ast_to_hir.cpp | 2 ++<br>
 src/glsl/ir.h           | 9 ++++++++-<br>
 src/glsl/ir_clone.cpp   | 2 ++<br>
 3 files changed, 12 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp<br>
index a740a3c..47a1ae0 100644<br>
--- a/src/glsl/ast_to_hir.cpp<br>
+++ b/src/glsl/ast_to_hir.cpp<br>
@@ -4254,6 +4254,7 @@ ast_uniform_block::hir(exec_list *instructions,<br>
                                                 this->instance_name,<br>
                                                 ir_var_uniform);<br>
<br>
+      var->interface_type = block_type;<br>
       state->symbols->add_variable(var);<br>
       instructions->push_tail(var);<br>
    } else {<br>
@@ -4263,6 +4264,7 @@ ast_uniform_block::hir(exec_list *instructions,<br>
                                    ralloc_strdup(state, fields[i].name),<br>
                                    ir_var_uniform);<br>
          var->uniform_block = ubo - state->uniform_blocks;<br>
+         var->interface_type = block_type;<br>
<br>
          state->symbols->add_variable(var);<br>
          instructions->push_tail(var);<br>
diff --git a/src/glsl/ir.h b/src/glsl/ir.h<br>
index a7eb9c1..49c5f8d 100644<br>
--- a/src/glsl/ir.h<br>
+++ b/src/glsl/ir.h<br>
@@ -352,7 +352,7 @@ public:<br>
     */<br>
    inline bool is_in_uniform_block() const<br>
    {<br>
-      return this->mode == ir_var_uniform && this->uniform_block != -1;<br>
+      return this->mode == ir_var_uniform && this->interface_type != NULL;<br>
    }<br>
<br>
    /**<br>
@@ -538,6 +538,13 @@ public:<br>
     * objects.<br>
     */<br>
    ir_constant *constant_initializer;<br>
+<br>
+   /**<br>
+    * interface<br>
+    *<br>
+    * \sa ir_variable::location<br>
+    */<br>
+   const glsl_type *interface_type;<br></blockquote><div><br></div><div>This comment doesn't really help me understand what this field means.<br><br>How about putting in this text (from the commit message):<br><br>For variables that are in an interface block or are an instance of an<br>

interface block, this is the GLSL_TYPE_INTERFACE type for that block.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
 };<br>
<br>
<br>
diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp<br>
index 3e22f2d..c221a96 100644<br>
--- a/src/glsl/ir_clone.cpp<br>
+++ b/src/glsl/ir_clone.cpp<br>
@@ -77,6 +77,8 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const<br>
       var->constant_initializer =<br>
         this->constant_initializer->clone(mem_ctx, ht);<br>
<br>
+   var->interface_type = this->interface_type;<br>
+<br>
    if (ht) {<br>
       hash_table_insert(ht, var, (void *)const_cast<ir_variable *>(this));<br>
    }<br>
<span class=""><font color="#888888">--<br>
1.7.11.7<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div><div class="gmail_extra">I'm not certain whether it's strictly necessary, but I would feel much more confident in this patch if we also initialized interface_type to NULL in the ir_variable constructor.<br>
<br></div><div class="gmail_extra">With those two changes, this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div></div>