mesa: Refactor the entirety of _mesa_format_matches_format_and_type().

This function was difficult to implement for new formats due to the
combination of endianness and swapbytes support.  Since it's mostly
used for fast paths, bugs in it were often missed during testing.

Just reimplement it on top of the recent
_mesa_format_from_format_and_type() which can give us a canonical
MESA_FORMAT for a format and type enum (while respecting endianness).

Fixes:
- R4G4B4A4_UNORM, B4G4R4_UINT, R4G4B4A4_UINT incorrectly matched with
  swapBytes (you can't just reverse the channels if the channels
  aren't bytes)
- A4R4G4B4_UNORM and A4R4G4B4_UINT missing BGRA/4444_REV matches
- failing to match RGB/BGR unorm8 array formats on BE
- 2101010 formats incorrectly matching with swapBytes set.
- UINT/SINT byte formats failed to match with swapBytes set.

This deletes the part of tests/mesa_formats.cpp that called
_mesa_format_matches_format_and_type() to make sure it didn't
assertion fail, as it now would assertion fail due to the fact that we
were passing an invalid format (GL_RG) for most types.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
49 jobs for !2355 with mesa-less-formats in 32 minutes and 15 seconds (queued for 6 seconds)
detached
Status Job ID Name Coverage
  Container
passed #767995
debian-10

00:00:19

passed #767996
debian-9

00:00:20

passed #767994
lava-container:arm64

00:00:17

passed #767993
lava-container:armhf

00:00:19

passed #767997
aarch64
test-container:arm64

00:00:19

 
  Build
passed #767999
lava-build:arm64

00:02:36

passed #767998
lava-build:armhf

00:02:56

passed #768002
meson-arm64

00:19:27

passed #768001
meson-armhf

00:17:39

passed #768004
meson-clang

00:09:10

passed #768007
meson-clover

00:05:32

passed #768008
meson-clover-old-llvm

00:05:08

passed #768010
meson-i386

00:03:31

passed #768000
meson-main

00:24:42

passed #768011
meson-mingw32-x86_64

00:04:29

passed #768003
meson-swr-glvnd

00:02:40

passed #768009
meson-vulkan

00:03:04

passed #768012
scons

00:10:37

passed #768013
scons-old-llvm

00:11:53

passed #768005
scons-swr

00:19:53

passed #768006
scons-win64

00:05:41

 
  Test
passed #768038
db410c
arm64_a306_gles2 1/4

00:03:38

passed #768039
db410c
arm64_a306_gles2 2/4

00:04:32

passed #768040
db410c
arm64_a306_gles2 3/4

00:03:37

passed #768041
db410c
arm64_a306_gles2 4/4

00:03:53

passed #768027
mesa-cheza
arm64_a630_gles2

00:04:28

passed #768028
mesa-cheza
arm64_a630_gles31 1/4

00:04:12

passed #768029
mesa-cheza
arm64_a630_gles31 2/4

00:05:13

passed #768030
mesa-cheza
arm64_a630_gles31 3/4

00:05:09

passed #768031
mesa-cheza
arm64_a630_gles31 4/4

00:04:41

passed #768032
mesa-cheza
arm64_a630_gles3 1/6

00:03:20

passed #768033
mesa-cheza
arm64_a630_gles3 2/6

00:03:25

passed #768034
mesa-cheza
arm64_a630_gles3 3/6

00:03:22

passed #768035
mesa-cheza
arm64_a630_gles3 4/6

00:03:33

passed #768036
mesa-cheza
arm64_a630_gles3 5/6

00:03:16

passed #768037
mesa-cheza
arm64_a630_gles3 6/6

00:03:40

passed #768017
lava-meson-gxl-s905x-libretech-cc
lima-test:arm64

00:05:18

passed #768016
lava-sun8i-h3-libretech-all-h3-cc
lima-test:armhf

00:19:21

passed #768014
lava-rk3288-veyron-jaq
panfrost-t760-test:armhf

00:05:15

passed #768015
lava-rk3399-gru-kevin
panfrost-t860-test:arm64

00:07:08

passed #768018
test-llvmpipe-gles2 1/4

00:03:38

passed #768019
test-llvmpipe-gles2 2/4

00:03:26

passed #768020
test-llvmpipe-gles2 3/4

00:03:09

passed #768021
test-llvmpipe-gles2 4/4

00:03:34

passed #768022
test-softpipe-gles2 1/4

00:01:58

passed #768023
test-softpipe-gles2 2/4

00:01:30

passed #768024
test-softpipe-gles2 3/4

00:01:31

passed #768025
test-softpipe-gles2 4/4

00:01:36

passed #768026
test-softpipe-gles3-limited

00:03:58