From 0c2bbb470ac4b2fa0672c28aab080ea69658c9e5 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 6 Feb 2022 17:38:24 -0500 Subject: [PATCH] agx: Add agx_size_align_16 helper Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compiler.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/asahi/compiler/agx_compiler.h b/src/asahi/compiler/agx_compiler.h index abe39b6d761..466b17c7f12 100644 --- a/src/asahi/compiler/agx_compiler.h +++ b/src/asahi/compiler/agx_compiler.h @@ -61,6 +61,18 @@ enum agx_size { AGX_SIZE_64 = 2 }; +static inline unsigned +agx_size_align_16(enum agx_size size) +{ + switch (size) { + case AGX_SIZE_16: return 1; + case AGX_SIZE_32: return 2; + case AGX_SIZE_64: return 4; + } + + unreachable("Invalid size"); +} + typedef struct { /* Sufficient for as many SSA values as we need. Immediates and uniforms fit in 16-bits */ unsigned value : 22;