ir3: Don't count reserved user consts in ubo_state::size

Previously we included the reserved user consts (for Vulkan push
constants) as part of the pushed UBO contents, but that led to a problem
because when calculating the worst-case space for UBOs we didn't factor
in the reserved user consts. We'll have the same problem when doing the
same thing in the preamble optimization pass. Stop including the
reserved size in ubo_state::size, and have ir3_setup_consts() add it in
instead, so we won't forget to add it anywhere.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13148>
This commit is contained in:
Connor Abbott
2022-01-25 10:30:33 +01:00
committed by Marge Bot
parent e274354204
commit 7ad57d9af1
3 changed files with 6 additions and 3 deletions

View File

@@ -2044,7 +2044,9 @@ emit_intrinsic(struct ir3_context *ctx, nir_intrinsic_instr *intr)
* addr reg value can be:
*/
ctx->so->constlen =
MAX2(ctx->so->constlen, const_state->ubo_state.size / 16);
MAX2(ctx->so->constlen,
ctx->so->shader->num_reserved_user_consts +
const_state->ubo_state.size / 16);
}
break;

View File

@@ -825,7 +825,8 @@ ir3_setup_const_state(nir_shader *nir, struct ir3_shader_variant *v,
const_state->num_ubos = nir->info.num_ubos;
debug_assert((const_state->ubo_state.size % 16) == 0);
unsigned constoff = const_state->ubo_state.size / 16;
unsigned constoff = v->shader->num_reserved_user_consts +
const_state->ubo_state.size / 16;
unsigned ptrsz = ir3_pointer_size(compiler);
if (const_state->num_ubos > 0) {

View File

@@ -408,7 +408,7 @@ ir3_nir_analyze_ubo_ranges(nir_shader *nir, struct ir3_shader_variant *v)
assert(offset <= max_upload);
offset += range_size;
}
state->size = offset;
state->size = offset - v->shader->num_reserved_user_consts * 16;
}
bool