summaryrefslogtreecommitdiff
path: root/glsl_types.h
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-03-30 16:58:19 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-03-30 16:58:19 -0700
commit548a1b5ab7304037a7cac8e6d647fb6b5ccbaf5d (patch)
tree270c86847c0cd76bbd4a765eb5f0f219e9e49177 /glsl_types.h
parent066304679cdd8bad6bca7fb815087559cda75aaf (diff)
Implement array type handling
Since all glsl_type objects are flyweights, support is added to track all known array types. This accounts for most of the changes.
Diffstat (limited to 'glsl_types.h')
-rw-r--r--glsl_types.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/glsl_types.h b/glsl_types.h
index bb2d6f697b..6f3b512f28 100644
--- a/glsl_types.h
+++ b/glsl_types.h
@@ -170,6 +170,12 @@ struct glsl_type {
unsigned columns);
/**
+ * Get the instance of an array type
+ */
+ static const glsl_type *get_array_instance(const glsl_type *base,
+ unsigned elements);
+
+ /**
* Query the total number of scalars that make up a scalar, vector or matrix
*/
unsigned components() const
@@ -301,6 +307,20 @@ struct glsl_type {
private:
/**
+ * Constructor for array types
+ */
+ glsl_type(const glsl_type *array, unsigned length) :
+ base_type(GLSL_TYPE_ARRAY),
+ sampler_dimensionality(0), sampler_shadow(0), sampler_array(0),
+ sampler_type(0),
+ vector_elements(0), matrix_columns(0),
+ name(NULL), length(length)
+ {
+ this->fields.array = array;
+ this->name = "<array>";
+ }
+
+ /**
* \name Pointers to various private type singletons
*/
/*@{*/
@@ -314,6 +334,18 @@ private:
static const glsl_type *const mat4x3_type;
static const glsl_type *const mat4_type;
/*@}*/
+
+ /** Hash table containing the known array types. */
+ static struct hash_table *array_types;
+
+ /** Structure defining the key type used for array_types hash table. */
+ struct array_hash_key {
+ const glsl_type *type;
+ unsigned size;
+ };
+
+ static int array_key_compare(const void *a, const void *b);
+ static unsigned array_key_hash(const void *key);
};
struct glsl_struct_field {