From a7c671efc6f81ea3c968daaab178a04f3eef3389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 15 Nov 2024 15:14:40 -0500 Subject: [PATCH] nir/opt_varyings: fix packing color varyings BITSET_TEST_RANGE_INSIDE_WORD uses first_bit .. last_bit, same as BITSET_RANGE, not first_bit .. size like BITFIELD_RANGE. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_opt_varyings.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/compiler/nir/nir_opt_varyings.c b/src/compiler/nir/nir_opt_varyings.c index 311a31041ec..0a190355c4b 100644 --- a/src/compiler/nir/nir_opt_varyings.c +++ b/src/compiler/nir/nir_opt_varyings.c @@ -4173,13 +4173,16 @@ compact_varyings(struct linkage_info *linkage, /* Set whether the shader contains any color varyings. */ unsigned col0 = VARYING_SLOT_COL0 * 8; bool has_colors = - !BITSET_TEST_RANGE_INSIDE_WORD(linkage->interp_fp32_mask, col0, 16, - 0) || - !BITSET_TEST_RANGE_INSIDE_WORD(linkage->convergent32_mask, col0, 16, - 0) || - !BITSET_TEST_RANGE_INSIDE_WORD(linkage->color32_mask, col0, 16, 0) || - !BITSET_TEST_RANGE_INSIDE_WORD(linkage->flat32_mask, col0, 16, 0) || - !BITSET_TEST_RANGE_INSIDE_WORD(linkage->xfb32_only_mask, col0, 16, 0); + !BITSET_TEST_RANGE_INSIDE_WORD(linkage->interp_fp32_mask, col0, + col0 + 15, 0) || + !BITSET_TEST_RANGE_INSIDE_WORD(linkage->convergent32_mask, col0, + col0 + 15, 0) || + !BITSET_TEST_RANGE_INSIDE_WORD(linkage->color32_mask, col0, + col0 + 15, 0) || + !BITSET_TEST_RANGE_INSIDE_WORD(linkage->flat32_mask, col0, + col0 + 15, 0) || + !BITSET_TEST_RANGE_INSIDE_WORD(linkage->xfb32_only_mask, col0, + col0 + 15, 0); if (has_colors) { unsigned color_channel_rotate = 0;