mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-22 19:20:22 +01:00
agx: fix buffer overflow with varying slots
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
This commit is contained in:
parent
de31b28053
commit
9aeaf99259
2 changed files with 6 additions and 5 deletions
|
|
@ -2543,6 +2543,7 @@ agx_remap_varyings_vs(nir_shader *nir, struct agx_varyings_vs *varyings,
|
|||
if (loc == VARYING_SLOT_POS || loc == VARYING_SLOT_PSIZ)
|
||||
continue;
|
||||
|
||||
assert(loc < ARRAY_SIZE(varyings->slots));
|
||||
varyings->slots[loc] = base;
|
||||
base += 4;
|
||||
varyings->num_32_smooth += 4;
|
||||
|
|
@ -2554,6 +2555,7 @@ agx_remap_varyings_vs(nir_shader *nir, struct agx_varyings_vs *varyings,
|
|||
if (loc == VARYING_SLOT_POS || loc == VARYING_SLOT_PSIZ)
|
||||
continue;
|
||||
|
||||
assert(loc < ARRAY_SIZE(varyings->slots));
|
||||
varyings->slots[loc] = base;
|
||||
base += 4;
|
||||
varyings->num_32_flat += 4;
|
||||
|
|
@ -2565,6 +2567,7 @@ agx_remap_varyings_vs(nir_shader *nir, struct agx_varyings_vs *varyings,
|
|||
if (loc == VARYING_SLOT_POS || loc == VARYING_SLOT_PSIZ)
|
||||
continue;
|
||||
|
||||
assert(loc < ARRAY_SIZE(varyings->slots));
|
||||
varyings->slots[loc] = base;
|
||||
base += 4;
|
||||
varyings->num_32_linear += 4;
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@
|
|||
|
||||
#include "compiler/nir/nir.h"
|
||||
#include "util/u_dynarray.h"
|
||||
|
||||
/* 32 user varyings + some system values */
|
||||
#define AGX_MAX_VARYING_SLOTS (48)
|
||||
#include "shader_enums.h"
|
||||
|
||||
struct agx_varyings_vs {
|
||||
/* The number of user varyings of each type. The varyings must be allocated
|
||||
|
|
@ -42,7 +40,7 @@ struct agx_varyings_vs {
|
|||
*
|
||||
* If the slot is not written, this must be ~0.
|
||||
*/
|
||||
unsigned slots[AGX_MAX_VARYING_SLOTS];
|
||||
unsigned slots[VARYING_SLOT_MAX];
|
||||
|
||||
/* Slot for the combined layer/viewport 32-bit sysval output, or ~0 if none
|
||||
* is written. What's at slots[VARYING_SLOT_LAYER] is the varying output.
|
||||
|
|
@ -53,7 +51,7 @@ struct agx_varyings_vs {
|
|||
/* Conservative bound, * 4 due to offsets (TODO: maybe worth eliminating
|
||||
* coefficient register aliasing?)
|
||||
*/
|
||||
#define AGX_MAX_CF_BINDINGS (AGX_MAX_VARYING_SLOTS * 4)
|
||||
#define AGX_MAX_CF_BINDINGS (VARYING_SLOT_MAX * 4)
|
||||
|
||||
struct agx_varyings_fs {
|
||||
/* Number of coefficient registers used */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue