summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_clone.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-03-23 15:05:55 -0700
committerJason Ekstrand <[email protected]>2016-03-23 15:26:11 -0700
commitf849f53990c613a28c32826d09005e127adedeac (patch)
treed7dac108b1d1daa7d06170e4e833a937fa553eb8 /src/compiler/nir/nir_clone.c
parent5fe8959912f617fd0ada71f6b952e66305f48d67 (diff)
nir/clone: Export nir_variable_clone
Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_clone.c')
-rw-r--r--src/compiler/nir/nir_clone.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c
index 0ef0289504e..a721552f6a6 100644
--- a/src/compiler/nir/nir_clone.c
+++ b/src/compiler/nir/nir_clone.c
@@ -127,11 +127,10 @@ nir_constant_clone(const nir_constant *c, nir_variable *nvar)
/* NOTE: for cloning nir_variable's, bypass nir_variable_create to avoid
* having to deal with locals and globals separately:
*/
-static nir_variable *
-clone_variable(clone_state *state, const nir_variable *var)
+nir_variable *
+nir_variable_clone(const nir_variable *var, nir_shader *shader)
{
- nir_variable *nvar = rzalloc(state->ns, nir_variable);
- add_remap(state, nvar, var);
+ nir_variable *nvar = rzalloc(shader, nir_variable);
nvar->type = var->type;
nvar->name = ralloc_strdup(nvar, var->name);
@@ -149,6 +148,15 @@ clone_variable(clone_state *state, const nir_variable *var)
return nvar;
}
+static nir_variable *
+clone_variable(clone_state *state, const nir_variable *var)
+{
+ nir_variable *nvar = nir_variable_clone(var, state->ns);
+ add_remap(state, nvar, var);
+
+ return nvar;
+}
+
/* clone list of nir_variable: */
static void
clone_var_list(clone_state *state, struct exec_list *dst,