}
}
+static void
+emit_compact_fragment_input(struct v3d_compile *c, int attr, nir_variable *var,
+ int array_index)
+{
+ /* Compact variables are scalar arrays where each set of 4 elements
+ * consumes a single location.
+ */
+ int loc_offset = array_index / 4;
+ int chan = var->data.location_frac + array_index % 4;
+ c->inputs[(attr + loc_offset) * 4 + chan] =
+ emit_fragment_varying(c, var, chan, loc_offset);
+}
+
static void
add_output(struct v3d_compile *c,
uint32_t decl_offset,
c->fs_key->point_sprite_mask)) {
c->inputs[loc * 4 + 0] = c->point_x;
c->inputs[loc * 4 + 1] = c->point_y;
+ } else if (var->data.compact) {
+ for (int j = 0; j < array_len; j++)
+ emit_compact_fragment_input(c, loc, var, j);
} else {
for (int j = 0; j < array_len; j++)
emit_fragment_input(c, loc + j, var, j);
int start_comp = nir_intrinsic_component(intr);
nir_ssa_def *src = nir_ssa_for_src(b, intr->src[0],
intr->num_components);
-
nir_variable *var = NULL;
nir_foreach_variable(scan_var, &c->s->outputs) {
+ int components = scan_var->data.compact ?
+ glsl_get_length(scan_var->type) :
+ glsl_get_components(scan_var->type);
if (scan_var->data.driver_location != nir_intrinsic_base(intr) ||
start_comp < scan_var->data.location_frac ||
- start_comp >= scan_var->data.location_frac +
- glsl_get_components(scan_var->type)) {
+ start_comp >= scan_var->data.location_frac + components) {
continue;
}
var = scan_var;
if (vpm_offset == -1)
continue;
+ if (var->data.compact)
+ vpm_offset += nir_src_as_uint(intr->src[1]) * 4;
+
BITSET_SET(state->varyings_stored, vpm_offset);
v3d_nir_store_output(b, state->varyings_vpm_offset + vpm_offset,