panfrost: Introduce PAN_MAX_VARYINGS define
authorAlyssa Rosenzweig <alyssa@collabora.com>
Mon, 27 Sep 2021 20:53:30 +0000 (16:53 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 5 Oct 2021 21:13:52 +0000 (21:13 +0000)
commitb88225378d31b6f3d589145f675b3e25d0431b17
treed28f23fa4d1ba8f0050f3cca1d7732d521b5743f
parent9c8311b737935e6adcab25b16808da2ae5548288
panfrost: Introduce PAN_MAX_VARYINGS define

The number of varying records we need to reserve in the worst case is
greater than the number of source-level varyings we advertise
(gl_Position, gl_PointSize...)

We advertise MAX_VARYINGS source level varyings, which means anywhere we
manipulate varyings we need up to (MAX_VARYINGS + max non-source level
varyings) records. Add a PAN_MAX_VARYINGS define for this and use it
throughout.

Fixes a buffer overflow in Piglit glsl-max-varyings, which now passes
instead of crashes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13070>
src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_screen.c
src/panfrost/ci/piglit-panfrost-g52-fails.txt
src/panfrost/lib/pan_shader.c
src/panfrost/util/pan_ir.h