Mesa (master): pan/mdg: Remove writeout case from bytemask_of_read_components
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 10 14:28:48 UTC 2020
Module: Mesa
Branch: master
Commit: 2a5504fb925ab15afac5f84ada58a1e62c085765
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a5504fb925ab15afac5f84ada58a1e62c085765
Author: Icecream95 <ixn at keemail.me>
Date: Sat Jun 6 14:42:18 2020 +1200
pan/mdg: Remove writeout case from bytemask_of_read_components
By setting the swizzle for the fragment color, and setting qmask to ~0
for branches, the special case for writeout branches can be removed
from mir_bytemask_of_read_components_index.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5065>
---
src/panfrost/midgard/midgard_compile.c | 3 +++
src/panfrost/midgard/mir.c | 18 +++---------------
2 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 2d0cb13aa21..010ecd203fb 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -1314,6 +1314,8 @@ emit_fragment_store(compiler_context *ctx, unsigned src, enum midgard_rt_id rt)
ins.src_types[0] = nir_type_uint32;
ins.constants.u32[0] = rt == MIDGARD_ZS_RT ?
0xFF : (rt - MIDGARD_COLOR_RT0) * 0x100;
+ for (int i = 0; i < 4; ++i)
+ ins.swizzle[0][i] = i;
/* Emit the branch */
br = emit_mir_instruction(ctx, ins);
@@ -2236,6 +2238,7 @@ emit_fragment_epilogue(compiler_context *ctx, unsigned rt)
ins.writeout_stencil = br->writeout_stencil;
ins.branch.target_block = ctx->block_count - 1;
ins.constants.u32[0] = br->constants.u32[0];
+ memcpy(&ins.src_types, &br->src_types, sizeof(ins.src_types));
emit_mir_instruction(ctx, ins);
ctx->current_block->epilogue = true;
diff --git a/src/panfrost/midgard/mir.c b/src/panfrost/midgard/mir.c
index 771d600e945..75a4e38fcac 100644
--- a/src/panfrost/midgard/mir.c
+++ b/src/panfrost/midgard/mir.c
@@ -268,20 +268,6 @@ mir_bytemask_of_read_components_single(unsigned *swizzle, unsigned inmask, unsig
uint16_t
mir_bytemask_of_read_components_index(midgard_instruction *ins, unsigned i)
{
- if (ins->compact_branch && ins->writeout && (i == 0)) {
- /* Non-ZS writeout uses all components */
- if (!ins->writeout_depth && !ins->writeout_stencil)
- return 0xFFFF;
-
- /* For ZS-writeout, if both Z and S are written we need two
- * components, otherwise we only need one.
- */
- if (ins->writeout_depth && ins->writeout_stencil)
- return 0xFF;
- else
- return 0xF;
- }
-
/* Conditional branches read one 32-bit component = 4 bytes (TODO: multi branch??) */
if (ins->compact_branch && ins->branch.conditional && (i == 0))
return 0xF;
@@ -289,7 +275,7 @@ mir_bytemask_of_read_components_index(midgard_instruction *ins, unsigned i)
/* ALU ops act componentwise so we need to pay attention to
* their mask. Texture/ldst does not so we don't clamp source
* readmasks based on the writemask */
- unsigned qmask = (ins->type == TAG_ALU_4) ? ins->mask : ~0;
+ unsigned qmask = ~0;
/* Handle dot products and things */
if (ins->type == TAG_ALU_4 && !ins->compact_branch) {
@@ -299,6 +285,8 @@ mir_bytemask_of_read_components_index(midgard_instruction *ins, unsigned i)
if (channel_override)
qmask = mask_of(channel_override);
+ else
+ qmask = ins->mask;
}
return mir_bytemask_of_read_components_single(ins->swizzle[i], qmask,
More information about the mesa-commit
mailing list