nir_to_tgsi: Add a workaround for virgl UBO array dynamic indexing.
authorEmma Anholt <emma@anholt.net>
Wed, 15 Sep 2021 21:49:46 +0000 (14:49 -0700)
committerMarge Bot <eric+marge@anholt.net>
Wed, 6 Oct 2021 03:44:17 +0000 (03:44 +0000)
commit469f0345acdb18f95ab03660170b52705b1d2bd7
tree7a150978860485cccff6468a162f6768782bc68c
parenta292268cd50ae29795daf02f3c00f7903bda7596
nir_to_tgsi: Add a workaround for virgl UBO array dynamic indexing.

virgl makes one array of UBOs starting from the first non-CB0 UBO used,
and does dynamic indexing off of that.  It requires that the dynamic
indexing be CONST[ADDR[0]+base], rather than having the base be loaded in
addr0.

If we had a nir_intrinsic_base() on load_ubo, this would be easy.  As we
don't, emit a subtract at address deref time.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>
src/gallium/auxiliary/nir/nir_to_tgsi.c