From eb4187b02db845fa53645a19119bff76cfcd5ae8 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 25 Nov 2022 19:37:25 -0500 Subject: [PATCH] agx: Handle large varying indices Fixes glsl-max-varyings. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_pack.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/asahi/compiler/agx_pack.c b/src/asahi/compiler/agx_pack.c index 05459221594..062aaf49452 100644 --- a/src/asahi/compiler/agx_pack.c +++ b/src/asahi/compiler/agx_pack.c @@ -521,6 +521,7 @@ agx_pack_instr(struct util_dynarray *emission, struct util_dynarray *fixups, agx agx_index value = I->src[1]; assert(index_src.type == AGX_INDEX_IMMEDIATE); + assert(index_src.value < BITFIELD_MASK(8)); assert(value.type == AGX_INDEX_REGISTER); assert(value.size == AGX_SIZE_32); @@ -528,9 +529,10 @@ agx_pack_instr(struct util_dynarray *emission, struct util_dynarray *fixups, agx 0x11 | (I->last ? (1 << 7) : 0) | ((value.value & 0x3F) << 9) | - (((uint64_t) index_src.value) << 16) | + (((uint64_t) (index_src.value & 0x3F)) << 16) | (0x80 << 16) | /* XXX */ ((value.value >> 6) << 24) | + ((index_src.value >> 6) << 26) | (0x8u << 28); /* XXX */ unsigned size = 4;