diff --git a/.pick_status.json b/.pick_status.json index 3b57f79db54..62689687c40 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -24,7 +24,7 @@ "description": "panfrost: protect alpha calculation from accessing non-existent component", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index 90020640329..07ca3fba859 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -837,15 +837,18 @@ bi_emit_fragment_out(bi_builder *b, nir_intrinsic_instr *instr) nir_alu_type T = nir_intrinsic_src_type(instr); bi_index rgba = bi_src_index(&instr->src[0]); - bi_index alpha = (T == nir_type_float16) - ? bi_half(bi_extract(b, rgba, 1), true) - : (T == nir_type_float32) ? bi_extract(b, rgba, 3) - : bi_dontcare(b); + bi_index alpha; - /* Don't read out-of-bounds */ - if (nir_src_num_components(instr->src[0]) < 4) + if (nir_src_num_components(instr->src[0]) < 4) { + /* Don't read out-of-bounds */ alpha = bi_imm_f32(1.0); - + } else if (T == nir_type_float16) { + alpha = bi_half(bi_extract(b, rgba, 1), true); + } else if (T == nir_type_float32) { + alpha = bi_extract(b, rgba, 3); + } else { + alpha = bi_dontcare(b); + } bi_emit_atest(b, alpha); }