Mesa (master): glsl: Add without_array type predicate

Ian Romanick idr at kemper.freedesktop.org
Mon Aug 4 21:40:44 UTC 2014


Module: Mesa
Branch: master
Commit: 22f7a46d74d702b84de77d4465069776e34f617d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=22f7a46d74d702b84de77d4465069776e34f617d

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Sat Jul 19 14:07:18 2014 -0700

glsl: Add without_array type predicate

Returns the type without any arrays.

This will be used in later patches in this series.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Suggested-by: Timothy Arceri <t_arceri at yahoo.com.au>
Reviewed-by: Timothy Arceri <t_arceri at yahoo.com.au>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glsl/glsl_types.h |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index 50cd655..92578ff 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -465,6 +465,18 @@ struct glsl_type {
    }
 
    /**
+    * Get the type stripped of any arrays
+    *
+    * \return
+    * Pointer to the type of elements of the first non-array type for array
+    * types, or pointer to itself for non-array types.
+    */
+   const glsl_type *without_array() const
+   {
+      return this->is_array() ? this->fields.array : this;
+   }
+
+   /**
     * Return the amount of atomic counter storage required for a type.
     */
    unsigned atomic_size() const




More information about the mesa-commit mailing list