From 5d375e614352ca5fe324138fc93defa44fc8afe3 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 18 Mar 2024 14:57:09 -0400 Subject: [PATCH] asahi: add agx_usc_push_packed helper Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/lib/agx_usc.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/asahi/lib/agx_usc.h b/src/asahi/lib/agx_usc.h index f5fc9103eb0..163c8d1ac4b 100644 --- a/src/asahi/lib/agx_usc.h +++ b/src/asahi/lib/agx_usc.h @@ -62,6 +62,14 @@ agx_usc_builder_validate(struct agx_usc_builder *b, size_t size) it; it = false, (b)->head += AGX_USC_##struct_name##_LENGTH) \ agx_pack((b)->head, USC_##struct_name, template) +#define agx_usc_push_blob(b, blob, length) \ + for (bool it = agx_usc_builder_validate((b), length); it; \ + it = false, (b)->head += length) \ + memcpy((b)->head, blob, length); + +#define agx_usc_push_packed(b, struct_name, packed) \ + agx_usc_push_blob(b, packed.opaque, AGX_USC_##struct_name##_LENGTH); + static void agx_usc_uniform(struct agx_usc_builder *b, unsigned start_halfs, unsigned size_halfs, uint64_t buffer)