anv: Get ready for more pipeline stages

This makes a bunch of loops use ARRAY_SIZE instead of MESA_SHADER_STAGES,
extends a few arrays, and adds a bunch of array length asserts.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8637>
This commit is contained in:
Jason Ekstrand
2021-01-21 16:58:50 -06:00
committed by Marge Bot
parent f366f6a071
commit dc05daf0e5
7 changed files with 23 additions and 16 deletions
+2 -1
View File
@@ -1414,7 +1414,7 @@ anv_scratch_pool_init(struct anv_device *device, struct anv_scratch_pool *pool)
void
anv_scratch_pool_finish(struct anv_device *device, struct anv_scratch_pool *pool)
{
for (unsigned s = 0; s < MESA_SHADER_STAGES; s++) {
for (unsigned s = 0; s < ARRAY_SIZE(pool->bos[0]); s++) {
for (unsigned i = 0; i < 16; i++) {
if (pool->bos[i][s] != NULL)
anv_device_release_bo(device, pool->bos[i][s]);
@@ -1432,6 +1432,7 @@ anv_scratch_pool_alloc(struct anv_device *device, struct anv_scratch_pool *pool,
unsigned scratch_size_log2 = ffs(per_thread_scratch / 2048);
assert(scratch_size_log2 < 16);
assert(stage < ARRAY_SIZE(pool->bos));
struct anv_bo *bo = p_atomic_read(&pool->bos[scratch_size_log2][stage]);
if (bo != NULL)