summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-12-30 18:44:19 -0800
committerJason Ekstrand <[email protected]>2016-03-23 15:26:08 -0700
commit5fe8959912f617fd0ada71f6b952e66305f48d67 (patch)
tree7dab5cf8b8247f39123613d803b6fdd97be7c793 /src
parentc4c373f156a0b63a5789c0a8a3a1b641a58aa938 (diff)
nir/clone: Expose nir_constant_clone
Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir.h1
-rw-r--r--src/compiler/nir/nir_clone.c8
2 files changed, 5 insertions, 4 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 75198e806c4..1e91207509e 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2051,6 +2051,7 @@ void nir_print_instr(const nir_instr *instr, FILE *fp);
nir_shader *nir_shader_clone(void *mem_ctx, const nir_shader *s);
nir_function_impl *nir_function_impl_clone(const nir_function_impl *fi);
+nir_constant *nir_constant_clone(const nir_constant *c, nir_variable *var);
#ifdef DEBUG
void nir_validate_shader(nir_shader *shader);
diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c
index 7444dfe6e59..0ef0289504e 100644
--- a/src/compiler/nir/nir_clone.c
+++ b/src/compiler/nir/nir_clone.c
@@ -109,8 +109,8 @@ remap_var(clone_state *state, const nir_variable *var)
return _lookup_ptr(state, var, nir_variable_is_global(var));
}
-static nir_constant *
-clone_constant(clone_state *state, const nir_constant *c, nir_variable *nvar)
+nir_constant *
+nir_constant_clone(const nir_constant *c, nir_variable *nvar)
{
nir_constant *nc = ralloc(nvar, nir_constant);
@@ -118,7 +118,7 @@ clone_constant(clone_state *state, const nir_constant *c, nir_variable *nvar)
nc->num_elements = c->num_elements;
nc->elements = ralloc_array(nvar, nir_constant *, c->num_elements);
for (unsigned i = 0; i < c->num_elements; i++) {
- nc->elements[i] = clone_constant(state, c->elements[i], nvar);
+ nc->elements[i] = nir_constant_clone(c->elements[i], nvar);
}
return nc;
@@ -142,7 +142,7 @@ clone_variable(clone_state *state, const nir_variable *var)
var->num_state_slots * sizeof(nir_state_slot));
if (var->constant_initializer) {
nvar->constant_initializer =
- clone_constant(state, var->constant_initializer, nvar);
+ nir_constant_clone(var->constant_initializer, nvar);
}
nvar->interface_type = var->interface_type;