vulkan/format: Use correct swizzle for 1-plane YCbCr formats
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Thu, 10 Aug 2023 18:54:40 +0000 (13:54 -0500)
committerMarge Bot <emma+marge@anholt.net>
Mon, 14 Aug 2023 23:44:19 +0000 (23:44 +0000)
commiteb23ce91b537969f2d113f5228345f92173ec813
tree363626f31b2d6caccb8d0a01e1a22f1984e5d7f0
parentb9870275b12587a6a42620d2721600487859015d
vulkan/format: Use correct swizzle for 1-plane YCbCr formats

VK_FORMAT_G8B8G8R8_422_UNORM and VK_FORMAT_B8G8R8G8_422_UNORM already
place the luminance channel in the green component which is where we NIR
lowering code for ycbcr expects it.  Set an RGBA swizzle in the common
format table and make it the driver's responsibility to re-map the
formats as needed for their hardware.

The only Vulkan drivers affected by this change are the Intel drivers
and lavapipe.  None of NVK, RADV, and v3dv support these formats yet and
Turnip has its own lowering that doesn't rely on the YCbCr format table
in util/vk_format.c.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24619>
src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c
src/intel/vulkan/anv_formats.c
src/intel/vulkan_hasvk/anv_formats.c
src/vulkan/util/vk_format.c