zink: use the bigger of the variable type and interface type for bo sizing

this avoids the scenario where the full bo size isn't accounted for because
no variable for the block has been created

cc: mesa-stable

affects:
KHR-GL33.shaders.uniform_block.random.all_per_block_buffers.3

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17217>
This commit is contained in:
Mike Blumenkrantz 2022-06-23 15:49:43 -04:00 committed by Marge Bot
parent e060d98aac
commit e38b2adb88

View file

@ -2074,7 +2074,10 @@ unbreak_bos(nir_shader *shader, struct zink_shader *zs, bool needs_size)
const struct glsl_type *type = glsl_without_array(var->type);
if (type_is_counter(type))
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));
if (var->data.mode == nir_var_mem_ubo)
max_ubo_size = MAX2(max_ubo_size, size);
else