diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2013-06-18 04:22:30 -0700 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2013-06-26 11:25:12 -0700 |
commit | d367a1cbdb816bcc50fb1fd10121de6eba53f7ab (patch) | |
tree | e9a4330fdef141f992612ed3345af8902b87d5b1 /src/glsl/glsl_types.h | |
parent | 9a14e412d6de93349a490a9c4534b52c3b524ee9 (diff) | |
download | external_mesa3d-d367a1cbdb816bcc50fb1fd10121de6eba53f7ab.zip external_mesa3d-d367a1cbdb816bcc50fb1fd10121de6eba53f7ab.tar.gz external_mesa3d-d367a1cbdb816bcc50fb1fd10121de6eba53f7ab.tar.bz2 |
glsl: Add simple vector type accessor helpers.
This patch introduces new functions to quickly grab a pointer to a
vector type. For example:
glsl_type::bvec(4) returns glsl_type::bvec4_type
glsl_type::ivec(3) returns glsl_type::ivec3_type
glsl_type::uvec(2) returns glsl_type::uvec2_type
glsl_type::vec(1) returns glsl_type::float_type
This is less wordy than glsl_type::get_instance(GLSL_TYPE_BOOL, 4, 1),
which can help avoid extra word wrapping.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/glsl/glsl_types.h')
-rw-r--r-- | src/glsl/glsl_types.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 31e3dd2..665af8b 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -187,6 +187,15 @@ struct glsl_type { static const glsl_type *const mat4_type; /*@}*/ + /** + * Convenience accessors for vector types (shorter than get_instance()). + * @{ + */ + static const glsl_type *const vec(unsigned components); + static const glsl_type *const ivec(unsigned components); + static const glsl_type *const uvec(unsigned components); + static const glsl_type *const bvec(unsigned components); + /**@}*/ /** * For numeric and boolean derrived types returns the basic scalar type |