aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-02-14 21:42:34 -0800
committerJason Ekstrand <[email protected]>2016-03-12 15:48:36 -0800
commite4bebe8a0255dcd8c9910f2cf89894313286df4d (patch)
tree8f1d200be19fdd94c6d4138613bd5e3481b7934c /src
parent066d3c115ec80270bffc4981fadcc7534ca351cd (diff)
nir: Create function parameters in function_impl_create
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 2242317bc8d..cd78475bdb8 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -300,6 +300,26 @@ nir_function_impl_create(nir_function *function)
function->impl = impl;
impl->function = function;
+ impl->num_params = function->num_params;
+ impl->params = ralloc_array(function->shader,
+ nir_variable *, impl->num_params);
+
+ for (unsigned i = 0; i < impl->num_params; i++) {
+ impl->params[i] = rzalloc(function->shader, nir_variable);
+ impl->params[i]->type = function->params[i].type;
+ impl->params[i]->data.mode = nir_var_param;
+ impl->params[i]->data.location = i;
+ }
+
+ if (!glsl_type_is_void(function->return_type)) {
+ impl->return_var = rzalloc(function->shader, nir_variable);
+ impl->return_var->type = function->return_type;
+ impl->return_var->data.mode = nir_var_param;
+ impl->return_var->data.location = -1;
+ } else {
+ impl->return_var = NULL;
+ }
+
return impl;
}