util_bitcount64(b->shader->info.outputs_written & BITFIELD64_MASK(slot));
unsigned mask = xfb_mask[slot];
+
+ /* Clear unused components. */
+ for (unsigned i = 0; i < 4; i++) {
+ if (!s->outputs[slot][i])
+ mask &= ~BITFIELD_BIT(i);
+ }
+
while (mask) {
int start, count;
u_bit_scan_consecutive_range(&mask, &start, &count);
unsigned mask_lo = xfb_mask_16bit_lo[slot];
unsigned mask_hi = xfb_mask_16bit_hi[slot];
+ /* Clear unused components. */
+ for (unsigned i = 0; i < 4; i++) {
+ if (!s->outputs_16bit_lo[slot][i])
+ mask_lo &= ~BITFIELD_BIT(i);
+ if (!s->outputs_16bit_hi[slot][i])
+ mask_hi &= ~BITFIELD_BIT(i);
+ }
+
nir_ssa_def **outputs_lo = s->outputs_16bit_lo[slot];
nir_ssa_def **outputs_hi = s->outputs_16bit_hi[slot];
nir_ssa_def *undef = nir_ssa_undef(b, 1, 16);