util/format: Use correct pipe format for VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM.
[mesa.git] / src / vulkan / util / vk_format.c
index 4fdfb6d5a623a43a2b10c80f3de7b9100399bc46..2b89e0bdeeaedccb1878e727c22a45c58d60958d 100644 (file)
@@ -171,7 +171,7 @@ static const enum pipe_format vk_format_map[] = {
    [VK_FORMAT_X8_D24_UNORM_PACK32] = PIPE_FORMAT_Z24X8_UNORM,
    [VK_FORMAT_D32_SFLOAT] = PIPE_FORMAT_Z32_FLOAT,
    [VK_FORMAT_S8_UINT] = PIPE_FORMAT_S8_UINT,
-   /* Missing D16_UNORM_S8_UINT */
+   [VK_FORMAT_D16_UNORM_S8_UINT] = PIPE_FORMAT_Z16_UNORM_S8_UINT,
    [VK_FORMAT_D24_UNORM_S8_UINT] = PIPE_FORMAT_Z24_UNORM_S8_UINT,
    [VK_FORMAT_D32_SFLOAT_S8_UINT] = PIPE_FORMAT_Z32_FLOAT_S8X24_UINT,
 
@@ -183,6 +183,10 @@ static const enum pipe_format vk_format_map[] = {
    [VK_FORMAT_BC2_SRGB_BLOCK] = PIPE_FORMAT_DXT3_SRGBA,
    [VK_FORMAT_BC3_UNORM_BLOCK] = PIPE_FORMAT_DXT5_RGBA,
    [VK_FORMAT_BC3_SRGB_BLOCK] = PIPE_FORMAT_DXT5_SRGBA,
+   [VK_FORMAT_BC4_UNORM_BLOCK] = PIPE_FORMAT_RGTC1_UNORM,
+   [VK_FORMAT_BC4_SNORM_BLOCK] = PIPE_FORMAT_RGTC1_SNORM,
+   [VK_FORMAT_BC5_UNORM_BLOCK] = PIPE_FORMAT_RGTC2_UNORM,
+   [VK_FORMAT_BC5_SNORM_BLOCK] = PIPE_FORMAT_RGTC2_SNORM,
    [VK_FORMAT_BC6H_UFLOAT_BLOCK] = PIPE_FORMAT_BPTC_RGB_UFLOAT,
    [VK_FORMAT_BC6H_SFLOAT_BLOCK] = PIPE_FORMAT_BPTC_RGB_FLOAT,
    [VK_FORMAT_BC7_UNORM_BLOCK] = PIPE_FORMAT_BPTC_RGBA_UNORM,
@@ -240,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_IYUV;
+      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);