intel/fs: Allow multiple slots for position

Change brw_compute_vue_map() to also take the number of pos slots.  If
more than one slot is used, the VARYING_SLOT_POS is treated as an
array.

When using Primitive Replication, instead of a single position, the
VUE must contain an array of positions.  Padding might be
necessary (after clip distance) to ensure rest of attributes start
aligned.

v2: Add note about array in the commit message and assert that
    pos_slots >= 1 to make clear 0 is invalid. (Jason)
    Move padding to be after the clip distance.

v3: Apply the correct offset when gathering the sources from outputs.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> [v2]
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2313>
This commit is contained in:
Caio Marcelo de Oliveira Filho
2018-09-21 16:07:38 -07:00
committed by Marge Bot
parent afa5447312
commit 395de69b1f
13 changed files with 46 additions and 17 deletions

View File

@@ -60,7 +60,8 @@ void
brw_compute_vue_map(const struct gen_device_info *devinfo,
struct brw_vue_map *vue_map,
uint64_t slots_valid,
bool separate)
bool separate,
uint32_t pos_slots)
{
/* Keep using the packed/contiguous layout on old hardware - we only need
* the SSO layout when using geometry/tessellation shaders or 32 FS input
@@ -133,11 +134,27 @@ brw_compute_vue_map(const struct gen_device_info *devinfo,
*/
assign_vue_slot(vue_map, VARYING_SLOT_PSIZ, slot++);
assign_vue_slot(vue_map, VARYING_SLOT_POS, slot++);
/* When using Primitive Replication, multiple slots are used for storing
* positions for each view.
*/
assert(pos_slots >= 1);
if (pos_slots > 1) {
for (int i = 1; i < pos_slots; i++) {
vue_map->slot_to_varying[slot++] = VARYING_SLOT_POS;
}
}
if (slots_valid & BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST0))
assign_vue_slot(vue_map, VARYING_SLOT_CLIP_DIST0, slot++);
if (slots_valid & BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST1))
assign_vue_slot(vue_map, VARYING_SLOT_CLIP_DIST1, slot++);
/* Vertex URB Formats table says: "Vertex Header shall be padded at the
* end so that the header ends on a 32-byte boundary".
*/
slot += slot % 2;
/* front and back colors need to be consecutive so that we can use
* ATTRIBUTE_SWIZZLE_INPUTATTR_FACING to swizzle them when doing
* two-sided color.