etnaviv: Add static_assert(..) to catch memory corruption

When we start to support GPUs with more then 16 varyings the code base
tells us that there is some work to do.

Cc: mesa-stable

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26662>
(cherry picked from commit 2f205caea4)
This commit is contained in:
Christian Gmeiner 2023-12-13 10:19:29 +01:00 committed by Eric Engestrom
parent 81cb966a87
commit 9cabb39d8f
2 changed files with 2 additions and 1 deletions

View file

@ -264,7 +264,7 @@
"description": "etnaviv: Add static_assert(..) to catch memory corruption",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -147,6 +147,7 @@ etna_link_shaders(struct etna_context *ctx, struct compiled_shader_state *cs,
COND(last_varying_2x, VIVS_RA_CONTROL_LAST_VARYING_2X);
cs->PA_ATTRIBUTE_ELEMENT_COUNT = VIVS_PA_ATTRIBUTE_ELEMENT_COUNT_COUNT(link.num_varyings);
STATIC_ASSERT(VIVS_PA_SHADER_ATTRIBUTES__LEN >= ETNA_NUM_VARYINGS);
for (int idx = 0; idx < link.num_varyings; ++idx)
cs->PA_SHADER_ATTRIBUTES[idx] = link.varyings[idx].pa_attributes;