[Mesa-dev] [PATCH] glsl: Add additionnal type alias for convenience.

Vincent Lejeune vljn at ovi.com
Tue Dec 20 13:30:52 PST 2011


ivec2, ivec3, bvec2, bvec3 and bvec4 have now a "_type" suffixed alias
to identify them easily. These types are currently not widely used
inside glsl, however they are refered in UBO spec. It's an opportunity
to add them.
---
 src/glsl/builtin_types.h |    5 +++++
 src/glsl/glsl_types.h    |    5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/glsl/builtin_types.h b/src/glsl/builtin_types.h
index cc99b1b..65b62c3 100644
--- a/src/glsl/builtin_types.h
+++ b/src/glsl/builtin_types.h
@@ -63,7 +63,12 @@ const glsl_type glsl_type::builtin_core_types[] = {
 };
 
 const glsl_type *const glsl_type::bool_type  = & builtin_core_types[0];
+const glsl_type *const glsl_type::bvec2_type = & builtin_core_types[1];
+const glsl_type *const glsl_type::bvec3_type = & builtin_core_types[2];
+const glsl_type *const glsl_type::bvec4_type = & builtin_core_types[3];
 const glsl_type *const glsl_type::int_type   = & builtin_core_types[4];
+const glsl_type *const glsl_type::ivec2_type = & builtin_core_types[5];
+const glsl_type *const glsl_type::ivec3_type = & builtin_core_types[6];
 const glsl_type *const glsl_type::ivec4_type = & builtin_core_types[7];
 const glsl_type *const glsl_type::float_type = & builtin_core_types[8];
 const glsl_type *const glsl_type::vec2_type = & builtin_core_types[9];
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index 4ac9011..8518e9d 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -151,6 +151,8 @@ struct glsl_type {
    static const glsl_type *const error_type;
    static const glsl_type *const void_type;
    static const glsl_type *const int_type;
+   static const glsl_type *const ivec2_type;
+   static const glsl_type *const ivec3_type;
    static const glsl_type *const ivec4_type;
    static const glsl_type *const uint_type;
    static const glsl_type *const uvec2_type;
@@ -161,6 +163,9 @@ struct glsl_type {
    static const glsl_type *const vec3_type;
    static const glsl_type *const vec4_type;
    static const glsl_type *const bool_type;
+   static const glsl_type *const bvec2_type;
+   static const glsl_type *const bvec3_type;
+   static const glsl_type *const bvec4_type;
    static const glsl_type *const mat2_type;
    static const glsl_type *const mat2x3_type;
    static const glsl_type *const mat2x4_type;
-- 
1.7.7



More information about the mesa-dev mailing list