summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Abbott <cwabbott0@gmail.com>2022-09-26 18:31:48 +0200
committerDylan Baker <dylan.c.baker@intel.com>2022-10-04 14:54:29 -0700
commitf79525dda6fa288514f0a2ac63fbd4b8b87c7067 (patch)
treed2a1fa57c83f0221b62696c309b71bda50fd7314
parentbdc71b81c84502735f57f796c4a7d054e2e49fe6 (diff)
ir3/analyze_ubo_ranges: Account for reserved consts better
It turns out that the ir3_setup_const_state() already includes reserved consts, so we were accidentally counting it twice. This makes us use less consts, and if there are enough reserved consts can make it go negative and wrap around. Fix this while also making sure the previous bug remains fixed. Fixes: 8cb1deded60 ("ir3/analyze_ubo_ranges: Account for reserved consts") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18840> (cherry picked from commit dcab399a173f2ab99f408e2db1bafc114c29cfd9)
-rw-r--r--.pick_status.json2
-rw-r--r--src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 566cca3ef93..5fa718428fe 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -49,7 +49,7 @@
"description": "ir3/analyze_ubo_ranges: Account for reserved consts better",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "8cb1deded60e4b8d101e4a3055078f9434aa7d8f"
},
diff --git a/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c b/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c
index 894d069388d..637995778f7 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 - v->num_reserved_user_consts * 16;
+ uint32_t upload_remaining = max_upload;
bool push_ubos = compiler->push_ubo_with_preamble;
nir_foreach_function (function, nir) {
if (function->impl && (!push_ubos || !function->is_preamble)) {
@@ -449,16 +449,16 @@ ir3_nir_analyze_ubo_ranges(nir_shader *nir, struct ir3_shader_variant *v)
* first.
*/
- uint32_t offset = v->num_reserved_user_consts * 16;
+ uint32_t offset = 0;
for (uint32_t i = 0; i < state->num_enabled; i++) {
uint32_t range_size = state->range[i].end - state->range[i].start;
assert(offset <= max_upload);
- state->range[i].offset = offset;
+ state->range[i].offset = offset + v->num_reserved_user_consts * 16;
assert(offset <= max_upload);
offset += range_size;
}
- state->size = offset - v->num_reserved_user_consts * 16;
+ state->size = offset;
}
bool