diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-26 11:13:43 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-26 14:43:11 -0700 |
commit | d811d47609323f99f3718a2c5fb75ce47032f380 (patch) | |
tree | ef3e1d993cc3022f4ed57080b0d74f1986a7ec53 /glsl_types.h | |
parent | cef3baecf636a30b62cd7a1e8de57c7650f7003e (diff) |
Add glsl_type::components to query total number of components in a type
Diffstat (limited to 'glsl_types.h')
-rw-r--r-- | glsl_types.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/glsl_types.h b/glsl_types.h index beaaa78..720b05b 100644 --- a/glsl_types.h +++ b/glsl_types.h @@ -158,6 +158,16 @@ struct glsl_type { unsigned columns); /** + * Query the total number of scalars that make up a scalar, vector or matrix + */ + unsigned components() const + { + return ((vector_elements == 0) ? 1 : vector_elements) + * ((matrix_columns == 0) ? 1 : matrix_columns); + + } + + /** * Query whether or not a type is a scalar (non-vector and non-matrix). */ bool is_scalar() const |