diff options
author | Paul Berry <stereotype441@gmail.com> | 2011-07-11 16:44:13 -0700 |
---|---|---|
committer | Paul Berry <stereotype441@gmail.com> | 2011-07-18 10:48:27 -0700 |
commit | ddc1c96390b685bb95f7431e862c3a64fcefa085 (patch) | |
tree | 2f4ea93355172c65be347efde33a76d7aff0df73 /src/glsl/glsl_types.cpp | |
parent | 9b3ec69cf4b079fbe16293d8fbe13016f0d74951 (diff) |
glsl: Move type_contains_sampler() into glsl_type for later reuse.
The new location, as a member function of glsl_type, is more
consistent with queries like is_sampler(), is_boolean(), is_float(),
etc. Placing the function inside glsl_type also makes it available to
any code that uses glsl_types.
Diffstat (limited to 'src/glsl/glsl_types.cpp')
-rw-r--r-- | src/glsl/glsl_types.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 78d10bd9380..a5e21bbb96c 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -111,6 +111,22 @@ add_types_to_symbol_table(glsl_symbol_table *symtab, } } +bool +glsl_type::contains_sampler() const +{ + if (this->is_array()) { + return this->fields.array->contains_sampler(); + } else if (this->is_record()) { + for (unsigned int i = 0; i < this->length; i++) { + if (this->fields.structure[i].type->contains_sampler()) + return true; + } + return false; + } else { + return this->is_sampler(); + } +} + void glsl_type::generate_100ES_types(glsl_symbol_table *symtab) { |