[Mesa-dev] [PATCH 04/21] nir: Create function parameters in function_impl_create

Jason Ekstrand jason at jlekstrand.net
Sun Feb 14 02:14:21 UTC 2016


---
 src/compiler/nir/nir.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 0e4d981..cd78475 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -304,6 +304,22 @@ nir_function_impl_create(nir_function *function)
    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;
 }
 
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list