[Mesa-dev] [PATCH 4/7] nir: add component_offset at nir_xfb_info
Alejandro PiƱeiro
apinheiro at igalia.com
Thu Nov 8 13:22:15 UTC 2018
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.
---
src/compiler/nir/nir_gather_xfb_info.c | 3 +++
src/compiler/nir/nir_xfb_info.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/src/compiler/nir/nir_gather_xfb_info.c b/src/compiler/nir/nir_gather_xfb_info.c
index 01fc2b26624..cd3afa32661 100644
--- a/src/compiler/nir/nir_gather_xfb_info.c
+++ b/src/compiler/nir/nir_gather_xfb_info.c
@@ -70,6 +70,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 location_frac = var->data.location_frac;
assert(attrib_slots <= 2);
for (unsigned s = 0; s < attrib_slots; s++) {
@@ -79,6 +80,7 @@ add_var_xfb_outputs(nir_xfb_info *xfb,
output->offset = *offset;
output->location = *location;
output->component_mask = (comp_mask >> (s * 4)) & 0xf;
+ output->component_offset = location_frac;
(*location)++;
/* attrib_slots would be only > 1 for doubles. On that case
@@ -86,6 +88,7 @@ add_var_xfb_outputs(nir_xfb_info *xfb,
* to use DIV_ROUND_UP or similar
*/
*offset += comp_slots / attrib_slots * 4;
+ location_frac = 0;
}
}
}
diff --git a/src/compiler/nir/nir_xfb_info.h b/src/compiler/nir/nir_xfb_info.h
index 9b543df5f47..fef52ba96d8 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 {
--
2.14.1
More information about the mesa-dev
mailing list