turnip: move enum translation functions to a common header
authorJonathan Marek <jonathan@marek.ca>
Wed, 17 Jun 2020 20:05:07 +0000 (16:05 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 18 Jun 2020 19:45:44 +0000 (19:45 +0000)
commitf8110226baa8239540bedbb6c2ae95812f0cbc4b
tree4e016022ae25fa215b99879bbffb96a557543c16
parentf7cc7079b0d2e3499c71fce1d08bac4b94ae745e
turnip: move enum translation functions to a common header

Instead of having these functions sprinkled around the driver (and ending
with a duplicated tu6_compare_func for example), move everything to a
common header (using the previously unused tu_util.h).

Also applied some simplifications: using a cast when the HW enum matches
the VK enum, and using a lookup table when it makes sense (which is IMO
nicer than the switch case way).

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5538>
src/freedreno/vulkan/tu_cmd_buffer.c
src/freedreno/vulkan/tu_device.c
src/freedreno/vulkan/tu_formats.c
src/freedreno/vulkan/tu_image.c
src/freedreno/vulkan/tu_pipeline.c
src/freedreno/vulkan/tu_private.h
src/freedreno/vulkan/tu_util.h