nir: Fix crash in nir_lower_wpos_center().
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 20 May 2016 23:29:44 +0000 (16:29 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 20 May 2016 23:33:24 +0000 (16:33 -0700)
Otherwise we rewrote the fadd to use itself, causing crashes in
validation.  Instead, start after the last use like we should.

A brown paper bag fix.  Fixes crashes in several Vulkan tests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/nir/nir_lower_wpos_center.c

index 0de750365d12a5d26e2c359d61a02b310a2b5fbb..7b70af30146ec261ffff18fc5bd0dc9e5f0e92bb 100644 (file)
@@ -54,7 +54,7 @@ add_half_to_fragcoord(nir_builder *b, nir_intrinsic_instr *intr)
    wpos = nir_fadd(b, wpos, nir_imm_vec4(b, 0.5f, 0.5f, 0.0f, 0.0f));
 
    nir_ssa_def_rewrite_uses_after(&intr->dest.ssa, nir_src_for_ssa(wpos),
-                                  &intr->instr);
+                                  wpos->parent_instr);
 }
 
 static bool