From: Alejandro PiƱeiro Date: Tue, 6 Nov 2018 17:10:01 +0000 (+0100) Subject: nir/xfb: add component_offset at nir_xfb_info X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b62a8149abc9dd4ecef0b888d3a6bf04203231f4;p=mesa.git nir/xfb: add component_offset at nir_xfb_info 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 --- diff --git a/src/compiler/nir/nir_gather_xfb_info.c b/src/compiler/nir/nir_gather_xfb_info.c index c06a7667ab8..2c50a256a64 100644 --- a/src/compiler/nir/nir_gather_xfb_info.c +++ b/src/compiler/nir/nir_gather_xfb_info.c @@ -86,6 +86,7 @@ add_var_xfb_outputs(nir_xfb_info *xfb, 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++]; @@ -94,10 +95,12 @@ add_var_xfb_outputs(nir_xfb_info *xfb, 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; } } } diff --git a/src/compiler/nir/nir_xfb_info.h b/src/compiler/nir/nir_xfb_info.h index 6b16ce2a60a..c6a171fde34 100644 --- a/src/compiler/nir/nir_xfb_info.h +++ b/src/compiler/nir/nir_xfb_info.h @@ -34,6 +34,7 @@ typedef struct { uint16_t offset; uint8_t location; uint8_t component_mask; + uint8_t component_offset; } nir_xfb_output_info; typedef struct nir_xfb_info {