diff --git a/src/panfrost/compiler/bifrost/bifrost_compile.c b/src/panfrost/compiler/bifrost/bifrost_compile.c index 98312dd6d06..e1d36c974f9 100644 --- a/src/panfrost/compiler/bifrost/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost/bifrost_compile.c @@ -1786,8 +1786,15 @@ bi_emit_intrinsic(bi_builder *b, nir_intrinsic_instr *instr) } case nir_intrinsic_atest_pan: { + unsigned alpha_bit_size = instr->src[1].ssa->bit_size; + assert(alpha_bit_size == 16 || alpha_bit_size == 32); + bi_index coverage = bi_src_index(&instr->src[0]); bi_index alpha = bi_src_index(&instr->src[1]); + + if (alpha_bit_size == 16) + alpha = bi_half(alpha, false); + bi_atest_to(b, dst, coverage, alpha, bi_fau(BIR_FAU_ATEST_PARAM, false)); break; } diff --git a/src/panfrost/compiler/pan_nir_lower_fs_outputs.c b/src/panfrost/compiler/pan_nir_lower_fs_outputs.c index 15be5b62fa0..539e5ded38b 100644 --- a/src/panfrost/compiler/pan_nir_lower_fs_outputs.c +++ b/src/panfrost/compiler/pan_nir_lower_fs_outputs.c @@ -137,7 +137,7 @@ pan_nir_lower_fs_outputs(nir_shader *shader, bool skip_atest) */ nir_def *alpha; if (color0 && glsl_type_is_float_16_32(color0->type)) - alpha = nir_f2f32(b, nir_channel(b, nir_load_var(b, color0), 3)); + alpha = nir_channel(b, nir_load_var(b, color0), 3); else alpha = nir_imm_float(b, 1.0f); @@ -147,7 +147,7 @@ pan_nir_lower_fs_outputs(nir_shader *shader, bool skip_atest) * skipped for pure integer framebuffers, so the issue is moot. */ if (!skip_atest) - coverage = nir_atest_pan(b, coverage, nir_f2f32(b, alpha)); + coverage = nir_atest_pan(b, coverage, alpha); /* We discard depth/stencil writes if early fragment tests is forced. */ if ((out.depth || out.stencil) && !shader->info.fs.early_fragment_tests) {