broadcom/compiler: handle array of structs in GS/FS inputs

While fragment and geometry shader were handling structs as inputs, they
weren't doing for it arrays of structures.

This fixes multiple dEQP-VK.pipeline.interface_matching.* failures and
assertions.

v2:
 - Fix style (Iago).

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13884>
This commit is contained in:
Juan A. Suarez Romero 2021-11-19 19:07:24 +01:00 committed by Marge Bot
parent c5a42e4010
commit 7b21635057

View file

@ -2063,14 +2063,14 @@ ntq_setup_gs_inputs(struct v3d_compile *c)
*/
assert(glsl_type_is_array(var->type));
const struct glsl_type *type = glsl_get_array_element(var->type);
unsigned array_len = MAX2(glsl_get_length(type), 1);
unsigned var_len = glsl_count_vec4_slots(type, false, false);
unsigned loc = var->data.driver_location;
resize_qreg_array(c, &c->inputs, &c->inputs_array_size,
(loc + array_len) * 4);
(loc + var_len) * 4);
if (var->data.compact) {
for (unsigned j = 0; j < array_len; j++) {
for (unsigned j = 0; j < var_len; j++) {
unsigned input_idx = c->num_inputs++;
unsigned loc_frac = var->data.location_frac + j;
unsigned loc = var->data.location + loc_frac / 4;
@ -2081,8 +2081,10 @@ ntq_setup_gs_inputs(struct v3d_compile *c)
continue;
}
for (unsigned j = 0; j < array_len; j++) {
unsigned num_elements = glsl_get_vector_elements(type);
for (unsigned j = 0; j < var_len; j++) {
unsigned num_elements =
glsl_type_is_struct(glsl_without_array(type)) ?
4 : glsl_get_vector_elements(type);
for (unsigned k = 0; k < num_elements; k++) {
unsigned chan = var->data.location_frac + k;
unsigned input_idx = c->num_inputs++;
@ -2129,7 +2131,7 @@ ntq_setup_fs_inputs(struct v3d_compile *c)
} else if (var->data.compact) {
for (int j = 0; j < var_len; j++)
emit_compact_fragment_input(c, loc, var, j);
} else if (glsl_type_is_struct(var->type)) {
} else if (glsl_type_is_struct(glsl_without_array(var->type))) {
for (int j = 0; j < var_len; j++) {
emit_fragment_input(c, loc, var, j, 4);
}