pan/bi: Fix dual texturing with uniforms
authorAlyssa Rosenzweig <alyssa@collabora.com>
Thu, 1 Sep 2022 19:11:36 +0000 (15:11 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 2 Sep 2022 12:44:08 +0000 (12:44 +0000)
commitc5b9a01feaa6e46827a8af003767d561d5c22fec
tree33d00a974758f2cd51e5af02664aab36207da125
parentd01cbced85211bfd3141f5ccf8c46106bdd1bdcc
pan/bi: Fix dual texturing with uniforms

The GLSL code sequence:

   texture2D(tex0, u_coords) + texture2D(tex1, u_coords)

will be optimized to

   TEXC_DUAL tex0/tex1, u_coords, #texture_descriptor

If this optimization happens after lowering FAU, the resulting TEXC instruction
is unschedulable: both the uniform and the constant descriptor fight for the
same FAU slot.

However, if this optimization happens before lowering FAU, then the FAU lowering
will move the descriptor into a register, complicating the dual texturing fixup
in RA.

To fix this interaction, fuse dual texturing before lowering FAU and keep
texture descriptors as constants when lowering FAU of TEXC.

Fixes scheduling failure in piglit drawoverhead -test 3 with uniform reordering.

Fixes: a4d3a296477 ("pan/bi: Enable dual texture fusing pass")
Fixes: 6b2eda6b729 ("pan/bi: Reorder pushed uniforms to avoid moves")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18378>
src/panfrost/bifrost/bi_schedule.c
src/panfrost/bifrost/bifrost_compile.c