From 2d63864e030c927857df7f57dde716f27aa29f50 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 25 Sep 2022 19:26:58 -0400 Subject: [PATCH] agx: Check that we don't push too much Currently we don't have a good mechanism for this other than being careful... assert() at least. The long term plan is to lift the UBO/VBO lowerings into NIR, making the sysval requirements visible in the NIR. (And possibly moving to a descriptor set model to better match Vulkan? I need to talk to jekstrand about what we want to do here long term.) Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_uniforms.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/asahi/compiler/agx_uniforms.c b/src/asahi/compiler/agx_uniforms.c index 3c072a4f898..7a29f250ebd 100644 --- a/src/asahi/compiler/agx_uniforms.c +++ b/src/asahi/compiler/agx_uniforms.c @@ -52,6 +52,7 @@ agx_indexed_sysval(agx_context *ctx, enum agx_push_type type, unsigned base = ctx->push_base; ctx->push_base += length; + assert(ctx->push_base <= AGX_NUM_UNIFORMS); ctx->out->push[ctx->out->push_ranges++] = (struct agx_push) { .type = type, @@ -82,6 +83,7 @@ agx_vbo_base(agx_context *ctx, unsigned vbo) unsigned base = ctx->push_base; ctx->push_base += 4; + assert(ctx->push_base <= AGX_NUM_UNIFORMS); ctx->out->push[ctx->out->push_ranges++] = (struct agx_push) { .type = AGX_PUSH_VBO_BASE,