v3d: fix texture packing lowering
authorIago Toral Quiroga <itoral@igalia.com>
Mon, 7 Aug 2023 11:43:03 +0000 (13:43 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 10 Aug 2023 07:10:01 +0000 (07:10 +0000)
commit6ae2844c520b16d19f7f51650bf4b87e2d6f3749
treee99272fdc41c035a12a962310bf83b5e208ad6bd
parentd28e5960e551910291b0348c89d6554c48cda38c
v3d: fix texture packing lowering

For texture instructions that don't have sampler state we have
been incorrectly using sampler index to retrive texture packing
information. This is incorrect for two reasons:

1. These instructions don't have a defined sampler index by
   definition.
2. The driver was not setting it either, so effectively, we
   have always been using whatever we had set for the first
   texture, which is obviously bogus.

Fix this by running a lowering pass that sets the index to use
in backend_flags, which is what the compiler expects, based on
the texture index, which is what we want in GL since we make
this decision based on the texture format.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24537>
src/gallium/drivers/v3d/v3d_program.c