ir3/lower_tex_prefetch: Fix crash with lowered load_barycentric_at_offset
ir3_nir_lower_tex_prefetch
expects src0 of load_interpolated_input
to
be intrinsic, however this assumption broke when src0 is
load_barycentric_at_offset
and is lowered in series of alu instructions.
32x2 %1121 = @load_barycentric_at_offset (%1120) (interp_mode=0)
32x4 %1118 = @load_interpolated_input (%1121, %1116 (0x0)) ...
32x2 %32 = vec2 %1118.x, %1118.y
32x4 %37 = (float32)tex %36 (texture_handle), %34 (sampler_handle), %32 (coord), 0 (texture), 0 (sampler)
is lowered into:
[...]
32 %54 = ffma %46.y, %52, %50
32 %55 = ffma %46.y, %53, %51
32x2 %56 = vec2 %54, %55
32x4 %57 = @load_interpolated_input (%56, %25 (0x0))
[...]
Crash backtrace:
#5 in __GI___assert_fail (assertion=0x7ff6692328 "parent && parent->type == nir_instr_type_intrinsic",
file=0x7ff66921c8 "nir.h", line=2536, function=0x7ff6692630 <__PRETTY_FUNCTION__.13> "nir_instr_as_intrinsic")
at assert.c:101
#6 in nir_instr_as_intrinsic (parent=0x7fd4b648e8) at nir.h:2536
#7 in coord_offset (ssa=0x7fd4b649d0) at ir3_nir_lower_tex_prefetch.c:77
#8 in coord_offset (ssa=0x7fd4b64a90) at ir3_nir_lower_tex_prefetch.c:48
#9 in ir3_nir_coord_offset (ssa=0x7fd4b64a90) at ir3_nir_lower_tex_prefetch.c:104
#10 in lower_tex_prefetch_block (block=0x7fd482c100) at ir3_nir_lower_tex_prefetch.c:185
#11 in lower_tex_prefetch_func (impl=0x7fd4aa0890) at ir3_nir_lower_tex_prefetch.c:218
#12 in ir3_nir_lower_tex_prefetch (shader=0x7fd4942b10) at ir3_nir_lower_tex_prefetch.c:242
Cc: mesa-stable