summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtins/tools/generate_builtins.pl
diff options
context:
space:
mode:
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";