From 5bb99b1104a83a0c6cb625c75fdbb2de9cda8b32 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 22 Sep 2024 16:33:35 -0400 Subject: [PATCH] agx: add helper to pad 16-bit to 32-bit this is a bit tricky to get right Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 1a13bcb82a6..5a1b8e1fc1c 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -378,6 +378,18 @@ agx_vec2(agx_builder *b, agx_index s0, agx_index s1) return agx_emit_collect(b, 2, (agx_index[]){s0, s1}); } +static agx_index +agx_pad_to_32(agx_builder *b, agx_index s) +{ + assert(s.size == AGX_SIZE_16); + assert(agx_channels(s) == 1); + + agx_index srcs[2] = {s, agx_undef(AGX_SIZE_16)}; + agx_index dst = agx_vec_temp(b->shader, AGX_SIZE_32, 1); + agx_emit_collect_to(b, dst, 2, srcs); + return dst; +} + static agx_index agx_recollect_vector(agx_builder *b, nir_src vec) {