aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_sweep.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-11-03 09:18:19 +1100
committerTimothy Arceri <[email protected]>2016-11-03 10:39:13 +1100
commit903e5eae974c125c2605fad465f7cf6863143199 (patch)
tree86caab8c65a346479fddb1635b8c3cc03609fbf0 /src/compiler/nir/nir_sweep.c
parentf304aca54204fab2dd674a07f4bf13a6a1581c20 (diff)
nir: fix nir_shader_clone() and nir_sweep()
These were broken in e1af20f18a8 when the info field in nir_shader was turned into a pointer. Clone was copying the pointer rather than the data and nir_sweep was cleaning up shader_info rather than claiming it. Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_sweep.c')
-rw-r--r--src/compiler/nir/nir_sweep.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_sweep.c b/src/compiler/nir/nir_sweep.c
index faf696d6dec..e6ae298dd36 100644
--- a/src/compiler/nir/nir_sweep.c
+++ b/src/compiler/nir/nir_sweep.c
@@ -150,9 +150,17 @@ nir_sweep(nir_shader *nir)
{
void *rubbish = ralloc_context(NULL);
+ /* The shader may not own shader_info so check first */
+ bool steal_info = false;
+ if (nir == ralloc_parent(nir->info))
+ steal_info = true;
+
/* First, move ownership of all the memory to a temporary context; assume dead. */
ralloc_adopt(rubbish, nir);
+ if (steal_info)
+ ralloc_steal(nir, nir->info);
+
ralloc_steal(nir, (char *)nir->info->name);
if (nir->info->label)
ralloc_steal(nir, (char *)nir->info->label);