anv: Raise vertex input bindings and attributes limits slightly
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 10 Feb 2022 23:45:23 +0000 (15:45 -0800)
committerMarge Bot <emma+marge@anholt.net>
Tue, 22 Feb 2022 21:31:06 +0000 (21:31 +0000)
commitc46d3acf0e3624f110c6d49f3eeef70fa1795855
treec82e6aaaba288eafc79f80b9a5c23b2723fd17d5
parentdabba7d7263be6ffb6f3676465e92c65952fa824
anv: Raise vertex input bindings and attributes limits slightly

This raises our vertex input bindings limit from 28 to 31, and our
vertex input attribute limit from 28 to 29.  We could theoretically
go higher, but it will take additional work.

The 3DSTATE_VERTEX_BUFFERS and 3DSTATE_VERTEX_ELEMENTS limits are 33
vertex buffers, and 34 vertex elements.  But we need up to two vertex
elements for system values (FirstVertex, BaseVertex, BaseInstance,
DrawID), and we currently use two vertex bindings for those.

There is another hidden limit: our compiler backend only supports the
push model for VS inputs currently.  3DSTATE_VS only allows URB Read
Lengths between [0, 15], which is measured in pairs of inputs, which
means we can theoretically push no more than 32 vertex elements.  This
is no artifical limit either, as a vec4 element takes up 4 registers
in the payload, and 32 * 4 = 128, the entire size of our register file.
Plus, the VS Thread payload needs at least g0 and g1 for other things,
so we can really only push 31.

We can theoretically support one additional binding, by combining our
two SGV bindings into a single upload.  In order to support additional
vertex elements, we would need to add support to the backend compiler
for the pull model for VS inputs.

References: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5917
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14991>
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_private.h