diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2019-02-13 16:22:37 -0600 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-02-25 14:00:34 -0800 |
commit | 447ef1d9b30611737c0e6b98fa907f212bdf7237 (patch) | |
tree | 43d6bbc3c3c3ad12933fd7d80b0ff1a23a2c8772 | |
parent | 721011c6f7c8dfcb38caf41277dfbac796f50005 (diff) | |
download | mesa-447ef1d9b30611737c0e6b98fa907f212bdf7237.tar.gz mesa-447ef1d9b30611737c0e6b98fa907f212bdf7237.tar.bz2 mesa-447ef1d9b30611737c0e6b98fa907f212bdf7237.zip |
nir/xfb: Work in terms of components rather than slots
We needed to better handle cases where a chunk of a variable starts at
some non-zero location_frac and rolls over into the next slot but may
not be more than 4 dwords. For example, if gl_CullDistance is an array
of 3 things and has location_frac = 2, it will span across two vec4s but
is not, itself, bigger than a vec4. If you ignore the clip/cull special
case, it's not allowed to happen for anything else because the only
things that can span more than one slot is dvec3 and dvec4 and they're
both bigger than a vec4. The current code uses this attrib_slot thing
where we count attribute slots and iterate over them. However, that
doesn't work in the case above because gl_CullDistance will have an
attrib_slot count of 1 even though it does span two slots. We could fix
this by adjusting attrib_slot but we already have comp_mask and it's
easier to just handle it that way.
Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
(cherry picked from commit 558c3145045f1c6da8bddb31ed77a418ab27f2f9)
-rw-r--r-- | src/compiler/nir/nir_gather_xfb_info.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/compiler/nir/nir_gather_xfb_info.c b/src/compiler/nir/nir_gather_xfb_info.c index a1de2d681eb..a0def81ff65 100644 --- a/src/compiler/nir/nir_gather_xfb_info.c +++ b/src/compiler/nir/nir_gather_xfb_info.c @@ -76,18 +76,18 @@ 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; - assert(attrib_slots <= 2); - for (unsigned s = 0; s < attrib_slots; s++) { + while (comp_mask) { nir_xfb_output_info *output = &xfb->outputs[xfb->output_count++]; output->buffer = buffer; - output->offset = *offset + s * 16; + output->offset = *offset; output->location = *location; - output->component_mask = (comp_mask >> (s * 4)) & 0xf; + output->component_mask = comp_mask & 0xf; + *offset += util_bitcount(output->component_mask) * 4; (*location)++; + comp_mask >>= 4; } - *offset += comp_slots * 4; } } |