From a30704147c5725811e743b195d234c75da7ebde0 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Sat, 21 Aug 2021 10:58:06 +0200 Subject: [PATCH] vrend: Fix shaders with gerneric indices >= 32 Probably for some time now the generics are moved from index 0-31 to 9-40, and this doesn't fit the masks we were using, so use 64 bit masks. Apparently this only triggered an assert and didn't lead to further failures when the assertion was not enabled so that the CTS didin't catch this. We could also use 32 bit masks and shift the index by 9, but if this would get us into trouble we ever decide to switch the PIPE_CAP_TGSI_TEXCOORD in mesa/virgl. Fixes a number of piglits from the glsl-1.10 set that otherwise trigger an assertion. Signed-off-by: Gert Wollny Reviewed-by: Rohan Garg --- src/vrend_shader.c | 16 ++++++++-------- src/vrend_shader.h | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 8b2b7ea..f5c336b 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -162,9 +162,9 @@ struct vrend_generic_ios { struct vrend_io_range input_range; struct vrend_io_range output_range; - uint32_t outputs_expected_mask; - uint32_t inputs_emitted_mask; - uint32_t outputs_emitted_mask; + uint64_t outputs_expected_mask; + uint64_t inputs_emitted_mask; + uint64_t outputs_emitted_mask; }; struct vrend_patch_ios { @@ -6246,11 +6246,11 @@ emit_ios_generic(const struct dump_ctx *ctx, postfix); if (io->name == TGSI_SEMANTIC_GENERIC) { - assert(io->sid < 32); + assert(io->sid < 64); if (iot == io_in) { - generic_ios->inputs_emitted_mask |= 1 << io->sid; + generic_ios->inputs_emitted_mask |= 1ull << io->sid; } else { - generic_ios->outputs_emitted_mask |= 1 << io->sid; + generic_ios->outputs_emitted_mask |= 1ull << io->sid; } } @@ -6891,8 +6891,8 @@ static int emit_ios(const struct dump_ctx *ctx, if (generic_ios->outputs_expected_mask && (generic_ios->outputs_expected_mask != generic_ios->outputs_emitted_mask)) { - for (int i = 0; i < 31; ++i) { - uint32_t mask = 1 << i; + for (int i = 0; i < 64; ++i) { + uint64_t mask = 1ull << i; bool expecting = generic_ios->outputs_expected_mask & mask; if (expecting & !(generic_ios->outputs_emitted_mask & mask)) emit_hdrf(glsl_strbufs, " out vec4 %s_g%dA0_f%s;\n", diff --git a/src/vrend_shader.h b/src/vrend_shader.h index ec5c693..de84ca4 100644 --- a/src/vrend_shader.h +++ b/src/vrend_shader.h @@ -88,10 +88,10 @@ struct vrend_shader_info_out { }; struct vrend_shader_info_in { - uint64_t generic_emitted_mask : 32; - uint64_t num_indirect_generic : 8; - uint64_t num_indirect_patch : 8; - uint64_t use_pervertex : 1; + uint64_t generic_emitted_mask; + uint32_t num_indirect_generic : 8; + uint32_t num_indirect_patch : 8; + uint32_t use_pervertex : 1; };