Mesa (main): pan/bi: Don't read base for combined stores
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Jan 2 01:41:20 UTC 2022
Module: Mesa
Branch: main
Commit: 996645e4794acc84537b6b69680acfc46620bbcb
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=996645e4794acc84537b6b69680acfc46620bbcb
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Sat Jan 1 10:09:21 2022 -0500
pan/bi: Don't read base for combined stores
`base` is meaningless for combined stores, so don't read it. This allows
us to remove the base index from the intrinsic and simplify the lowering
code generating the combined store intrinsic.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13714>
---
src/panfrost/bifrost/bifrost_compile.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 047ab4fabf9..ba641185f8e 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -574,12 +574,17 @@ bi_emit_fragment_out(bi_builder *b, nir_intrinsic_instr *instr)
bool emit_blend = writeout & (PAN_WRITEOUT_C);
bool emit_zs = writeout & (PAN_WRITEOUT_Z | PAN_WRITEOUT_S);
- const nir_variable *var =
- nir_find_variable_with_driver_location(b->shader->nir,
- nir_var_shader_out, nir_intrinsic_base(instr));
- assert(var);
+ const nir_variable *var = NULL;
+ unsigned loc = ~0;
+
+ if (!combined) {
+ var = nir_find_variable_with_driver_location(b->shader->nir,
+ nir_var_shader_out, nir_intrinsic_base(instr));
+ assert(var);
+
+ loc = var->data.location;
+ }
- unsigned loc = var->data.location;
bi_index src0 = bi_src_index(&instr->src[0]);
/* By ISA convention, the coverage mask is stored in R60. The store
@@ -595,7 +600,7 @@ bi_emit_fragment_out(bi_builder *b, nir_intrinsic_instr *instr)
/* Dual-source blending is implemented by putting the color in
* registers r4-r7. */
- if (var->data.index) {
+ if (var && var->data.index) {
unsigned count = nir_src_num_components(instr->src[0]);
for (unsigned i = 0; i < count; ++i)
@@ -643,9 +648,7 @@ bi_emit_fragment_out(bi_builder *b, nir_intrinsic_instr *instr)
}
if (emit_blend) {
- assert(loc >= FRAG_RESULT_DATA0);
-
- unsigned rt = (loc - FRAG_RESULT_DATA0);
+ unsigned rt = combined ? 0 : (loc - FRAG_RESULT_DATA0);
bi_index color = bi_src_index(&instr->src[0]);
/* Explicit copy since BLEND inputs are precoloured to R0-R3,
More information about the mesa-commit
mailing list