broadcom/compiler: handle compact input arrays for geometry shaders

Clip distance arrays will come as compact array variables, so we need
to handle them as such, like we did for vertex inputs.

Fixes:
dEQP-VK.clipping.user_defined.clip_distance.vert_geom.{1,2,3,4}

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>
This commit is contained in:
Iago Toral Quiroga 2021-07-07 10:54:57 +02:00
parent df1d08533c
commit e1a24a0047
1 changed files with 14 additions and 1 deletions

View File

@ -2048,13 +2048,26 @@ ntq_setup_gs_inputs(struct v3d_compile *c)
* in the input primitive, but here we only care about the
* per-vertex input type.
*/
const struct glsl_type *type = glsl_without_array(var->type);
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 loc = var->data.driver_location;
resize_qreg_array(c, &c->inputs, &c->inputs_array_size,
(loc + array_len) * 4);
if (var->data.compact) {
for (unsigned j = 0; j < array_len; j++) {
unsigned input_idx = c->num_inputs++;
unsigned loc_frac = var->data.location_frac + j;
unsigned loc = var->data.location + loc_frac / 4;
unsigned comp = loc_frac % 4;
c->input_slots[input_idx] =
v3d_slot_from_slot_and_component(loc, comp);
}
continue;
}
for (unsigned j = 0; j < array_len; j++) {
unsigned num_elements = glsl_get_vector_elements(type);
for (unsigned k = 0; k < num_elements; k++) {