summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtins/tools/generate_builtins.pl
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-07-16 15:31:23 -0700
committerIan Romanick <[email protected]>2010-07-19 14:50:43 -0700
commitb64e979971e764ec1df8800d31c755298e618ba0 (patch)
treee7b5bc81d6afc5fd4266224df87b613f775a8eef /src/glsl/builtins/tools/generate_builtins.pl
parentfc9ae101b4b7a71ca7a5d4f185e887064007e0d1 (diff)
glsl2: Use Elements macro
Diffstat (limited to 'src/glsl/builtins/tools/generate_builtins.pl')
-rwxr-xr-xsrc/glsl/builtins/tools/generate_builtins.pl7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/glsl/builtins/tools/generate_builtins.pl b/src/glsl/builtins/tools/generate_builtins.pl
index 8b640ab8ff9..a0b5c1f421c 100755
--- a/src/glsl/builtins/tools/generate_builtins.pl
+++ b/src/glsl/builtins/tools/generate_builtins.pl
@@ -91,6 +91,10 @@ foreach $version (@versions) {
}
print << 'EOF';
+#ifndef Elements
+#define Elements(x) (sizeof(x)/sizeof(*(x)))
+#endif
+
void
_mesa_glsl_initialize_functions(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
@@ -116,8 +120,7 @@ foreach $version_xs (@versions) {
print " if ($check)\n";
print " read_builtins(state, instructions,\n";
print " functions_for_$version_xs,\n";
- print " sizeof(functions_for_$version_xs) / ";
- print "sizeof(const char *));\n\n"
+ print " Elements(functions_for_$version_xs));\n\n"
}
print "}\n";