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:8cb1deded6
("ir3/analyze_ubo_ranges: Account for reserved consts") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18840> (cherry picked from commitdcab399a17
)
This commit is contained in:

committed by
Dylan Baker

parent
bdc71b81c8
commit
f79525dda6
@@ -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"
|
||||
},
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user