summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtin_function.cpp
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/builtin_function.cpp
parentfc9ae101b4b7a71ca7a5d4f185e887064007e0d1 (diff)
glsl2: Use Elements macro
Diffstat (limited to 'src/glsl/builtin_function.cpp')
-rw-r--r--src/glsl/builtin_function.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp
index 75e058c41c8..fbb2638fc93 100644
--- a/src/glsl/builtin_function.cpp
+++ b/src/glsl/builtin_function.cpp
@@ -4748,6 +4748,10 @@ static const char *functions_for_EXT_texture_array_fs [] = {
builtins_EXT_texture_array_fs_textures,
};
+#ifndef Elements
+#define Elements(x) (sizeof(x)/sizeof(*(x)))
+#endif
+
void
_mesa_glsl_initialize_functions(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
@@ -4755,46 +4759,46 @@ _mesa_glsl_initialize_functions(exec_list *instructions,
if (state->language_version >= 110)
read_builtins(state, instructions,
functions_for_110,
- sizeof(functions_for_110) / sizeof(const char *));
+ Elements(functions_for_110));
if (state->target == fragment_shader && state->language_version >= 110)
read_builtins(state, instructions,
functions_for_110_fs,
- sizeof(functions_for_110_fs) / sizeof(const char *));
+ Elements(functions_for_110_fs));
if (state->target == vertex_shader && state->language_version >= 110)
read_builtins(state, instructions,
functions_for_110_vs,
- sizeof(functions_for_110_vs) / sizeof(const char *));
+ Elements(functions_for_110_vs));
if (state->language_version >= 120)
read_builtins(state, instructions,
functions_for_120,
- sizeof(functions_for_120) / sizeof(const char *));
+ Elements(functions_for_120));
if (state->language_version >= 130)
read_builtins(state, instructions,
functions_for_130,
- sizeof(functions_for_130) / sizeof(const char *));
+ Elements(functions_for_130));
if (state->target == fragment_shader && state->language_version >= 130)
read_builtins(state, instructions,
functions_for_130_fs,
- sizeof(functions_for_130_fs) / sizeof(const char *));
+ Elements(functions_for_130_fs));
if (state->ARB_texture_rectangle_enable)
read_builtins(state, instructions,
functions_for_ARB_texture_rectangle,
- sizeof(functions_for_ARB_texture_rectangle) / sizeof(const char *));
+ Elements(functions_for_ARB_texture_rectangle));
if (state->EXT_texture_array_enable)
read_builtins(state, instructions,
functions_for_EXT_texture_array,
- sizeof(functions_for_EXT_texture_array) / sizeof(const char *));
+ Elements(functions_for_EXT_texture_array));
if (state->target == fragment_shader && state->EXT_texture_array_enable)
read_builtins(state, instructions,
functions_for_EXT_texture_array_fs,
- sizeof(functions_for_EXT_texture_array_fs) / sizeof(const char *));
+ Elements(functions_for_EXT_texture_array_fs));
}