summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_compile_function.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/shader/slang/slang_compile_function.c')
-rw-r--r--src/mesa/shader/slang/slang_compile_function.c33
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;