Mesa (master): nir/xfb: add component_offset at nir_xfb_info
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Mar 8 14:01:27 UTC 2019
Module: Mesa
Branch: master
Commit: b62a8149abc9dd4ecef0b888d3a6bf04203231f4
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b62a8149abc9dd4ecef0b888d3a6bf04203231f4
Author: Alejandro Piñeiro <apinheiro at igalia.com>
Date: Tue Nov 6 18:10:01 2018 +0100
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 <tarceri at itsqueeze.com>
---
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 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 {
More information about the mesa-commit
mailing list