pan/midgard: Make sure we pass the right RT id to emit_fragment_store()
authorBoris Brezillon <boris.brezillon@collabora.com>
Fri, 31 Jan 2020 08:22:50 +0000 (09:22 +0100)
committerMarge Bot <eric+marge@anholt.net>
Mon, 3 Feb 2020 12:53:47 +0000 (12:53 +0000)
commitc68cd39eb3797eb34a049950cb34acfd0719cde7
tree1c1b17ab0ef8c6c6064f439fb2b5544001e27bf8
parent25946be4c451fe1cc645a6fd3cb5d59160e93f25
pan/midgard: Make sure we pass the right RT id to emit_fragment_store()

nir_intrinsic_base() is assigned nir_variable.data.driver_location,
which is assigned a unique ID based on the variable position in the
shader variable list. There's no guarantee that this position will
match the RT id we want to pass to emit_fragment_store().

Add a search_var() helper to retrieve a nir_variable based on its driver
location, so we can pass the right RT value to emit_fragment_store().

We also make sure the shader output is color, since emit_fragment_store()
is not ready for depth/stencil stores yet.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3676>
src/panfrost/midgard/midgard_compile.c