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: 49f38aa9e7 ("pan/bi: Implement fragment_out by builder")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Maciej Matuszczyk <maccraft123mc@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8427>
This commit is contained in:
Alyssa Rosenzweig 2021-01-05 19:08:15 -05:00 committed by Marge Bot
parent bf7fe30436
commit d0c35f46af
1 changed files with 8 additions and 3 deletions

View File

@ -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;