nir: add dual-slot input information into load_input intrinsics
authorMarek Olšák <marek.olsak@amd.com>
Mon, 13 Mar 2023 04:18:47 +0000 (00:18 -0400)
committerMarge Bot <emma+marge@anholt.net>
Sat, 7 Oct 2023 11:18:40 +0000 (11:18 +0000)
commit0f2491cbddf80a4c95df5d57ae438b130288f013
treec240c09ad7a244674a7a856e608f8e8343318f30
parent97f3fdadcaa098f2f4396230969ead008e28eb6a
nir: add dual-slot input information into load_input intrinsics

This is necessary to allow optimizing VS inputs after nir_lower_io, which
is currently impossible because the loss of dual-slot information in NIR
would break VS inputs. With this, driver locations can be recomputed by
calling nir_recompute_io_bases. It's a prerequisite for optimizing varyings
with lowered IO.

When this is used, we will be able to eliminate unused dual-slot VS inputs
as well as unused low and high halves of dual-slot VS inputs for the first
time, which can happen due to optimizations of varyings. Without this,
st/mesa binds vertex buffers for dual-slot inputs that are fully or
partially unused in the shader.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25394>
src/compiler/nir/nir.h
src/compiler/nir/nir_lower_io.c
src/compiler/nir/nir_print.c