freedreno/ir3: fix fallout of extra assert
authorRob Clark <robdclark@gmail.com>
Fri, 21 Dec 2018 23:47:26 +0000 (18:47 -0500)
committerRob Clark <robdclark@gmail.com>
Sat, 22 Dec 2018 00:04:22 +0000 (19:04 -0500)
Fixes the following crash that happened after d6110d4d

The problem happens if we first compile a "vanilla" shader with nothing
lowered in NIR, which perform the final lowering passes on so->shader->
nir (including nir_lower_locals_to_regs()), and then later we have
compile a shader with some lowering.  The second time through we would
have already done nir_lower_locals_to_regs().

Arguably this was already a bug, just one we hadn't noticed yet.

Fixes: d6110d4d547 intel/compiler: move nir_lower_bool_to_int32 before nir_lower_locals_to_regs
Signed-off-by: Rob Clark <robdclark@gmail.com>
src/freedreno/ir3/ir3_context.c

index bba41377525a67d3879a440e37c964201c510cf4..c2d01666cffa60e474a137dc90ab6d43fc582835 100644 (file)
@@ -71,7 +71,7 @@ ir3_context_init(struct ir3_compiler *compiler,
                ctx->s = ir3_optimize_nir(so->shader, s, &so->key);
        } else {
                /* fast-path for shader key that lowers nothing in NIR: */
-               ctx->s = so->shader->nir;
+               ctx->s = nir_shader_clone(ctx, so->shader->nir);
        }
 
        /* this needs to be the last pass run, so do this here instead of