From: Ian Romanick <ian.d.roman...@intel.com>

For the first declaration below, there will be an ir_variable named
"instance" whose type and whose instance_type will be the same
glsl_type.  For the second declaration, there will be an ir_variable
named "f" whose type is float and whose instance_type is B2.

"instance" is an interface instance variable, but "f" is not.

uniform B1 {
    float f;
} instance;

uniform B2 {
    float f;
};

Signed-off-by: Ian Romanick <ian.d.roman...@intel.com>
---
 src/glsl/ir.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 49c5f8d..a776f49 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -355,6 +355,14 @@ public:
       return this->mode == ir_var_uniform && this->interface_type != NULL;
    }
 
+   inline bool is_interface_instance() const
+   {
+      const glsl_type *const t = this->type;
+
+      return (t == this->interface_type)
+         || (t->is_array() && t->fields.array == this->interface_type);
+    }
+
    /**
     * Declared type of the variable
     */
-- 
1.7.11.7

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to