Skip to content

Commit cbfb7e9

Browse files
werman1ace
authored andcommitted
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 Signed-off-by: Danylo Piliaiev <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25096> (cherry picked from commit b16472f)
1 parent e7cf3b3 commit cbfb7e9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.pick_status.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@
841841
"description": "ir3/lower_tex_prefetch: Fix crash with lowered load_barycentric_at_offset",
842842
"nominated": true,
843843
"nomination_type": 0,
844-
"resolution": 0,
844+
"resolution": 1,
845845
"main_sha": null,
846846
"because_sha": null
847847
},

src/freedreno/ir3/ir3_nir_lower_tex_prefetch.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ coord_offset(nir_ssa_def *ssa)
8585
if (!input->src[0].is_ssa)
8686
return -1;
8787

88+
/* Happens with lowered load_barycentric_at_offset */
89+
if (input->src[0].ssa->parent_instr->type != nir_instr_type_intrinsic)
90+
return -1;
91+
8892
nir_intrinsic_instr *interp =
8993
nir_instr_as_intrinsic(input->src[0].ssa->parent_instr);
9094

0 commit comments

Comments
 (0)