diff options
author | Brian <brian@yutani.localnet.net> | 2006-12-13 14:48:36 -0700 |
---|---|---|
committer | Brian <brian@yutani.localnet.net> | 2006-12-13 14:48:36 -0700 |
commit | aff8e204d205b5d424d2c39a5d9e004caaa1eab1 (patch) | |
tree | 91d06d422f8900af461233186bcc79351c3025f6 /src/mesa/shader/slang/slang_compile_function.c | |
parent | 5b35132b41427798e02a66a8e39583fffbe9d232 (diff) |
Checkpoint new GLSL compiler back-end to produce fp/vp-style assembly instructions.
Diffstat (limited to 'src/mesa/shader/slang/slang_compile_function.c')
-rw-r--r-- | src/mesa/shader/slang/slang_compile_function.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/mesa/shader/slang/slang_compile_function.c b/src/mesa/shader/slang/slang_compile_function.c index e6e0d89ddb..58a453d4c2 100644 --- a/src/mesa/shader/slang/slang_compile_function.c +++ b/src/mesa/shader/slang/slang_compile_function.c @@ -86,6 +86,7 @@ slang_function_construct(slang_function * func) func->param_count = 0; func->body = NULL; func->address = ~0; + func->end_label = 0; slang_fixup_table_init(&func->fixups); return 1; } @@ -127,6 +128,16 @@ slang_function_scope_destruct(slang_function_scope * scope) /** + * Does this function have a non-void return value? + */ +GLboolean +_slang_function_has_return_value(const slang_function *fun) +{ + return fun->header.type.specifier.type != slang_spec_void; +} + + +/** * Search a list of functions for a particular function by name. * \param funcs the list of functions to search * \param a_name the name to search for @@ -166,21 +177,39 @@ slang_function_scope_find(slang_function_scope * funcs, slang_function * fun, for (i = 0; i < funcs->num_functions; i++) { slang_function *f = &funcs->functions[i]; + const GLuint haveRetValue = 0; +#if 0 + = (f->header.type.specifier.type != slang_spec_void); +#endif unsigned int j; + /* + printf("Compare name %s to %s (ret %u, %d, %d)\n", + (char *) fun->header.a_name, (char *) f->header.a_name, + haveRetValue, + fun->param_count, f->param_count); + */ + if (fun->header.a_name != f->header.a_name) continue; if (fun->param_count != f->param_count) continue; - for (j = 0; j < fun->param_count; j++) { + for (j = haveRetValue; j < fun->param_count; j++) { if (!slang_type_specifier_equal (&fun->parameters->variables[j].type.specifier, &f->parameters->variables[j].type.specifier)) break; } - if (j == fun->param_count) + if (j == fun->param_count) { + /* + printf("Found match\n"); + */ return f; + } } + /* + printf("Not found\n"); + */ if (all_scopes && funcs->outer_scope != NULL) return slang_function_scope_find(funcs->outer_scope, fun, 1); return NULL; |