nir: Fix crash in nir_lower_drawpixels.
authorEric Anholt <eric@anholt.net>
Fri, 19 Aug 2016 22:38:08 +0000 (15:38 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 22 Aug 2016 18:52:27 +0000 (11:52 -0700)
Generally you'd see the gl_Color reference first and get some cursor set.
However, in piglit draw-pixel-with-texture we're now seeing the TexCoord
dereferenced first.

Reviewed-by: Rob Clark <robdclark@gmail.com>
src/compiler/nir/nir_lower_drawpixels.c

index a71bccddfb07e1a62496e864e5fe4f6dc681d641..54f3ea08aadb01134cb3e375861f5274690a2ff7 100644 (file)
@@ -194,6 +194,8 @@ lower_color(lower_drawpixels_state *state, nir_intrinsic_instr *intr)
 static void
 lower_texcoord(lower_drawpixels_state *state, nir_intrinsic_instr *intr)
 {
+   state->b.cursor = nir_before_instr(&intr->instr);
+
    nir_ssa_def *texcoord_const = get_texcoord_const(state);
    nir_ssa_def_rewrite_uses(&intr->dest.ssa, nir_src_for_ssa(texcoord_const));
 }