Mesa (master): pan/bi: Fix ATEST with pure integers
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jan 11 22:43:58 UTC 2021
Module: Mesa
Branch: master
Commit: d0c35f46afc496208f0c763589c551267202a454
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d0c35f46afc496208f0c763589c551267202a454
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Tue Jan 5 19:08:15 2021 -0500
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 <alyssa.rosenzweig at collabora.com>
Tested-by: Maciej Matuszczyk <maccraft123mc at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8427>
---
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;
More information about the mesa-commit
mailing list