nir/lower_blend: No-op nir_color_mask if no mask
In this usual case, do a quick check to avoid generating 5 useless instructions (mov/vec4 instructions). They'll get copypropped but that creates more work for the optimizer and nir/lower_blend runs in a hot variant path on both Asahi and Panfrost. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Acked-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20016>
This commit is contained in:

committed by
Marge Bot

parent
1fc25c8c79
commit
e664082d35
@@ -503,8 +503,9 @@ nir_lower_blend_store(nir_builder *b, nir_intrinsic_instr *store,
|
||||
blended = nir_blend(b, options, rt, src, options->src1, dst);
|
||||
}
|
||||
|
||||
/* Apply a colormask */
|
||||
blended = nir_color_mask(b, options->rt[rt].colormask, blended, dst);
|
||||
/* Apply a colormask if necessary */
|
||||
if (options->rt[rt].colormask != BITFIELD_MASK(4))
|
||||
blended = nir_color_mask(b, options->rt[rt].colormask, blended, dst);
|
||||
|
||||
const unsigned num_components = glsl_get_vector_elements(var->type);
|
||||
|
||||
|
Reference in New Issue
Block a user