summaryrefslogtreecommitdiff
path: root/glsl_types.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-04-19 15:40:01 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-04-28 18:22:54 -0700
commit8f755dcb67848966c350883ad6fbb50547d9ec24 (patch)
tree7deb0516859960cfdc02a72a1cc65d0020f40905 /glsl_types.cpp
parent3455ce614424a5a23a23037e23d0454e476bceea (diff)
Add glsl_type::field_type
Query the type of a structure field
Diffstat (limited to 'glsl_types.cpp')
-rw-r--r--glsl_types.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/glsl_types.cpp b/glsl_types.cpp
index b4abfdd7b6..71d7dd36f8 100644
--- a/glsl_types.cpp
+++ b/glsl_types.cpp
@@ -657,3 +657,18 @@ glsl_type::get_array_instance(const glsl_type *base, unsigned array_size)
return t;
}
+
+
+const glsl_type *
+glsl_type::field_type(const char *name) const
+{
+ if (this->base_type != GLSL_TYPE_STRUCT)
+ return error_type;
+
+ for (unsigned i = 0; i < this->length; i++) {
+ if (strcmp(name, this->fields.structure[i].name) == 0)
+ return this->fields.structure[i].type;
+ }
+
+ return error_type;
+}