From: Jonathan Marek Date: Wed, 8 Apr 2020 03:40:37 +0000 (-0400) Subject: util/format: translate 422_UNORM and 420_UNORM vulkan formats X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=75d7ee80291d6693ca2611bf8ad2bb14a34588db;p=mesa.git util/format: translate 422_UNORM and 420_UNORM vulkan formats Signed-off-by: Jonathan Marek Part-of: --- diff --git a/src/vulkan/util/vk_format.c b/src/vulkan/util/vk_format.c index f23575958b3..9afe89f7f20 100644 --- a/src/vulkan/util/vk_format.c +++ b/src/vulkan/util/vk_format.c @@ -244,8 +244,20 @@ static const enum pipe_format vk_format_map[] = { enum pipe_format vk_format_to_pipe_format(enum VkFormat vkformat) { - if (vkformat >= ARRAY_SIZE(vk_format_map)) - return PIPE_FORMAT_NONE; + if (vkformat >= ARRAY_SIZE(vk_format_map)) { + switch (vkformat) { + case VK_FORMAT_G8B8G8R8_422_UNORM: + return PIPE_FORMAT_YUYV; + case VK_FORMAT_B8G8R8G8_422_UNORM: + return PIPE_FORMAT_UYVY; + case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM: + return PIPE_FORMAT_YV12; + case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM: + return PIPE_FORMAT_NV12; + default: + return PIPE_FORMAT_NONE; + } + } /* Unpopulated entries in the table must be PIPE_FORMAT_NONE */ STATIC_ASSERT(PIPE_FORMAT_NONE == 0);