glsl: Account for unsized arrays in NIR linker
Follow the same approach as the pre-NIR linker. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5891 Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Acked-by: Timothy Arceri <tarceri@itsqueeze.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21401>
This commit is contained in:
@@ -326,7 +326,7 @@ iterate_type_count_variables(const struct glsl_type *type,
|
||||
else
|
||||
field_type = glsl_get_array_element(type);
|
||||
|
||||
if (glsl_type_is_leaf(field_type))
|
||||
if (glsl_type_is_leaf(field_type) || glsl_type_is_unsized_array(field_type))
|
||||
(*num_variables)++;
|
||||
else
|
||||
iterate_type_count_variables(field_type, num_variables);
|
||||
@@ -374,17 +374,13 @@ iterate_type_fill_variables(const struct glsl_type *type,
|
||||
struct gl_shader_program *prog,
|
||||
struct gl_uniform_block *block)
|
||||
{
|
||||
unsigned length = glsl_get_length(type);
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
unsigned struct_base_offset;
|
||||
|
||||
bool struct_or_ifc = glsl_type_is_struct_or_ifc(type);
|
||||
if (struct_or_ifc)
|
||||
struct_base_offset = *offset;
|
||||
|
||||
for (unsigned i = 0; i < length; i++) {
|
||||
for (unsigned i = 0; i < glsl_get_length(type); i++) {
|
||||
const struct glsl_type *field_type;
|
||||
|
||||
if (struct_or_ifc) {
|
||||
@@ -395,7 +391,7 @@ iterate_type_fill_variables(const struct glsl_type *type,
|
||||
field_type = glsl_get_array_element(type);
|
||||
}
|
||||
|
||||
if (glsl_type_is_leaf(field_type)) {
|
||||
if (glsl_type_is_leaf(field_type) || glsl_type_is_unsized_array(field_type)) {
|
||||
fill_individual_variable(field_type, variables, variable_index,
|
||||
offset, prog, block);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user