Where component_offset here is the offset when accessing components of
a packed variable. Or in other words, location_frac on
nir.h. Different places of mesa use different names for it.
Technically nir_xfb_info consumer can get the same from the
component_mask, it seems somewhat forced to make it to compute it,
instead of providing it.
v2: rename local location_frac for comp_offset, more similar to the
intended use (Timothy Arceri)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
assert(var->data.location_frac + comp_slots <= 8);
uint8_t comp_mask = ((1 << comp_slots) - 1) << var->data.location_frac;
+ unsigned comp_offset = var->data.location_frac;
while (comp_mask) {
nir_xfb_output_info *output = &xfb->outputs[xfb->output_count++];
output->offset = *offset;
output->location = *location;
output->component_mask = comp_mask & 0xf;
+ output->component_offset = comp_offset;
*offset += util_bitcount(output->component_mask) * 4;
(*location)++;
comp_mask >>= 4;
+ comp_offset = 0;
}
}
}
uint16_t offset;
uint8_t location;
uint8_t component_mask;
+ uint8_t component_offset;
} nir_xfb_output_info;
typedef struct nir_xfb_info {