zink: avoid creating ssbo variable types with multiple runtime arrays

this is illegal

affects:
KHR-GL46.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-packed-matC

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15894>
This commit is contained in:
Mike Blumenkrantz 2022-04-12 09:47:03 -04:00 committed by Marge Bot
parent ff4dcb76d9
commit fcd6b2a47a
1 changed files with 3 additions and 2 deletions

View File

@ -1540,12 +1540,13 @@ unbreak_bos(nir_shader *shader)
u_foreach_bit(slot, ssbo_used) {
char buf[64];
snprintf(buf, sizeof(buf), "ssbo_slot_%u", slot);
if (ssbo_sizes[slot])
bool use_runtime = ssbo_sizes[slot] && max_ssbo_size;
if (use_runtime)
fields[1].type = unsized;
else
fields[1].type = NULL;
nir_variable *var = nir_variable_create(shader, nir_var_mem_ssbo,
glsl_struct_type(fields, 1 + !!ssbo_sizes[slot], "struct", false), buf);
glsl_struct_type(fields, 1 + use_runtime, "struct", false), buf);
var->interface_type = var->type;
var->data.driver_location = slot;
}