mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-18 08:38:21 +02:00
aco: fix emitting discard when the program just ends
For fragment shaders that only contain a discard, the exec mask has
to be zero'd and everything discarded.
It seems unnecessary to emit an export here because if the FS has no
exports, the compiler already emits a null export at the end.
Fixes incorrect hair rendering in Detroit: Become Human.
fossil-db (Sienna Cichlid):
Totals from 3 (0.00% of 149839) affected shaders:
CodeSize: 2896 -> 2872 (-0.83%)
Instrs: 556 -> 553 (-0.54%)
Latency: 29266 -> 29214 (-0.18%)
InvThroughput: 3374 -> 3372 (-0.06%)
Cc: 21.1 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10955>
(cherry picked from commit 729ebe4b17)
This commit is contained in:
parent
8bb7b88858
commit
be1dcc875a
2 changed files with 3 additions and 6 deletions
|
|
@ -598,7 +598,7 @@
|
|||
"description": "aco: fix emitting discard when the program just ends",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5297,11 +5297,8 @@ void visit_discard(isel_context* ctx, nir_intrinsic_instr *instr)
|
|||
*/
|
||||
if (!ctx->cf_info.parent_if.is_divergent) {
|
||||
/* program just ends here */
|
||||
ctx->block->kind |= block_kind_uniform;
|
||||
bld.exp(aco_opcode::exp, Operand(v1), Operand(v1), Operand(v1), Operand(v1),
|
||||
0 /* enabled mask */, 9 /* dest */,
|
||||
false /* compressed */, true/* done */, true /* valid mask */);
|
||||
bld.sopp(aco_opcode::s_endpgm);
|
||||
ctx->block->kind |= block_kind_uses_discard_if;
|
||||
bld.pseudo(aco_opcode::p_discard_if, Operand(0xFFFFFFFFu));
|
||||
// TODO: it will potentially be followed by a branch which is dead code to sanitize NIR phis
|
||||
} else {
|
||||
ctx->block->kind |= block_kind_discard;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue