diff options
author | Jason Ekstrand <[email protected]> | 2017-11-11 15:44:23 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-11-27 16:22:11 -0800 |
commit | 86becfd2de3feed66d41350c828391524a7b4052 (patch) | |
tree | a0cced78a0424b3b1681e79e305c95d1a537c0e0 | |
parent | dc21c3937c603eeb097327c080b9b70f224ce23b (diff) |
intel/blorp: Add fast-clear to the special case in MSAA resolves
This doesn't go all the way of avoiding the txf_ms if it's fast-cleared,
however it does at least make us only do it once. This should improve
performance of MSAA resolves in the presence of lots of clear color.
Without the patch, enabling fast-clears in the multisampling Sascha demo
drops the framerate by about 10%. With this patch, enabling fast-clears
increases the demo's framerate by 25%.
Reviewed-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Nanley Chery <[email protected]>
-rw-r--r-- | src/intel/blorp/blorp_blit.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c index 19f6c363f1e..d119a99b31f 100644 --- a/src/intel/blorp/blorp_blit.c +++ b/src/intel/blorp/blorp_blit.c @@ -21,7 +21,7 @@ * IN THE SOFTWARE. */ -#include "compiler/nir/nir_builder.h" +#include "blorp_nir_builder.h" #include "blorp_priv.h" @@ -680,6 +680,11 @@ blorp_nir_manual_blend_average(nir_builder *b, struct brw_blorp_blit_vars *v, * ld2dms are equivalent (since all samples are on sample slice 0). * Since we have already sampled from sample 0, all we need to do is * skip the remaining fetches and averaging if MCS is zero. + * + * It's also trivial to detect when the MCS has the magic clear color + * value. In this case, the txf we did on sample 0 will return the + * clear color and we can skip the remaining fetches just like we do + * when MCS == 0. */ nir_ssa_def *mcs_zero = nir_ieq(b, nir_channel(b, mcs, 0), nir_imm_int(b, 0)); @@ -687,9 +692,11 @@ blorp_nir_manual_blend_average(nir_builder *b, struct brw_blorp_blit_vars *v, mcs_zero = nir_iand(b, mcs_zero, nir_ieq(b, nir_channel(b, mcs, 1), nir_imm_int(b, 0))); } + nir_ssa_def *mcs_clear = + blorp_nir_mcs_is_clear_color(b, mcs, tex_samples); nir_if *if_stmt = nir_if_create(b->shader); - if_stmt->condition = nir_src_for_ssa(mcs_zero); + if_stmt->condition = nir_src_for_ssa(nir_ior(b, mcs_zero, mcs_clear)); nir_cf_node_insert(b->cursor, &if_stmt->cf_node); b->cursor = nir_after_cf_list(&if_stmt->then_list); |