From c22801841ce9415f5a34b86a62e43cf38ef70d66 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 12 Dec 2008 10:22:47 -0700 Subject: [PATCH] mesa: glsl compiler function renaming (cherry picked from commit 456a4e274ff60122ab7e23dad2d462be3d910599) --- src/mesa/shader/slang/slang_codegen.c | 26 ++++++++++++------------- src/mesa/shader/slang/slang_compile.c | 6 +++--- src/mesa/shader/slang/slang_compile_function.c | 4 ++-- src/mesa/shader/slang/slang_compile_function.h | 10 +++++----- src/mesa/shader/slang/slang_compile_operation.c | 2 +- src/mesa/shader/slang/slang_compile_variable.c | 2 +- src/mesa/shader/slang/slang_compile_variable.h | 2 +- src/mesa/shader/slang/slang_print.c | 4 ++-- src/mesa/shader/slang/slang_simplify.c | 2 +- src/mesa/shader/slang/slang_typeinfo.c | 6 +++--- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 8a682cd..9a5980c 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -791,7 +791,7 @@ static void slang_resolve_variable(slang_operation *oper) { if (oper->type == SLANG_OPER_IDENTIFIER && !oper->var) { - oper->var = _slang_locate_variable(oper->locals, oper->a_id, GL_TRUE); + oper->var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); } } @@ -807,7 +807,7 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper, switch (oper->type) { case SLANG_OPER_VARIABLE_DECL: { - slang_variable *v = _slang_locate_variable(oper->locals, + slang_variable *v = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); assert(v); if (v->initializer && oper->num_children == 0) { @@ -829,7 +829,7 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper, slang_atom id = oper->a_id; slang_variable *v; GLuint i; - v = _slang_locate_variable(oper->locals, id, GL_TRUE); + v = _slang_variable_locate(oper->locals, id, GL_TRUE); if (!v) { _mesa_problem(NULL, "var %s not found!\n", (char *) oper->a_id); return; @@ -1771,7 +1771,7 @@ static slang_function * _slang_make_struct_constructor(slang_assemble_ctx *A, slang_struct *str) { const GLint numFields = str->fields->num_variables; - slang_function *fun = slang_new_function(SLANG_FUNC_CONSTRUCTOR); + slang_function *fun = slang_function_new(SLANG_FUNC_CONSTRUCTOR); /* function header (name, return type) */ fun->header.a_name = str->a_name; @@ -1930,7 +1930,7 @@ _slang_locate_struct_constructor(slang_assemble_ctx *A, const char *name) static slang_function * _slang_make_array_constructor(slang_assemble_ctx *A, slang_operation *oper) { - slang_function *fun = slang_new_function(SLANG_FUNC_CONSTRUCTOR); + slang_function *fun = slang_function_new(SLANG_FUNC_CONSTRUCTOR); if (fun) { slang_type_specifier_type baseType = slang_type_specifier_type_from_string((char *) oper->a_id); @@ -1992,7 +1992,7 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name, } else { /* Try to find function by name and exact argument type matching */ - fun = _slang_locate_function(A->space.funcs, atom, params, param_count, + fun = _slang_function_locate(A->space.funcs, atom, params, param_count, &A->space, A->atoms, A->log, &error); } @@ -2108,7 +2108,7 @@ _slang_gen_method_call(slang_assemble_ctx *A, slang_operation *oper) } /* lookup the object/variable */ - var = _slang_locate_variable(oper->locals, oper->a_obj, GL_TRUE); + var = _slang_variable_locate(oper->locals, oper->a_obj, GL_TRUE); if (!var || var->type.specifier.type != SLANG_SPEC_ARRAY) { slang_info_log_error(A->log, "Undefined object '%s'", (char *) oper->a_obj); @@ -2804,8 +2804,8 @@ _slang_gen_return(slang_assemble_ctx * A, slang_operation *oper) #if 1 /* DEBUG */ { - slang_variable *v - = _slang_locate_variable(oper->locals, a_retVal, GL_TRUE); + slang_variable *v = + _slang_variable_locate(oper->locals, a_retVal, GL_TRUE); if (!v) { /* trying to return a value in a void-valued function */ return NULL; @@ -2846,7 +2846,7 @@ _slang_is_constant_expr(const slang_operation *oper) switch (oper->type) { case SLANG_OPER_IDENTIFIER: - var = _slang_locate_variable(oper->locals, oper->a_id, GL_TRUE); + var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); if (var && var->type.qualifier == SLANG_QUAL_CONST) return GL_TRUE; return GL_FALSE; @@ -2936,7 +2936,7 @@ _slang_gen_declaration(slang_assemble_ctx *A, slang_operation *oper) assert(oper->num_children <= 1); /* lookup the variable by name */ - var = _slang_locate_variable(oper->locals, oper->a_id, GL_TRUE); + var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); if (!var) return NULL; /* "shouldn't happen" */ @@ -3003,7 +3003,7 @@ _slang_gen_variable(slang_assemble_ctx * A, slang_operation *oper) * use it. Otherwise, use the oper's var id. */ slang_atom name = oper->var ? oper->var->a_name : oper->a_id; - slang_variable *var = _slang_locate_variable(oper->locals, name, GL_TRUE); + slang_variable *var = _slang_variable_locate(oper->locals, name, GL_TRUE); slang_ir_node *n = new_var(A, var); if (!n) { slang_info_log_error(A->log, "undefined variable '%s'", (char *) name); @@ -3073,7 +3073,7 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper) if (oper->children[0].type == SLANG_OPER_IDENTIFIER) { /* Check that var is writeable */ slang_variable *var - = _slang_locate_variable(oper->children[0].locals, + = _slang_variable_locate(oper->children[0].locals, oper->children[0].a_id, GL_TRUE); if (!var) { slang_info_log_error(A->log, "undefined variable '%s'", diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index d8291b2..aef874b 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -300,7 +300,7 @@ parse_array_len(slang_parse_ctx * C, slang_output_ctx * O, GLuint * len) result = GL_TRUE; *len = (GLint) array_size.literal[0]; } else if (array_size.type == SLANG_OPER_IDENTIFIER) { - slang_variable *var = _slang_locate_variable(array_size.locals, array_size.a_id, GL_TRUE); + slang_variable *var = _slang_variable_locate(array_size.locals, array_size.a_id, GL_TRUE); if (!var) { slang_info_log_error(C->L, "undefined variable '%s'", (char *) array_size.a_id); @@ -425,7 +425,7 @@ parse_struct_field(slang_parse_ctx * C, slang_output_ctx * O, RETURN0; } a_name = parse_identifier(C); - if (_slang_locate_variable(st->fields, a_name, GL_FALSE)) { + if (_slang_variable_locate(st->fields, a_name, GL_FALSE)) { slang_info_log_error(C->L, "duplicate field '%s'", (char *) a_name); RETURN0; } @@ -1953,7 +1953,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, a_name = parse_identifier(C); /* check if name is already in this scope */ - if (_slang_locate_variable(O->vars, a_name, GL_FALSE)) { + if (_slang_variable_locate(O->vars, a_name, GL_FALSE)) { slang_info_log_error(C->L, "declaration of '%s' conflicts with previous declaration", (char *) a_name); diff --git a/src/mesa/shader/slang/slang_compile_function.c b/src/mesa/shader/slang/slang_compile_function.c index 72132ac..ba65be5 100644 --- a/src/mesa/shader/slang/slang_compile_function.c +++ b/src/mesa/shader/slang/slang_compile_function.c @@ -67,7 +67,7 @@ slang_function_destruct(slang_function * func) slang_function * -slang_new_function(slang_function_kind kind) +slang_function_new(slang_function_kind kind) { slang_function *fun = (slang_function *) _mesa_malloc(sizeof(slang_function)); @@ -195,7 +195,7 @@ slang_function_scope_find(slang_function_scope * funcs, slang_function * fun, * Lookup a function according to name and parameter count/types. */ slang_function * -_slang_locate_function(const slang_function_scope * funcs, slang_atom a_name, +_slang_function_locate(const slang_function_scope * funcs, slang_atom a_name, slang_operation * args, GLuint num_args, const slang_name_space * space, slang_atom_pool * atoms, slang_info_log *log, GLboolean *error) diff --git a/src/mesa/shader/slang/slang_compile_function.h b/src/mesa/shader/slang/slang_compile_function.h index 5a432d4..a5445ec 100644 --- a/src/mesa/shader/slang/slang_compile_function.h +++ b/src/mesa/shader/slang/slang_compile_function.h @@ -51,7 +51,10 @@ typedef struct slang_function_ extern int slang_function_construct(slang_function *); extern void slang_function_destruct(slang_function *); -extern slang_function *slang_new_function(slang_function_kind kind); +extern slang_function *slang_function_new(slang_function_kind kind); + +extern GLboolean +_slang_function_has_return_value(const slang_function *fun); /** @@ -71,9 +74,6 @@ _slang_function_scope_ctr(slang_function_scope *); extern void slang_function_scope_destruct(slang_function_scope *); -extern GLboolean -_slang_function_has_return_value(const slang_function *fun); - extern int slang_function_scope_find_by_name(slang_function_scope *, slang_atom, int); @@ -81,7 +81,7 @@ extern slang_function * slang_function_scope_find(slang_function_scope *, slang_function *, int); extern struct slang_function_ * -_slang_locate_function(const struct slang_function_scope_ *funcs, +_slang_function_locate(const struct slang_function_scope_ *funcs, slang_atom name, struct slang_operation_ *params, GLuint num_params, const struct slang_name_space_ *space, diff --git a/src/mesa/shader/slang/slang_compile_operation.c b/src/mesa/shader/slang/slang_compile_operation.c index ecec2d8..e650616 100644 --- a/src/mesa/shader/slang/slang_compile_operation.c +++ b/src/mesa/shader/slang/slang_compile_operation.c @@ -91,7 +91,7 @@ slang_replace_scope(slang_operation *oper, if (oper->type == SLANG_OPER_VARIABLE_DECL) { /* search/replace in the initializer */ slang_variable *var; - var = _slang_locate_variable(oper->locals, oper->a_id, GL_TRUE); + var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); if (var && var->initializer) { slang_replace_scope(var->initializer, oldScope, newScope); } diff --git a/src/mesa/shader/slang/slang_compile_variable.c b/src/mesa/shader/slang/slang_compile_variable.c index 57fe058..18e0f91 100644 --- a/src/mesa/shader/slang/slang_compile_variable.c +++ b/src/mesa/shader/slang/slang_compile_variable.c @@ -232,7 +232,7 @@ slang_variable_copy(slang_variable * x, const slang_variable * y) * \param all if true, search parent scopes too. */ slang_variable * -_slang_locate_variable(const slang_variable_scope * scope, +_slang_variable_locate(const slang_variable_scope * scope, const slang_atom a_name, GLboolean all) { while (scope) { diff --git a/src/mesa/shader/slang/slang_compile_variable.h b/src/mesa/shader/slang/slang_compile_variable.h index 4366391..4a33dcc 100644 --- a/src/mesa/shader/slang/slang_compile_variable.h +++ b/src/mesa/shader/slang/slang_compile_variable.h @@ -83,7 +83,7 @@ extern int slang_variable_copy(slang_variable *, const slang_variable *); extern slang_variable * -_slang_locate_variable(const slang_variable_scope *, const slang_atom a_name, +_slang_variable_locate(const slang_variable_scope *, const slang_atom a_name, GLboolean all); diff --git a/src/mesa/shader/slang/slang_print.c b/src/mesa/shader/slang/slang_print.c index 1194d0b..bf1475f 100644 --- a/src/mesa/shader/slang/slang_print.c +++ b/src/mesa/shader/slang/slang_print.c @@ -278,7 +278,7 @@ slang_print_tree(const slang_operation *op, int indent) assert(op->num_children == 0 || op->num_children == 1); { slang_variable *v; - v = _slang_locate_variable(op->locals, op->a_id, GL_TRUE); + v = _slang_variable_locate(op->locals, op->a_id, GL_TRUE); if (v) { const slang_variable_scope *scope; spaces(indent); @@ -636,7 +636,7 @@ slang_print_tree(const slang_operation *op, int indent) case SLANG_OPER_CALL: #if 0 slang_function *fun - = _slang_locate_function(A->space.funcs, oper->a_id, + = _slang_function_locate(A->space.funcs, oper->a_id, oper->children, oper->num_children, &A->space, A->atoms); #endif diff --git a/src/mesa/shader/slang/slang_simplify.c b/src/mesa/shader/slang/slang_simplify.c index 6ef95c4..969130b 100644 --- a/src/mesa/shader/slang/slang_simplify.c +++ b/src/mesa/shader/slang/slang_simplify.c @@ -135,7 +135,7 @@ _slang_simplify(slang_operation *oper, /* look for user-defined constant */ { slang_variable *var; - var = _slang_locate_variable(oper->locals, oper->a_id, GL_TRUE); + var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); if (var) { if (var->type.qualifier == SLANG_QUAL_CONST && var->initializer && diff --git a/src/mesa/shader/slang/slang_typeinfo.c b/src/mesa/shader/slang/slang_typeinfo.c index 4ccd946..2006c7e 100644 --- a/src/mesa/shader/slang/slang_typeinfo.c +++ b/src/mesa/shader/slang/slang_typeinfo.c @@ -425,7 +425,7 @@ _slang_typeof_function(slang_atom a_name, { GLboolean error; - *funFound = _slang_locate_function(space->funcs, a_name, params, + *funFound = _slang_function_locate(space->funcs, a_name, params, num_params, space, atoms, log, &error); if (error) return GL_FALSE; @@ -589,7 +589,7 @@ _slang_typeof_operation_(slang_operation * op, case SLANG_OPER_VARIABLE_DECL: { slang_variable *var; - var = _slang_locate_variable(op->locals, op->a_id, GL_TRUE); + var = _slang_variable_locate(op->locals, op->a_id, GL_TRUE); if (!var) { slang_info_log_error(log, "undefined variable '%s'", (char *) op->a_id); @@ -770,7 +770,7 @@ _slang_typeof_operation_(slang_operation * op, if (_ti.spec.type == SLANG_SPEC_STRUCT) { slang_variable *field; - field = _slang_locate_variable(_ti.spec._struct->fields, op->a_id, + field = _slang_variable_locate(_ti.spec._struct->fields, op->a_id, GL_FALSE); if (field == NULL) { slang_typeinfo_destruct(&_ti); -- 2.7.4