v3dv: use new texture shader state rb_swap and reverse fields in v3d 7.x
authorIago Toral Quiroga <itoral@igalia.com>
Mon, 15 May 2023 22:38:40 +0000 (00:38 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 13 Oct 2023 22:37:43 +0000 (22:37 +0000)
commit147112cfb17d38ca248843727e3b252db0593d98
treecb3885bc456bc50d95ff6d5c7fbff42e39795e9f
parent6fe85136ef49dcaeb571a2b8b129c4b1197e6d8f
v3dv: use new texture shader state rb_swap and reverse fields in v3d 7.x

In v3d 4.x we handle formats that are reversed or R/B swapped by
applying a format swizzle. This doesn't work on border colors though,
and for that there is a specific bit to reverse the border color in
the texture shader state.

In v3d 7.x we have new reverse and swap R/B bits and we no longer have
a bit to reverse the border color because the new reverse bit applies
to border texels too. Because of this, we absolutely need to use these
new bits in order to get correct border colors in all cases with these
formats.

When we enable the reverse and/or swap R/B bits, we are effectively
applying the format swizzle through them, so in these cases we need to
make sure the swizzle we program in the texture shader state is the
view swizzle provided by the API and not the composition of the format
swizzle with the view swizzle like we do in 4.x for all formats. The
same applies to custom border colors: we must not apply the format
swizzle to them for formats that are reversed or R/B swapped, because
again, this format swizzle is already applied through these new bits.

While we are doing this, we also fully adopt the texture shader state
spec from v3d 7.1.5 for v3d 7.x instead of using a description from
7.1.2 which is incompatible and required the driver to manually pack
some of the bits.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25450>
src/broadcom/vulkan/v3dv_device.c
src/broadcom/vulkan/v3dv_image.c
src/broadcom/vulkan/v3dv_private.h
src/broadcom/vulkan/v3dvx_device.c
src/broadcom/vulkan/v3dvx_image.c
src/broadcom/vulkan/v3dvx_private.h
src/gallium/drivers/v3d/v3dx_state.c