Skip to content

anv: Raise vertex input bindings and attributes limits slightly

Kenneth Graunke requested to merge kwg/mesa:anv-vbs into main

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: #5917

Merge request reports