summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-03-24 17:05:09 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-03-24 17:05:09 -0700
commit9ff8f3777e7388eda2b935e74aafa7a9429a3d72 (patch)
treeb749e836e30355244304d37ef2511d453503323e
parent4d184a1d02edef1720bb8093a91596831f7c017d (diff)
Add class-private handles to matrix types in glsl_type
-rwxr-xr-xbuiltin_types.sh20
-rw-r--r--glsl_types.h16
2 files changed, 31 insertions, 5 deletions
diff --git a/builtin_types.sh b/builtin_types.sh
index e09b8309b4..6dd0ea7403 100755
--- a/builtin_types.sh
+++ b/builtin_types.sh
@@ -155,6 +155,7 @@ for i in 2 3 4; do
gen_integral_type "vec$i" "GLSL_TYPE_FLOAT" $i 0
done
+matX_index=$index
for i in 2 3 4; do
gen_integral_type "mat$i" "GLSL_TYPE_FLOAT" $i $i
done
@@ -175,6 +176,9 @@ echo
echo 'const struct glsl_type *const glsl_bool_type = & builtin_core_types['$bool_index'];'
echo 'const struct glsl_type *const glsl_int_type = & builtin_core_types['$int_index'];'
echo 'const struct glsl_type *const glsl_float_type = & builtin_core_types['$float_index'];'
+echo 'const glsl_type *const glsl_type::mat2_type = & builtin_core_types['$(($matX_index + 0))'];'
+echo 'const glsl_type *const glsl_type::mat3_type = & builtin_core_types['$(($matX_index + 1))'];'
+echo 'const glsl_type *const glsl_type::mat4_type = & builtin_core_types['$(($matX_index + 2))'];'
echo '/*@}*/'
echo
@@ -268,16 +272,22 @@ echo '/** \name Types added in GLSL 1.20'
echo ' */'
echo '/*@{*/'
gen_header "120"
-for i in 2 3 4; do
- for j in 2 3 4; do
- if [ $i -ne $j ]; then
- gen_integral_type "mat${i}x${j}" "GLSL_TYPE_FLOAT" $i $j
+for c in 2 3 4; do
+ for r in 2 3 4; do
+ if [ $c -ne $r ]; then
+ gen_integral_type "mat${c}x${r}" "GLSL_TYPE_FLOAT" $c $r
fi
done
done
gen_footer
-echo '/*@}*/'
+echo 'const glsl_type *const glsl_type::mat2x3_type = & builtin_120_types[0];'
+echo 'const glsl_type *const glsl_type::mat2x4_type = & builtin_120_types[1];'
+echo 'const glsl_type *const glsl_type::mat3x2_type = & builtin_120_types[2];'
+echo 'const glsl_type *const glsl_type::mat3x4_type = & builtin_120_types[3];'
+echo 'const glsl_type *const glsl_type::mat4x2_type = & builtin_120_types[4];'
+echo 'const glsl_type *const glsl_type::mat4x3_type = & builtin_120_types[5];'
+echo '/*@}*/'
echo
echo '/** \name Types added in GLSL 1.30'
echo ' */'
diff --git a/glsl_types.h b/glsl_types.h
index 97d8390e60..4a92712b21 100644
--- a/glsl_types.h
+++ b/glsl_types.h
@@ -216,6 +216,22 @@ struct glsl_type {
{
return base_type == GLSL_TYPE_ERROR;
}
+
+private:
+ /**
+ * \name Pointers to various type singletons
+ */
+ /*@{*/
+ static const glsl_type *const mat2_type;
+ static const glsl_type *const mat2x3_type;
+ static const glsl_type *const mat2x4_type;
+ static const glsl_type *const mat3x2_type;
+ static const glsl_type *const mat3_type;
+ static const glsl_type *const mat3x4_type;
+ static const glsl_type *const mat4x2_type;
+ static const glsl_type *const mat4x3_type;
+ static const glsl_type *const mat4_type;
+ /*@}*/
};
struct glsl_struct_field {