summaryrefslogtreecommitdiff
path: root/glsl_types.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-03-23 17:31:39 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-03-23 17:31:39 -0700
commitbb7e00a1cd63f3012226253bb0121922419a5f23 (patch)
treee9960d9eb03d90bc41be2acc39f5a7822baf9030 /glsl_types.cpp
parent7aeb6abda7da155d81fc4bda5c0c03ff28e5ed0c (diff)
Add glsl_type::get_base_type query
Retreives the glsl_type that corresponds to the base type of a numeric scalar / vector / matrix type. So vec4 returns float, etc.
Diffstat (limited to 'glsl_types.cpp')
-rw-r--r--glsl_types.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/glsl_types.cpp b/glsl_types.cpp
index af6a40800b..2b06a33553 100644
--- a/glsl_types.cpp
+++ b/glsl_types.cpp
@@ -142,3 +142,20 @@ _mesa_glsl_get_vector_type(unsigned base_type, unsigned vector_length)
return glsl_error_type;
}
}
+
+
+const glsl_type *glsl_type::get_base_type() const
+{
+ switch (base_type) {
+ case GLSL_TYPE_UINT:
+ return glsl_uint_type;
+ case GLSL_TYPE_INT:
+ return glsl_int_type;
+ case GLSL_TYPE_FLOAT:
+ return glsl_float_type;
+ case GLSL_TYPE_BOOL:
+ return glsl_bool_type;
+ default:
+ return glsl_error_type;
+ }
+}