brw: Use NUM_TOTAL_VARYING_SLOTS instead of VARYING_SLOT_TESS_MAX

This is a bit larger, but also clearer.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38121>
This commit is contained in:
Kenneth Graunke 2025-10-24 14:50:06 -07:00
parent 3dbeaf18c8
commit 16ab31f358
2 changed files with 6 additions and 20 deletions

View file

@ -121,6 +121,8 @@ brw_compute_per_primitive_map(int *out_per_primitive_map,
static inline void
assign_vue_slot(struct intel_vue_map *vue_map, int varying, int slot)
{
STATIC_ASSERT(NUM_TOTAL_VARYING_SLOTS <= INT8_MAX);
/* Make sure this varying hasn't been assigned a slot already */
assert (vue_map->varying_to_slot[varying] == -1);
@ -162,15 +164,7 @@ brw_compute_vue_map(const struct intel_device_info *devinfo,
*/
slots_valid &= ~VARYING_BIT_FACE;
/* Make sure that the values we store in vue_map->varying_to_slot and
* vue_map->slot_to_varying won't overflow the signed chars that are used
* to store them. Note that since vue_map->slot_to_varying sometimes holds
* values equal to BRW_VARYING_SLOT_COUNT, we need to ensure that
* BRW_VARYING_SLOT_COUNT is <= 127, not 128.
*/
STATIC_ASSERT(BRW_VARYING_SLOT_COUNT <= 127);
for (int i = 0; i < BRW_VARYING_SLOT_COUNT; ++i) {
for (int i = 0; i < NUM_TOTAL_VARYING_SLOTS; ++i) {
vue_map->varying_to_slot[i] = -1;
vue_map->slot_to_varying[i] = BRW_VARYING_SLOT_PAD;
}
@ -291,15 +285,7 @@ brw_compute_tess_vue_map(struct intel_vue_map *vue_map,
vertex_slots |= VARYING_BIT_CLIP_DIST1;
}
/* Make sure that the values we store in vue_map->varying_to_slot and
* vue_map->slot_to_varying won't overflow the signed chars that are used
* to store them. Note that since vue_map->slot_to_varying sometimes holds
* values equal to VARYING_SLOT_TESS_MAX , we need to ensure that
* VARYING_SLOT_TESS_MAX is <= 127, not 128.
*/
STATIC_ASSERT(VARYING_SLOT_TESS_MAX <= 127);
for (int i = 0; i < VARYING_SLOT_TESS_MAX ; ++i) {
for (int i = 0; i < NUM_TOTAL_VARYING_SLOTS; ++i) {
vue_map->varying_to_slot[i] = -1;
vue_map->slot_to_varying[i] = BRW_VARYING_SLOT_PAD;
}

View file

@ -312,7 +312,7 @@ struct intel_vue_map {
* additional processing is applied before storing them in the VUE), the
* value is -1.
*/
int8_t varying_to_slot[VARYING_SLOT_TESS_MAX];
int8_t varying_to_slot[NUM_TOTAL_VARYING_SLOTS];
/**
* Map from VUE slot to gl_varying_slot value. For slots that do not
@ -321,7 +321,7 @@ struct intel_vue_map {
*
* For slots that are not in use, the value is BRW_VARYING_SLOT_PAD.
*/
int8_t slot_to_varying[VARYING_SLOT_TESS_MAX];
int8_t slot_to_varying[NUM_TOTAL_VARYING_SLOTS];
/**
* Total number of VUE slots in use