From 90001a78d1d609d68ee7f06cd7257f37f01ed9ea Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Thu, 22 Sep 2022 17:32:53 +0200 Subject: [PATCH] ir3/analyze_ubo_ranges: Account for reserved consts We weren't accounting for the reserved consts when calculating how much we can upload. This led to assertion failures later if we pushed too much. Fixes: d3b7681df28 ("tu: ir3: Emit push constants directly") Part-of: (cherry picked from commit 8cb1deded60e4b8d101e4a3055078f9434aa7d8f) --- .pick_status.json | 2 +- src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 1dedd0e0a47..5c3c8be73b6 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1381,7 +1381,7 @@ "description": "ir3/analyze_ubo_ranges: Account for reserved consts", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "d3b7681df28e89311c4149708311de546e0a58cc" }, diff --git a/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c b/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c index c6d63d499a8..894d069388d 100644 --- a/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c +++ b/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c @@ -425,7 +425,7 @@ ir3_nir_analyze_ubo_ranges(nir_shader *nir, struct ir3_shader_variant *v) memset(state, 0, sizeof(*state)); - uint32_t upload_remaining = max_upload; + uint32_t upload_remaining = max_upload - v->num_reserved_user_consts * 16; bool push_ubos = compiler->push_ubo_with_preamble; nir_foreach_function (function, nir) { if (function->impl && (!push_ubos || !function->is_preamble)) {