mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
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>
This commit is contained in:
parent
c58d633dd2
commit
dcab399a17
1 changed files with 4 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue