From 407db929f90d4e353545a9df86982ec97f47919a Mon Sep 17 00:00:00 2001 From: Italo Nicola Date: Wed, 8 Dec 2021 03:34:29 -0300 Subject: [PATCH] shader: Make surface_component_bits conditional on logicops This shader key field is only used if logic ops are enabled, so we can gain a little bit of performance by avoid unnecessary recompilation here. Signed-off-by: Italo Nicola Reviewed-by: Gert Wollny --- src/vrend_renderer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 6dc03b4..53c52d0 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -3557,7 +3557,10 @@ static inline void vrend_fill_shader_key(struct vrend_sub_context *sub_ctx, key->fs.cbufs_signed_int_bitmask, key->fs.cbufs_unsigned_int_bitmask); } - key->fs.surface_component_bits[i] = util_format_get_component_bits(sub_ctx->surf[i]->format, UTIL_FORMAT_COLORSPACE_RGB, 0); + /* Currently we only use this information if logicop_enable is set */ + if (sub_ctx->blend_state.logicop_enable) { + key->fs.surface_component_bits[i] = util_format_get_component_bits(sub_ctx->surf[i]->format, UTIL_FORMAT_COLORSPACE_RGB, 0); + } } }