diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/shader/slang/slang_typeinfo.c | 56 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_typeinfo.h | 12 |
2 files changed, 28 insertions, 40 deletions
diff --git a/src/mesa/shader/slang/slang_typeinfo.c b/src/mesa/shader/slang/slang_typeinfo.c index 6a358d66d8..a3a37ce378 100644 --- a/src/mesa/shader/slang/slang_typeinfo.c +++ b/src/mesa/shader/slang/slang_typeinfo.c @@ -35,6 +35,31 @@ #include "prog_instruction.h" +/** + * Determine the return type of a function. + * \param a_name the function name + * \param param function parameters (overloading) + * \param num_params number of parameters to function + * \param space namespace to search + * \param spec returns the type + * \param exists returns GL_TRUE or GL_FALSE to indicate existance of function + * \return GL_TRUE for success, GL_FALSE if failure (bad function name) + */ +static GLboolean +_slang_typeof_function(slang_atom a_name, const slang_operation * params, + GLuint num_params, + const slang_name_space * space, + slang_type_specifier * spec, GLboolean * exists, + slang_atom_pool *atoms, slang_info_log *log) +{ + slang_function *fun; + fun = _slang_locate_function(space->funcs, a_name, params, + num_params, space, atoms, log); + *exists = fun != NULL; + if (!fun) + return GL_TRUE; /* yes, not false */ + return slang_type_specifier_copy(spec, &fun->header.type.specifier); +} /** @@ -288,7 +313,8 @@ slang_typeinfo_destruct(slang_typeinfo * ti) /** - * Determine the return type of a function. + * Determine the return type of a function. This involves searching for + * the function by name and matching parameter types. * \param name name of the function * \param params array of function parameters * \param num_params number of parameters @@ -543,6 +569,7 @@ _slang_typeof_operation_(const slang_operation * op, space, &ti->spec, &exists, atoms, log)) return GL_FALSE; if (!exists) { + /* Look for struct initializer? */ slang_struct *s = slang_struct_scope_find(space->structs, op->a_id, GL_TRUE); if (s != NULL) { @@ -755,33 +782,6 @@ _slang_locate_function(const slang_function_scope * funcs, slang_atom a_name, } - -/** - * Determine the return type of a function. - * \param a_name the function name - * \param param function parameters (overloading) - * \param num_params number of parameters to function - * \param space namespace to search - * \param exists returns GL_TRUE or GL_FALSE to indicate existance of function - * \return GL_TRUE for success, GL_FALSE if failure (bad function name) - */ -GLboolean -_slang_typeof_function(slang_atom a_name, const slang_operation * params, - GLuint num_params, - const slang_name_space * space, - slang_type_specifier * spec, GLboolean * exists, - slang_atom_pool *atoms, slang_info_log *log) -{ - slang_function *fun = _slang_locate_function(space->funcs, a_name, params, - num_params, space, atoms, log); - *exists = fun != NULL; - if (!fun) - return GL_TRUE; /* yes, not false */ - return slang_type_specifier_copy(spec, &fun->header.type.specifier); -} - - - /** * Determine if a type is a matrix. * \return GL_TRUE if is a matrix, GL_FALSE otherwise. diff --git a/src/mesa/shader/slang/slang_typeinfo.h b/src/mesa/shader/slang/slang_typeinfo.h index f1c9a635b8..12a773dee9 100644 --- a/src/mesa/shader/slang/slang_typeinfo.h +++ b/src/mesa/shader/slang/slang_typeinfo.h @@ -177,18 +177,6 @@ _slang_typeof_operation_(const struct slang_operation_ *, slang_typeinfo *, slang_atom_pool *, slang_info_log *log); -/** - * Retrieves type of a function prototype, if one exists. - * Returns GL_TRUE on success, even if the function was not found. - * Returns GL_FALSE otherwise. - */ -extern GLboolean -_slang_typeof_function(slang_atom a_name, - const struct slang_operation_ *params, - GLuint num_params, const slang_name_space *, - slang_type_specifier *spec, GLboolean *exists, - slang_atom_pool *, slang_info_log *log); - extern GLboolean _slang_type_is_matrix(slang_type_specifier_type); |