zink: further improve bo sizing

using the attribute slot size isn't sufficient in this case, as the layout
rules may have additional effects upon sizing

instead, just use the explicit size

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17239>
This commit is contained in:
Mike Blumenkrantz 2022-06-24 11:19:14 -04:00
parent e241bbe1ce
commit ea8a0654f5
1 changed files with 6 additions and 2 deletions

View File

@ -2075,8 +2075,12 @@ unbreak_bos(nir_shader *shader, struct zink_shader *zs, bool needs_size)
continue;
/* be conservative: use the bigger of the interface and variable types to ensure in-bounds access */
unsigned size = glsl_count_attribute_slots(glsl_type_is_array(var->type) ? var->type : type, false);
if (var->interface_type)
size = MAX2(size, glsl_count_attribute_slots(glsl_without_array(var->interface_type), false));
const struct glsl_type *interface_type = var->interface_type ? glsl_without_array(var->interface_type) : NULL;
if (interface_type) {
unsigned block_size = glsl_get_explicit_size(interface_type, true);
block_size /= sizeof(float) * 4;
size = MAX2(size, block_size);
}
if (var->data.mode == nir_var_mem_ubo) {
if (var->data.driver_location)
max_ubo_size = MAX2(max_ubo_size, size);