From d0c35f46afc496208f0c763589c551267202a454 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 5 Jan 2021 19:08:15 -0500 Subject: [PATCH] pan/bi: Fix ATEST with pure integers It doesn't matter what we pass due to a subtlety in the spec but the assert is still wrong. Fixes: 49f38aa9e79 ("pan/bi: Implement fragment_out by builder") Signed-off-by: Alyssa Rosenzweig Tested-by: Maciej Matuszczyk Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 7749574674e..589ead1e4d4 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -355,13 +355,18 @@ bi_emit_fragment_out(bi_builder *b, nir_intrinsic_instr *instr) nir_var_shader_out, nir_intrinsic_base(instr)); assert(var); + /* Emit ATEST if we have to, note ATEST requires a floating-point alpha + * value, but render target #0 might not be floating point. However the + * alpha value is only used for alpha-to-coverage, a stage which is + * skipped for pure integer framebuffers, so the issue is moot. */ if (!b->shader->emitted_atest && !b->shader->is_blend) { nir_alu_type T = nir_intrinsic_src_type(instr); - assert(T == nir_type_float16 || T == nir_type_float32); bi_index rgba = bi_src_index(&instr->src[0]); - bi_index alpha = (T == nir_type_float32) ? bi_word(rgba, 3) : - bi_half(bi_word(rgba, 1), true) ; + bi_index alpha = + (T == nir_type_float16) ? bi_half(bi_word(rgba, 1), true) : + (T == nir_type_float32) ? bi_word(rgba, 3) : + bi_dontcare(); bi_atest_to(b, bi_register(60), bi_register(60), alpha); b->shader->emitted_atest = true;