From e12bf971536f7f82239db42257cbd879eae128f5 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 26 Feb 2023 21:52:35 -0500 Subject: [PATCH] agx: Pack indirect texture/sampler handles For indirect indexing into the binding table. Note this does not handle packing the bindless forms, since that's a bit more involved. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_pack.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/asahi/compiler/agx_pack.c b/src/asahi/compiler/agx_pack.c index 6c7558a..f5a7804 100644 --- a/src/asahi/compiler/agx_pack.c +++ b/src/asahi/compiler/agx_pack.c @@ -66,18 +66,28 @@ agx_pack_sample_coords(agx_index index, bool *flag) static unsigned agx_pack_texture(agx_index index, unsigned *flag) { - /* TODO: indirection */ - assert(index.type == AGX_INDEX_IMMEDIATE); - *flag = 0; + if (index.type == AGX_INDEX_REGISTER) { + assert(index.size == AGX_SIZE_16); + *flag = 1; + } else { + assert(index.type == AGX_INDEX_IMMEDIATE); + *flag = 0; + } + return index.value; } static unsigned agx_pack_sampler(agx_index index, bool *flag) { - /* TODO: indirection */ - assert(index.type == AGX_INDEX_IMMEDIATE); - *flag = 0; + if (index.type == AGX_INDEX_REGISTER) { + assert(index.size == AGX_SIZE_16); + *flag = 1; + } else { + assert(index.type == AGX_INDEX_IMMEDIATE); + *flag = 0; + } + return index.value; } -- 2.7.4