mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 00:00:11 +01:00
glsl2: Use Elements macro
This commit is contained in:
parent
fc9ae101b4
commit
b64e979971
2 changed files with 18 additions and 11 deletions
|
|
@ -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));
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue