<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 15, 2017 at 7:11 AM, Lionel Landwerlin <span dir="ltr"><<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a><wbr>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">A given Vulkan format can now be decomposed into a set of planes. We<br>
now use 'struct anv_format_plane' to represent the format of those<br>
planes.<br>
<br>
Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a><wbr>><br>
---<br>
 src/intel/vulkan/anv_blorp.c     |  31 +--<br>
 src/intel/vulkan/anv_formats.<wbr>c   | 513 +++++++++++++++++++++---------<wbr>---------<br>
 src/intel/vulkan/anv_image.c     |  16 +-<br>
 src/intel/vulkan/anv_private.<wbr>h   |  54 ++++-<br>
 src/intel/vulkan/genX_pipelin<wbr>e.c |  14 +-<br>
 5 files changed, 355 insertions(+), 273 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c<br>
index 915643ffa3c..c1f6eb69ca8 100644<br>
--- a/src/intel/vulkan/anv_blorp.c<br>
+++ b/src/intel/vulkan/anv_blorp.c<br>
@@ -323,8 +323,9 @@ copy_buffer_to_image(struct anv_cmd_buffer *cmd_buffer,<br>
       }<br>
<br>
       const enum isl_format buffer_format =<br>
-         anv_get_isl_format(&cmd_buffe<wbr>r->device->info, anv_image->vk_format,<br>
-                            aspect, VK_IMAGE_TILING_LINEAR);<br>
+         anv_get_isl_plane_format(&<wbr>cmd_buffer->device->info,<br>
+                                  anv_image->vk_format,<br>
+                                  aspect, VK_IMAGE_TILING_LINEAR);<br>
<br>
       const VkExtent3D bufferImageExtent = {<br>
          .width  = pRegions[r].bufferRowLength ?<br>
@@ -459,12 +460,12 @@ void anv_CmdBlitImage(<br>
       get_blorp_surf_for_anv_image(<wbr>dst_image, dst_res->aspectMask,<br>
                                    dst_image->aux_usage, &dst);<br>
<br>
-      struct anv_format src_format =<br>
-         anv_get_format(&cmd_buffer->d<wbr>evice->info, src_image->vk_format,<br>
-                        src_res->aspectMask, src_image->tiling);<br>
-      struct anv_format dst_format =<br>
-         anv_get_format(&cmd_buffer->d<wbr>evice->info, dst_image->vk_format,<br>
-                        dst_res->aspectMask, dst_image->tiling);<br>
+      struct anv_format_plane src_format =<br>
+         anv_get_plane_format(&cmd_buf<wbr>fer->device->info, src_image->vk_format,<br>
+                              src_res->aspectMask, src_image->tiling);<br>
+      struct anv_format_plane dst_format =<br>
+         anv_get_plane_format(&cmd_buf<wbr>fer->device->info, dst_image->vk_format,<br>
+                              dst_res->aspectMask, dst_image->tiling);<br>
<br>
       unsigned dst_start, dst_end;<br>
       if (dst_image->type == VK_IMAGE_TYPE_3D) {<br>
@@ -760,9 +761,9 @@ void anv_CmdClearColorImage(<br>
<br>
       assert(pRanges[r].aspectMask == VK_IMAGE_ASPECT_COLOR_BIT);<br>
<br>
-      struct anv_format src_format =<br>
-         anv_get_format(&cmd_buffer->d<wbr>evice->info, image->vk_format,<br>
-                        VK_IMAGE_ASPECT_COLOR_BIT, image->tiling);<br>
+      struct anv_format_plane src_format =<br>
+         anv_get_plane_format(&cmd_buf<wbr>fer->device->info, image->vk_format,<br>
+                              VK_IMAGE_ASPECT_COLOR_BIT, image->tiling);<br>
<br>
       unsigned base_layer = pRanges[r].baseArrayLayer;<br>
       unsigned layer_count = anv_get_layerCount(image, &pRanges[r]);<br>
@@ -976,10 +977,10 @@ clear_depth_stencil_attachment<wbr>(struct anv_cmd_buffer *cmd_buffer,<br>
<br>
    enum isl_format depth_format = ISL_FORMAT_UNSUPPORTED;<br>
    if (clear_depth) {<br>
-      depth_format = anv_get_isl_format(&cmd_buffer<wbr>->device->info,<br>
-                                        pass_att->format,<br>
-                                        VK_IMAGE_ASPECT_DEPTH_BIT,<br>
-                                        VK_IMAGE_TILING_OPTIMAL);<br>
+      depth_format = anv_get_isl_plane_format(&cmd_<wbr>buffer->device->info,<br>
+                                              pass_att->format,<br>
+                                              VK_IMAGE_ASPECT_DEPTH_BIT,<br>
+                                              VK_IMAGE_TILING_OPTIMAL);<br>
    }<br>
<br>
    uint32_t binding_table;<br>
diff --git a/src/intel/vulkan/anv_formats<wbr>.c b/src/intel/vulkan/anv_formats<wbr>.c<br>
index 47acc56fd04..b311e15ce3f 100644<br>
--- a/src/intel/vulkan/anv_formats<wbr>.c<br>
+++ b/src/intel/vulkan/anv_formats<wbr>.c<br>
@@ -44,249 +44,287 @@<br>
 #define BGRA _ISL_SWIZZLE(BLUE, GREEN, RED, ALPHA)<br>
 #define RGB1 _ISL_SWIZZLE(RED, GREEN, BLUE, ONE)<br>
<br>
-#define swiz_fmt(__vk_fmt, __hw_fmt, __swizzle)     \<br>
-   [__vk_fmt] = { \<br>
-      .isl_format = __hw_fmt, \<br>
-      .swizzle = __swizzle, \<br>
+#define _fmt(__hw_fmt, __swizzle) \<br>
+   { .isl_format = __hw_fmt, \<br>
+     .swizzle = __swizzle }<br>
+<br>
+#define swiz_fmt1(__vk_fmt, __hw_fmt, __swizzle) \<br>
+   [vk_enum_offset(__vk_fmt)] = { \<br></blockquote><div><br></div><div>I think it would be nice to split this into two patches:  One which switches us to table-of-tables and the other adds planes to anv_format.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+      .planes = { \<br>
+          { .isl_format = __hw_fmt, .swizzle = __swizzle },     \<br>
+      }, \<br>
+      .n_planes = 1, \<br>
    }<br>
<br>
-#define fmt(__vk_fmt, __hw_fmt) \<br>
-   swiz_fmt(__vk_fmt, __hw_fmt, RGBA)<br>
+#define fmt1(__vk_fmt, __hw_fmt) \<br>
+   swiz_fmt1(__vk_fmt, __hw_fmt, RGBA)<br>
+<br>
+#define ds_fmt(__vk_fmt, __depth_fmt, __stencil_fmt) \<br>
+   [vk_enum_offset(__vk_fmt)] = { \<br>
+      .planes = { \<br>
+         { .isl_format = __depth_fmt, \<br>
+           .swizzle = RGBA,       \<br>
+         }, \<br>
+         { .isl_format = __stencil_fmt, \<br>
+           .swizzle = RGBA,       \<br>
+         }, \ <br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+      }, \<br>
+      .n_planes = 2, \<br></blockquote><div><br></div><div>It's a bit weird to me that this is only used for combined depth+stencil formats.  I would expect something called ds_fmt to be used for all depth/stencil formats.  However, doing that magic would be rather annoying.  Maybe just call it fmt2?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+   }<br>
<br>
 /* HINT: For array formats, the ISL name should match the VK name.  For<br>
  * packed formats, they should have the channels in reverse order from each<br>
  * other.  The reason for this is that, for packed formats, the ISL (and<br>
  * bspec) names are in LSB -> MSB order while VK formats are MSB -> LSB.<br>
  */<br>
-static const struct anv_format anv_formats[] = {<br>
-   fmt(VK_FORMAT_UNDEFINED,               ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_R4G4_UNORM_PACK<wbr>8,        ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_R4G4B4A4_UNORM_<wbr>PACK16,   ISL_FORMAT_A4B4G4R4_UNORM),<br>
-   swiz_fmt(VK_FORMAT_B4G4R4A4_U<wbr>NORM_PACK16,   ISL_FORMAT_A4B4G4R4_UNORM,  BGRA),<br>
-   fmt(VK_FORMAT_R5G6B5_UNORM_PA<wbr>CK16,     ISL_FORMAT_B5G6R5_UNORM),<br>
-   swiz_fmt(VK_FORMAT_B5G6R5_UNO<wbr>RM_PACK16,     ISL_FORMAT_B5G6R5_UNORM, BGRA),<br>
-   fmt(VK_FORMAT_R5G5B5A1_UNORM_<wbr>PACK16,   ISL_FORMAT_A1B5G5R5_UNORM),<br>
-   fmt(VK_FORMAT_B5G5R5A1_UNORM_<wbr>PACK16,   ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_A1R5G5B5_UNORM_<wbr>PACK16,   ISL_FORMAT_B5G5R5A1_UNORM),<br>
-   fmt(VK_FORMAT_R8_UNORM,                ISL_FORMAT_R8_UNORM),<br>
-   fmt(VK_FORMAT_R8_SNORM,                ISL_FORMAT_R8_SNORM),<br>
-   fmt(VK_FORMAT_R8_USCALED,              ISL_FORMAT_R8_USCALED),<br>
-   fmt(VK_FORMAT_R8_SSCALED,              ISL_FORMAT_R8_SSCALED),<br>
-   fmt(VK_FORMAT_R8_UINT,                 ISL_FORMAT_R8_UINT),<br>
-   fmt(VK_FORMAT_R8_SINT,                 ISL_FORMAT_R8_SINT),<br>
-   fmt(VK_FORMAT_R8_SRGB,                 ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_R8G8_UNORM,              ISL_FORMAT_R8G8_UNORM),<br>
-   fmt(VK_FORMAT_R8G8_SNORM,              ISL_FORMAT_R8G8_SNORM),<br>
-   fmt(VK_FORMAT_R8G8_USCALED,            ISL_FORMAT_R8G8_USCALED),<br>
-   fmt(VK_FORMAT_R8G8_SSCALED,            ISL_FORMAT_R8G8_SSCALED),<br>
-   fmt(VK_FORMAT_R8G8_UINT,               ISL_FORMAT_R8G8_UINT),<br>
-   fmt(VK_FORMAT_R8G8_SINT,               ISL_FORMAT_R8G8_SINT),<br>
-   fmt(VK_FORMAT_R8G8_SRGB,               ISL_FORMAT_UNSUPPORTED), /* L8A8_UNORM_SRGB */<br>
-   fmt(VK_FORMAT_R8G8B8_UNORM,            ISL_FORMAT_R8G8B8_UNORM),<br>
-   fmt(VK_FORMAT_R8G8B8_SNORM,            ISL_FORMAT_R8G8B8_SNORM),<br>
-   fmt(VK_FORMAT_R8G8B8_USCALED,<wbr>          ISL_FORMAT_R8G8B8_USCALED),<br>
-   fmt(VK_FORMAT_R8G8B8_SSCALED,<wbr>          ISL_FORMAT_R8G8B8_SSCALED),<br>
-   fmt(VK_FORMAT_R8G8B8_UINT,             ISL_FORMAT_R8G8B8_UINT),<br>
-   fmt(VK_FORMAT_R8G8B8_SINT,             ISL_FORMAT_R8G8B8_SINT),<br>
-   fmt(VK_FORMAT_R8G8B8_SRGB,             ISL_FORMAT_R8G8B8_UNORM_SRGB)<wbr>,<br>
-   fmt(VK_FORMAT_R8G8B8A8_UNORM,<wbr>          ISL_FORMAT_R8G8B8A8_UNORM),<br>
-   fmt(VK_FORMAT_R8G8B8A8_SNORM,<wbr>          ISL_FORMAT_R8G8B8A8_SNORM),<br>
-   fmt(VK_FORMAT_R8G8B8A8_USCALE<wbr>D,        ISL_FORMAT_R8G8B8A8_USCALED),<br>
-   fmt(VK_FORMAT_R8G8B8A8_SSCALE<wbr>D,        ISL_FORMAT_R8G8B8A8_SSCALED),<br>
-   fmt(VK_FORMAT_R8G8B8A8_UINT,           ISL_FORMAT_R8G8B8A8_UINT),<br>
-   fmt(VK_FORMAT_R8G8B8A8_SINT,           ISL_FORMAT_R8G8B8A8_SINT),<br>
-   fmt(VK_FORMAT_R8G8B8A8_SRGB,           ISL_FORMAT_R8G8B8A8_UNORM_SRG<wbr>B),<br>
-   fmt(VK_FORMAT_A8B8G8R8_UNORM_<wbr>PACK32,   ISL_FORMAT_R8G8B8A8_UNORM),<br>
-   fmt(VK_FORMAT_A8B8G8R8_SNORM_<wbr>PACK32,   ISL_FORMAT_R8G8B8A8_SNORM),<br>
-   fmt(VK_FORMAT_A8B8G8R8_USCALE<wbr>D_PACK32, ISL_FORMAT_R8G8B8A8_USCALED),<br>
-   fmt(VK_FORMAT_A8B8G8R8_SSCALE<wbr>D_PACK32, ISL_FORMAT_R8G8B8A8_SSCALED),<br>
-   fmt(VK_FORMAT_A8B8G8R8_UINT_P<wbr>ACK32,    ISL_FORMAT_R8G8B8A8_UINT),<br>
-   fmt(VK_FORMAT_A8B8G8R8_SINT_P<wbr>ACK32,    ISL_FORMAT_R8G8B8A8_SINT),<br>
-   fmt(VK_FORMAT_A8B8G8R8_SRGB_P<wbr>ACK32,    ISL_FORMAT_R8G8B8A8_UNORM_SRGB<wbr>),<br>
-   fmt(VK_FORMAT_A2R10G10B10_UNO<wbr>RM_PACK32, ISL_FORMAT_B10G10R10A2_UNORM),<br>
-   fmt(VK_FORMAT_A2R10G10B10_SNO<wbr>RM_PACK32, ISL_FORMAT_B10G10R10A2_SNORM),<br>
-   fmt(VK_FORMAT_A2R10G10B10_USC<wbr>ALED_PACK32, ISL_FORMAT_B10G10R10A2_USCALED<wbr>),<br>
-   fmt(VK_FORMAT_A2R10G10B10_SSC<wbr>ALED_PACK32, ISL_FORMAT_B10G10R10A2_SSCALED<wbr>),<br>
-   fmt(VK_FORMAT_A2R10G10B10_UIN<wbr>T_PACK32, ISL_FORMAT_B10G10R10A2_UINT),<br>
-   fmt(VK_FORMAT_A2R10G10B10_SIN<wbr>T_PACK32, ISL_FORMAT_B10G10R10A2_SINT),<br>
-   fmt(VK_FORMAT_A2B10G10R10_UNO<wbr>RM_PACK32, ISL_FORMAT_R10G10B10A2_UNORM),<br>
-   fmt(VK_FORMAT_A2B10G10R10_SNO<wbr>RM_PACK32, ISL_FORMAT_R10G10B10A2_SNORM),<br>
-   fmt(VK_FORMAT_A2B10G10R10_USC<wbr>ALED_PACK32, ISL_FORMAT_R10G10B10A2_USCALED<wbr>),<br>
-   fmt(VK_FORMAT_A2B10G10R10_SSC<wbr>ALED_PACK32, ISL_FORMAT_R10G10B10A2_SSCALED<wbr>),<br>
-   fmt(VK_FORMAT_A2B10G10R10_UIN<wbr>T_PACK32, ISL_FORMAT_R10G10B10A2_UINT),<br>
-   fmt(VK_FORMAT_A2B10G10R10_SIN<wbr>T_PACK32, ISL_FORMAT_R10G10B10A2_SINT),<br>
-   fmt(VK_FORMAT_R16_UNORM,               ISL_FORMAT_R16_UNORM),<br>
-   fmt(VK_FORMAT_R16_SNORM,               ISL_FORMAT_R16_SNORM),<br>
-   fmt(VK_FORMAT_R16_USCALED,             ISL_FORMAT_R16_USCALED),<br>
-   fmt(VK_FORMAT_R16_SSCALED,             ISL_FORMAT_R16_SSCALED),<br>
-   fmt(VK_FORMAT_R16_UINT,                ISL_FORMAT_R16_UINT),<br>
-   fmt(VK_FORMAT_R16_SINT,                ISL_FORMAT_R16_SINT),<br>
-   fmt(VK_FORMAT_R16_SFLOAT,              ISL_FORMAT_R16_FLOAT),<br>
-   fmt(VK_FORMAT_R16G16_UNORM,            ISL_FORMAT_R16G16_UNORM),<br>
-   fmt(VK_FORMAT_R16G16_SNORM,            ISL_FORMAT_R16G16_SNORM),<br>
-   fmt(VK_FORMAT_R16G16_USCALED,<wbr>          ISL_FORMAT_R16G16_USCALED),<br>
-   fmt(VK_FORMAT_R16G16_SSCALED,<wbr>          ISL_FORMAT_R16G16_SSCALED),<br>
-   fmt(VK_FORMAT_R16G16_UINT,             ISL_FORMAT_R16G16_UINT),<br>
-   fmt(VK_FORMAT_R16G16_SINT,             ISL_FORMAT_R16G16_SINT),<br>
-   fmt(VK_FORMAT_R16G16_SFLOAT,           ISL_FORMAT_R16G16_FLOAT),<br>
-   fmt(VK_FORMAT_R16G16B16_<wbr>UNORM,         ISL_FORMAT_R16G16B16_UNORM),<br>
-   fmt(VK_FORMAT_R16G16B16_<wbr>SNORM,         ISL_FORMAT_R16G16B16_SNORM),<br>
-   fmt(VK_FORMAT_R16G16B16_USCAL<wbr>ED,       ISL_FORMAT_R16G16B16_USCALED)<wbr>,<br>
-   fmt(VK_FORMAT_R16G16B16_SSCAL<wbr>ED,       ISL_FORMAT_R16G16B16_SSCALED)<wbr>,<br>
-   fmt(VK_FORMAT_R16G16B16_UINT,<wbr>          ISL_FORMAT_R16G16B16_UINT),<br>
-   fmt(VK_FORMAT_R16G16B16_SINT,<wbr>          ISL_FORMAT_R16G16B16_SINT),<br>
-   fmt(VK_FORMAT_R16G16B16_SFLOA<wbr>T,        ISL_FORMAT_R16G16B16_FLOAT),<br>
-   fmt(VK_FORMAT_R16G16B16A16_UN<wbr>ORM,      ISL_FORMAT_R16G16B16A16_UNORM)<wbr>,<br>
-   fmt(VK_FORMAT_R16G16B16A16_SN<wbr>ORM,      ISL_FORMAT_R16G16B16A16_SNORM)<wbr>,<br>
-   fmt(VK_FORMAT_R16G16B16A16_US<wbr>CALED,    ISL_FORMAT_R16G16B16A16_USCALE<wbr>D),<br>
-   fmt(VK_FORMAT_R16G16B16A16_SS<wbr>CALED,    ISL_FORMAT_R16G16B16A16_SSCALE<wbr>D),<br>
-   fmt(VK_FORMAT_R16G16B16A16_UI<wbr>NT,       ISL_FORMAT_R16G16B16A16_UINT)<wbr>,<br>
-   fmt(VK_FORMAT_R16G16B16A16_SI<wbr>NT,       ISL_FORMAT_R16G16B16A16_SINT)<wbr>,<br>
-   fmt(VK_FORMAT_R16G16B16A16_SF<wbr>LOAT,     ISL_FORMAT_R16G16B16A16_<wbr>FLOAT),<br>
-   fmt(VK_FORMAT_R32_UINT,                ISL_FORMAT_R32_UINT),<br>
-   fmt(VK_FORMAT_R32_SINT,                ISL_FORMAT_R32_SINT),<br>
-   fmt(VK_FORMAT_R32_SFLOAT,              ISL_FORMAT_R32_FLOAT),<br>
-   fmt(VK_FORMAT_R32G32_UINT,             ISL_FORMAT_R32G32_UINT),<br>
-   fmt(VK_FORMAT_R32G32_SINT,             ISL_FORMAT_R32G32_SINT),<br>
-   fmt(VK_FORMAT_R32G32_SFLOAT,           ISL_FORMAT_R32G32_FLOAT),<br>
-   fmt(VK_FORMAT_R32G32B32_UINT,<wbr>          ISL_FORMAT_R32G32B32_UINT),<br>
-   fmt(VK_FORMAT_R32G32B32_SINT,<wbr>          ISL_FORMAT_R32G32B32_SINT),<br>
-   fmt(VK_FORMAT_R32G32B32_SFLOA<wbr>T,        ISL_FORMAT_R32G32B32_FLOAT),<br>
-   fmt(VK_FORMAT_R32G32B32A32_UI<wbr>NT,       ISL_FORMAT_R32G32B32A32_UINT)<wbr>,<br>
-   fmt(VK_FORMAT_R32G32B32A32_SI<wbr>NT,       ISL_FORMAT_R32G32B32A32_SINT)<wbr>,<br>
-   fmt(VK_FORMAT_R32G32B32A32_SF<wbr>LOAT,     ISL_FORMAT_R32G32B32A32_<wbr>FLOAT),<br>
-   fmt(VK_FORMAT_R64_UINT,                ISL_FORMAT_R64_PASSTHRU),<br>
-   fmt(VK_FORMAT_R64_SINT,                ISL_FORMAT_R64_PASSTHRU),<br>
-   fmt(VK_FORMAT_R64_SFLOAT,              ISL_FORMAT_R64_PASSTHRU),<br>
-   fmt(VK_FORMAT_R64G64_UINT,             ISL_FORMAT_R64G64_PASSTHRU),<br>
-   fmt(VK_FORMAT_R64G64_SINT,             ISL_FORMAT_R64G64_PASSTHRU),<br>
-   fmt(VK_FORMAT_R64G64_SFLOAT,           ISL_FORMAT_R64G64_PASSTHRU),<br>
-   fmt(VK_FORMAT_R64G64B64_UINT,<wbr>          ISL_FORMAT_R64G64B64_PASSTHRU)<wbr>,<br>
-   fmt(VK_FORMAT_R64G64B64_SINT,<wbr>          ISL_FORMAT_R64G64B64_PASSTHRU)<wbr>,<br>
-   fmt(VK_FORMAT_R64G64B64_SFLOA<wbr>T,        ISL_FORMAT_R64G64B64_PASSTHRU)<wbr>,<br>
-   fmt(VK_FORMAT_R64G64B64A64_UI<wbr>NT,       ISL_FORMAT_R64G64B64A64_PASST<wbr>HRU),<br>
-   fmt(VK_FORMAT_R64G64B64A64_SI<wbr>NT,       ISL_FORMAT_R64G64B64A64_PASST<wbr>HRU),<br>
-   fmt(VK_FORMAT_R64G64B64A64_SF<wbr>LOAT,     ISL_FORMAT_R64G64B64A64_PASST<wbr>HRU),<br>
-   fmt(VK_FORMAT_B10G11R11_UFLOA<wbr>T_PACK32, ISL_FORMAT_R11G11B10_FLOAT),<br>
-   fmt(VK_FORMAT_E5B9G9R9_<wbr>UFLOAT_PACK32,  ISL_FORMAT_R9G9B9E5_SHAREDEXP)<wbr>,<br>
-<br>
-   fmt(VK_FORMAT_D16_UNORM,               ISL_FORMAT_R16_UNORM),<br>
-   fmt(VK_FORMAT_X8_D24_UNORM_PA<wbr>CK32,     ISL_FORMAT_R24_UNORM_X8_TYPEL<wbr>ESS),<br>
-   fmt(VK_FORMAT_D32_SFLOAT,              ISL_FORMAT_R32_FLOAT),<br>
-   fmt(VK_FORMAT_S8_UINT,                 ISL_FORMAT_R8_UINT),<br>
-   fmt(VK_FORMAT_D16_UNORM_S8_UI<wbr>NT,       ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_D24_UNORM_S8_UI<wbr>NT,       ISL_FORMAT_R24_UNORM_X8_TYPEL<wbr>ESS),<br>
-   fmt(VK_FORMAT_D32_SFLOAT_S8_U<wbr>INT,      ISL_FORMAT_R32_FLOAT),<br>
-<br>
-   swiz_fmt(VK_FORMAT_BC1_RGB_UN<wbr>ORM_BLOCK,     ISL_FORMAT_BC1_UNORM, RGB1),<br>
-   swiz_fmt(VK_FORMAT_BC1_RGB_SR<wbr>GB_BLOCK,      ISL_FORMAT_BC1_UNORM_SRGB, RGB1),<br>
-   fmt(VK_FORMAT_BC1_RGBA_UNORM_<wbr>BLOCK,    ISL_FORMAT_BC1_UNORM),<br>
-   fmt(VK_FORMAT_BC1_RGBA_SRGB_B<wbr>LOCK,     ISL_FORMAT_BC1_UNORM_SRGB),<br>
-   fmt(VK_FORMAT_BC2_UNORM_<wbr>BLOCK,         ISL_FORMAT_BC2_UNORM),<br>
-   fmt(VK_FORMAT_BC2_SRGB_BLOCK,<wbr>          ISL_FORMAT_BC2_UNORM_SRGB),<br>
-   fmt(VK_FORMAT_BC3_UNORM_<wbr>BLOCK,         ISL_FORMAT_BC3_UNORM),<br>
-   fmt(VK_FORMAT_BC3_SRGB_BLOCK,<wbr>          ISL_FORMAT_BC3_UNORM_SRGB),<br>
-   fmt(VK_FORMAT_BC4_UNORM_<wbr>BLOCK,         ISL_FORMAT_BC4_UNORM),<br>
-   fmt(VK_FORMAT_BC4_SNORM_<wbr>BLOCK,         ISL_FORMAT_BC4_SNORM),<br>
-   fmt(VK_FORMAT_BC5_UNORM_<wbr>BLOCK,         ISL_FORMAT_BC5_UNORM),<br>
-   fmt(VK_FORMAT_BC5_SNORM_<wbr>BLOCK,         ISL_FORMAT_BC5_SNORM),<br>
-   fmt(VK_FORMAT_BC6H_UFLOAT_BLO<wbr>CK,       ISL_FORMAT_BC6H_UF16),<br>
-   fmt(VK_FORMAT_BC6H_SFLOAT_BLO<wbr>CK,       ISL_FORMAT_BC6H_SF16),<br>
-   fmt(VK_FORMAT_BC7_UNORM_<wbr>BLOCK,         ISL_FORMAT_BC7_UNORM),<br>
-   fmt(VK_FORMAT_BC7_SRGB_BLOCK,<wbr>          ISL_FORMAT_BC7_UNORM_SRGB),<br>
-   fmt(VK_FORMAT_ETC2_R8G8B8_UNO<wbr>RM_BLOCK, ISL_FORMAT_ETC2_RGB8),<br>
-   fmt(VK_FORMAT_ETC2_R8G8B8_SRG<wbr>B_BLOCK,  ISL_FORMAT_ETC2_SRGB8),<br>
-   fmt(VK_FORMAT_ETC2_R8G8B8A1_U<wbr>NORM_BLOCK, ISL_FORMAT_ETC2_RGB8_PTA),<br>
-   fmt(VK_FORMAT_ETC2_R8G8B8A1_S<wbr>RGB_BLOCK, ISL_FORMAT_ETC2_SRGB8_PTA),<br>
-   fmt(VK_FORMAT_ETC2_R8G8B8A8_U<wbr>NORM_BLOCK, ISL_FORMAT_ETC2_EAC_RGBA8),<br>
-   fmt(VK_FORMAT_ETC2_R8G8B8A8_S<wbr>RGB_BLOCK, ISL_FORMAT_ETC2_EAC_SRGB8_A8),<br>
-   fmt(VK_FORMAT_EAC_R11_UNORM_B<wbr>LOCK,     ISL_FORMAT_EAC_R11),<br>
-   fmt(VK_FORMAT_EAC_R11_SNORM_B<wbr>LOCK,     ISL_FORMAT_EAC_SIGNED_R11),<br>
-   fmt(VK_FORMAT_EAC_R11G11_UNOR<wbr>M_BLOCK,  ISL_FORMAT_EAC_RG11),<br>
-   fmt(VK_FORMAT_EAC_R11G11_SNOR<wbr>M_BLOCK,  ISL_FORMAT_EAC_SIGNED_RG11),<br>
-   fmt(VK_FORMAT_ASTC_4x4_SRGB_B<wbr>LOCK,     ISL_FORMAT_ASTC_LDR_2D_4X4_U8<wbr>SRGB),<br>
-   fmt(VK_FORMAT_ASTC_5x4_SRGB_B<wbr>LOCK,     ISL_FORMAT_ASTC_LDR_2D_5X4_U8<wbr>SRGB),<br>
-   fmt(VK_FORMAT_ASTC_5x5_SRGB_B<wbr>LOCK,     ISL_FORMAT_ASTC_LDR_2D_5X5_U8<wbr>SRGB),<br>
-   fmt(VK_FORMAT_ASTC_6x5_SRGB_B<wbr>LOCK,     ISL_FORMAT_ASTC_LDR_2D_6X5_U8<wbr>SRGB),<br>
-   fmt(VK_FORMAT_ASTC_6x6_SRGB_B<wbr>LOCK,     ISL_FORMAT_ASTC_LDR_2D_6X6_U8<wbr>SRGB),<br>
-   fmt(VK_FORMAT_ASTC_8x5_SRGB_B<wbr>LOCK,     ISL_FORMAT_ASTC_LDR_2D_8X5_U8<wbr>SRGB),<br>
-   fmt(VK_FORMAT_ASTC_8x6_SRGB_B<wbr>LOCK,     ISL_FORMAT_ASTC_LDR_2D_8X6_U8<wbr>SRGB),<br>
-   fmt(VK_FORMAT_ASTC_8x8_SRGB_B<wbr>LOCK,     ISL_FORMAT_ASTC_LDR_2D_8X8_U8<wbr>SRGB),<br>
-   fmt(VK_FORMAT_ASTC_10x5_SRGB_<wbr>BLOCK,    ISL_FORMAT_ASTC_LDR_2D_10X5_U8<wbr>SRGB),<br>
-   fmt(VK_FORMAT_ASTC_10x6_SRGB_<wbr>BLOCK,    ISL_FORMAT_ASTC_LDR_2D_10X6_U8<wbr>SRGB),<br>
-   fmt(VK_FORMAT_ASTC_10x8_SRGB_<wbr>BLOCK,    ISL_FORMAT_ASTC_LDR_2D_10X8_U8<wbr>SRGB),<br>
-   fmt(VK_FORMAT_ASTC_10x10_<wbr>SRGB_BLOCK,   ISL_FORMAT_ASTC_LDR_2D_10X10_<wbr>U8SRGB),<br>
-   fmt(VK_FORMAT_ASTC_12x10_<wbr>SRGB_BLOCK,   ISL_FORMAT_ASTC_LDR_2D_12X10_<wbr>U8SRGB),<br>
-   fmt(VK_FORMAT_ASTC_12x12_<wbr>SRGB_BLOCK,   ISL_FORMAT_ASTC_LDR_2D_12X12_<wbr>U8SRGB),<br>
-   fmt(VK_FORMAT_ASTC_4x4_UNORM_<wbr>BLOCK,    ISL_FORMAT_ASTC_LDR_2D_4X4_FLT<wbr>16),<br>
-   fmt(VK_FORMAT_ASTC_5x4_UNORM_<wbr>BLOCK,    ISL_FORMAT_ASTC_LDR_2D_5X4_FLT<wbr>16),<br>
-   fmt(VK_FORMAT_ASTC_5x5_UNORM_<wbr>BLOCK,    ISL_FORMAT_ASTC_LDR_2D_5X5_FLT<wbr>16),<br>
-   fmt(VK_FORMAT_ASTC_6x5_UNORM_<wbr>BLOCK,    ISL_FORMAT_ASTC_LDR_2D_6X5_FLT<wbr>16),<br>
-   fmt(VK_FORMAT_ASTC_6x6_UNORM_<wbr>BLOCK,    ISL_FORMAT_ASTC_LDR_2D_6X6_FLT<wbr>16),<br>
-   fmt(VK_FORMAT_ASTC_8x5_UNORM_<wbr>BLOCK,    ISL_FORMAT_ASTC_LDR_2D_8X5_FLT<wbr>16),<br>
-   fmt(VK_FORMAT_ASTC_8x6_UNORM_<wbr>BLOCK,    ISL_FORMAT_ASTC_LDR_2D_8X6_FLT<wbr>16),<br>
-   fmt(VK_FORMAT_ASTC_8x8_UNORM_<wbr>BLOCK,    ISL_FORMAT_ASTC_LDR_2D_8X8_FLT<wbr>16),<br>
-   fmt(VK_FORMAT_ASTC_10x5_<wbr>UNORM_BLOCK,   ISL_FORMAT_ASTC_LDR_2D_10X5_F<wbr>LT16),<br>
-   fmt(VK_FORMAT_ASTC_10x6_<wbr>UNORM_BLOCK,   ISL_FORMAT_ASTC_LDR_2D_10X6_F<wbr>LT16),<br>
-   fmt(VK_FORMAT_ASTC_10x8_<wbr>UNORM_BLOCK,   ISL_FORMAT_ASTC_LDR_2D_10X8_F<wbr>LT16),<br>
-   fmt(VK_FORMAT_ASTC_10x10_UNOR<wbr>M_BLOCK,  ISL_FORMAT_ASTC_LDR_2D_10X10_F<wbr>LT16),<br>
-   fmt(VK_FORMAT_ASTC_12x10_UNOR<wbr>M_BLOCK,  ISL_FORMAT_ASTC_LDR_2D_12X10_F<wbr>LT16),<br>
-   fmt(VK_FORMAT_ASTC_12x12_UNOR<wbr>M_BLOCK,  ISL_FORMAT_ASTC_LDR_2D_12X12_F<wbr>LT16),<br>
-   fmt(VK_FORMAT_B8G8R8_UNORM,            ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_B8G8R8_SNORM,            ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_B8G8R8_USCALED,<wbr>          ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_B8G8R8_SSCALED,<wbr>          ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_B8G8R8_UINT,             ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_B8G8R8_SINT,             ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_B8G8R8_SRGB,             ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_B8G8R8A8_UNORM,<wbr>          ISL_FORMAT_B8G8R8A8_UNORM),<br>
-   fmt(VK_FORMAT_B8G8R8A8_SNORM,<wbr>          ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_B8G8R8A8_USCALE<wbr>D,        ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_B8G8R8A8_SSCALE<wbr>D,        ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_B8G8R8A8_UINT,           ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_B8G8R8A8_SINT,           ISL_FORMAT_UNSUPPORTED),<br>
-   fmt(VK_FORMAT_B8G8R8A8_SRGB,           ISL_FORMAT_B8G8R8A8_UNORM_SRG<wbr>B),<br>
+static const struct anv_format main_formats[] = {<br>
+   fmt1(VK_FORMAT_UNDEFINED,               ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_R4G4_UNORM_PAC<wbr>K8,        ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_R4G4B4A4_<wbr>UNORM_PACK16,   ISL_FORMAT_A4B4G4R4_UNORM),<br>
+   swiz_fmt1(VK_FORMAT_B4G4R4A4_<wbr>UNORM_PACK16,   ISL_FORMAT_A4B4G4R4_UNORM,  BGRA),<br>
+   fmt1(VK_FORMAT_R5G6B5_UNORM_P<wbr>ACK16,     ISL_FORMAT_B5G6R5_UNORM),<br>
+   swiz_fmt1(VK_FORMAT_B5G6R5_UN<wbr>ORM_PACK16,     ISL_FORMAT_B5G6R5_UNORM, BGRA),<br>
+   fmt1(VK_FORMAT_R5G5B5A1_<wbr>UNORM_PACK16,   ISL_FORMAT_A1B5G5R5_UNORM),<br>
+   fmt1(VK_FORMAT_B5G5R5A1_<wbr>UNORM_PACK16,   ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_A1R5G5B5_<wbr>UNORM_PACK16,   ISL_FORMAT_B5G5R5A1_UNORM),<br>
+   fmt1(VK_FORMAT_R8_UNORM,                ISL_FORMAT_R8_UNORM),<br>
+   fmt1(VK_FORMAT_R8_SNORM,                ISL_FORMAT_R8_SNORM),<br>
+   fmt1(VK_FORMAT_R8_USCALED,              ISL_FORMAT_R8_USCALED),<br>
+   fmt1(VK_FORMAT_R8_SSCALED,              ISL_FORMAT_R8_SSCALED),<br>
+   fmt1(VK_FORMAT_R8_UINT,                 ISL_FORMAT_R8_UINT),<br>
+   fmt1(VK_FORMAT_R8_SINT,                 ISL_FORMAT_R8_SINT),<br>
+   fmt1(VK_FORMAT_R8_SRGB,                 ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_R8G8_UNORM,              ISL_FORMAT_R8G8_UNORM),<br>
+   fmt1(VK_FORMAT_R8G8_SNORM,              ISL_FORMAT_R8G8_SNORM),<br>
+   fmt1(VK_FORMAT_R8G8_USCALED,            ISL_FORMAT_R8G8_USCALED),<br>
+   fmt1(VK_FORMAT_R8G8_SSCALED,            ISL_FORMAT_R8G8_SSCALED),<br>
+   fmt1(VK_FORMAT_R8G8_UINT,               ISL_FORMAT_R8G8_UINT),<br>
+   fmt1(VK_FORMAT_R8G8_SINT,               ISL_FORMAT_R8G8_SINT),<br>
+   fmt1(VK_FORMAT_R8G8_SRGB,               ISL_FORMAT_UNSUPPORTED), /* L8A8_UNORM_SRGB */<br>
+   fmt1(VK_FORMAT_R8G8B8_UNORM,            ISL_FORMAT_R8G8B8_UNORM),<br>
+   fmt1(VK_FORMAT_R8G8B8_SNORM,            ISL_FORMAT_R8G8B8_SNORM),<br>
+   fmt1(VK_FORMAT_R8G8B8_<wbr>USCALED,          ISL_FORMAT_R8G8B8_USCALED),<br>
+   fmt1(VK_FORMAT_R8G8B8_<wbr>SSCALED,          ISL_FORMAT_R8G8B8_SSCALED),<br>
+   fmt1(VK_FORMAT_R8G8B8_UINT,             ISL_FORMAT_R8G8B8_UINT),<br>
+   fmt1(VK_FORMAT_R8G8B8_SINT,             ISL_FORMAT_R8G8B8_SINT),<br>
+   fmt1(VK_FORMAT_R8G8B8_SRGB,             ISL_FORMAT_R8G8B8_UNORM_SRGB)<wbr>,<br>
+   fmt1(VK_FORMAT_R8G8B8A8_<wbr>UNORM,          ISL_FORMAT_R8G8B8A8_UNORM),<br>
+   fmt1(VK_FORMAT_R8G8B8A8_<wbr>SNORM,          ISL_FORMAT_R8G8B8A8_SNORM),<br>
+   fmt1(VK_FORMAT_R8G8B8A8_USCAL<wbr>ED,        ISL_FORMAT_R8G8B8A8_USCALED),<br>
+   fmt1(VK_FORMAT_R8G8B8A8_SSCAL<wbr>ED,        ISL_FORMAT_R8G8B8A8_SSCALED),<br>
+   fmt1(VK_FORMAT_R8G8B8A8_UINT,<wbr>           ISL_FORMAT_R8G8B8A8_UINT),<br>
+   fmt1(VK_FORMAT_R8G8B8A8_SINT,<wbr>           ISL_FORMAT_R8G8B8A8_SINT),<br>
+   fmt1(VK_FORMAT_R8G8B8A8_SRGB,<wbr>           ISL_FORMAT_R8G8B8A8_UNORM_SRG<wbr>B),<br>
+   fmt1(VK_FORMAT_A8B8G8R8_<wbr>UNORM_PACK32,   ISL_FORMAT_R8G8B8A8_UNORM),<br>
+   fmt1(VK_FORMAT_A8B8G8R8_<wbr>SNORM_PACK32,   ISL_FORMAT_R8G8B8A8_SNORM),<br>
+   fmt1(VK_FORMAT_A8B8G8R8_USCAL<wbr>ED_PACK32, ISL_FORMAT_R8G8B8A8_USCALED),<br>
+   fmt1(VK_FORMAT_A8B8G8R8_SSCAL<wbr>ED_PACK32, ISL_FORMAT_R8G8B8A8_SSCALED),<br>
+   fmt1(VK_FORMAT_A8B8G8R8_UINT_<wbr>PACK32,    ISL_FORMAT_R8G8B8A8_UINT),<br>
+   fmt1(VK_FORMAT_A8B8G8R8_SINT_<wbr>PACK32,    ISL_FORMAT_R8G8B8A8_SINT),<br>
+   fmt1(VK_FORMAT_A8B8G8R8_SRGB_<wbr>PACK32,    ISL_FORMAT_R8G8B8A8_UNORM_SRGB<wbr>),<br>
+   fmt1(VK_FORMAT_A2R10G10B10_UN<wbr>ORM_PACK32, ISL_FORMAT_B10G10R10A2_UNORM),<br>
+   fmt1(VK_FORMAT_A2R10G10B10_SN<wbr>ORM_PACK32, ISL_FORMAT_B10G10R10A2_SNORM),<br>
+   fmt1(VK_FORMAT_A2R10G10B10_US<wbr>CALED_PACK32, ISL_FORMAT_B10G10R10A2_USCALED<wbr>),<br>
+   fmt1(VK_FORMAT_A2R10G10B10_SS<wbr>CALED_PACK32, ISL_FORMAT_B10G10R10A2_SSCALED<wbr>),<br>
+   fmt1(VK_FORMAT_A2R10G10B10_UI<wbr>NT_PACK32, ISL_FORMAT_B10G10R10A2_UINT),<br>
+   fmt1(VK_FORMAT_A2R10G10B10_SI<wbr>NT_PACK32, ISL_FORMAT_B10G10R10A2_SINT),<br>
+   fmt1(VK_FORMAT_A2B10G10R10_UN<wbr>ORM_PACK32, ISL_FORMAT_R10G10B10A2_UNORM),<br>
+   fmt1(VK_FORMAT_A2B10G10R10_SN<wbr>ORM_PACK32, ISL_FORMAT_R10G10B10A2_SNORM),<br>
+   fmt1(VK_FORMAT_A2B10G10R10_US<wbr>CALED_PACK32, ISL_FORMAT_R10G10B10A2_USCALED<wbr>),<br>
+   fmt1(VK_FORMAT_A2B10G10R10_SS<wbr>CALED_PACK32, ISL_FORMAT_R10G10B10A2_SSCALED<wbr>),<br>
+   fmt1(VK_FORMAT_A2B10G10R10_UI<wbr>NT_PACK32, ISL_FORMAT_R10G10B10A2_UINT),<br>
+   fmt1(VK_FORMAT_A2B10G10R10_SI<wbr>NT_PACK32, ISL_FORMAT_R10G10B10A2_SINT),<br>
+   fmt1(VK_FORMAT_R16_UNORM,               ISL_FORMAT_R16_UNORM),<br>
+   fmt1(VK_FORMAT_R16_SNORM,               ISL_FORMAT_R16_SNORM),<br>
+   fmt1(VK_FORMAT_R16_USCALED,             ISL_FORMAT_R16_USCALED),<br>
+   fmt1(VK_FORMAT_R16_SSCALED,             ISL_FORMAT_R16_SSCALED),<br>
+   fmt1(VK_FORMAT_R16_UINT,                ISL_FORMAT_R16_UINT),<br>
+   fmt1(VK_FORMAT_R16_SINT,                ISL_FORMAT_R16_SINT),<br>
+   fmt1(VK_FORMAT_R16_SFLOAT,              ISL_FORMAT_R16_FLOAT),<br>
+   fmt1(VK_FORMAT_R16G16_UNORM,            ISL_FORMAT_R16G16_UNORM),<br>
+   fmt1(VK_FORMAT_R16G16_SNORM,            ISL_FORMAT_R16G16_SNORM),<br>
+   fmt1(VK_FORMAT_R16G16_<wbr>USCALED,          ISL_FORMAT_R16G16_USCALED),<br>
+   fmt1(VK_FORMAT_R16G16_<wbr>SSCALED,          ISL_FORMAT_R16G16_SSCALED),<br>
+   fmt1(VK_FORMAT_R16G16_UINT,             ISL_FORMAT_R16G16_UINT),<br>
+   fmt1(VK_FORMAT_R16G16_SINT,             ISL_FORMAT_R16G16_SINT),<br>
+   fmt1(VK_FORMAT_R16G16_SFLOAT,<wbr>           ISL_FORMAT_R16G16_FLOAT),<br>
+   fmt1(VK_FORMAT_R16G16B16_UNOR<wbr>M,         ISL_FORMAT_R16G16B16_UNORM),<br>
+   fmt1(VK_FORMAT_R16G16B16_SNOR<wbr>M,         ISL_FORMAT_R16G16B16_SNORM),<br>
+   fmt1(VK_FORMAT_R16G16B16_USCA<wbr>LED,       ISL_FORMAT_R16G16B16_USCALED)<wbr>,<br>
+   fmt1(VK_FORMAT_R16G16B16_SSCA<wbr>LED,       ISL_FORMAT_R16G16B16_SSCALED)<wbr>,<br>
+   fmt1(VK_FORMAT_R16G16B16_<wbr>UINT,          ISL_FORMAT_R16G16B16_UINT),<br>
+   fmt1(VK_FORMAT_R16G16B16_<wbr>SINT,          ISL_FORMAT_R16G16B16_SINT),<br>
+   fmt1(VK_FORMAT_R16G16B16_SFLO<wbr>AT,        ISL_FORMAT_R16G16B16_FLOAT),<br>
+   fmt1(VK_FORMAT_R16G16B16A16_U<wbr>NORM,      ISL_FORMAT_R16G16B16A16_UNORM)<wbr>,<br>
+   fmt1(VK_FORMAT_R16G16B16A16_S<wbr>NORM,      ISL_FORMAT_R16G16B16A16_SNORM)<wbr>,<br>
+   fmt1(VK_FORMAT_R16G16B16A16_U<wbr>SCALED,    ISL_FORMAT_R16G16B16A16_USCALE<wbr>D),<br>
+   fmt1(VK_FORMAT_R16G16B16A16_S<wbr>SCALED,    ISL_FORMAT_R16G16B16A16_SSCALE<wbr>D),<br>
+   fmt1(VK_FORMAT_R16G16B16A16_U<wbr>INT,       ISL_FORMAT_R16G16B16A16_UINT)<wbr>,<br>
+   fmt1(VK_FORMAT_R16G16B16A16_S<wbr>INT,       ISL_FORMAT_R16G16B16A16_SINT)<wbr>,<br>
+   fmt1(VK_FORMAT_R16G16B16A16_S<wbr>FLOAT,     ISL_FORMAT_R16G16B16A16_<wbr>FLOAT),<br>
+   fmt1(VK_FORMAT_R32_UINT,                ISL_FORMAT_R32_UINT),<br>
+   fmt1(VK_FORMAT_R32_SINT,                ISL_FORMAT_R32_SINT),<br>
+   fmt1(VK_FORMAT_R32_SFLOAT,              ISL_FORMAT_R32_FLOAT),<br>
+   fmt1(VK_FORMAT_R32G32_UINT,             ISL_FORMAT_R32G32_UINT),<br>
+   fmt1(VK_FORMAT_R32G32_SINT,             ISL_FORMAT_R32G32_SINT),<br>
+   fmt1(VK_FORMAT_R32G32_SFLOAT,<wbr>           ISL_FORMAT_R32G32_FLOAT),<br>
+   fmt1(VK_FORMAT_R32G32B32_<wbr>UINT,          ISL_FORMAT_R32G32B32_UINT),<br>
+   fmt1(VK_FORMAT_R32G32B32_<wbr>SINT,          ISL_FORMAT_R32G32B32_SINT),<br>
+   fmt1(VK_FORMAT_R32G32B32_SFLO<wbr>AT,        ISL_FORMAT_R32G32B32_FLOAT),<br>
+   fmt1(VK_FORMAT_R32G32B32A32_U<wbr>INT,       ISL_FORMAT_R32G32B32A32_UINT)<wbr>,<br>
+   fmt1(VK_FORMAT_R32G32B32A32_S<wbr>INT,       ISL_FORMAT_R32G32B32A32_SINT)<wbr>,<br>
+   fmt1(VK_FORMAT_R32G32B32A32_S<wbr>FLOAT,     ISL_FORMAT_R32G32B32A32_<wbr>FLOAT),<br>
+   fmt1(VK_FORMAT_R64_UINT,                ISL_FORMAT_R64_PASSTHRU),<br>
+   fmt1(VK_FORMAT_R64_SINT,                ISL_FORMAT_R64_PASSTHRU),<br>
+   fmt1(VK_FORMAT_R64_SFLOAT,              ISL_FORMAT_R64_PASSTHRU),<br>
+   fmt1(VK_FORMAT_R64G64_UINT,             ISL_FORMAT_R64G64_PASSTHRU),<br>
+   fmt1(VK_FORMAT_R64G64_SINT,             ISL_FORMAT_R64G64_PASSTHRU),<br>
+   fmt1(VK_FORMAT_R64G64_SFLOAT,<wbr>           ISL_FORMAT_R64G64_PASSTHRU),<br>
+   fmt1(VK_FORMAT_R64G64B64_<wbr>UINT,          ISL_FORMAT_R64G64B64_PASSTHRU)<wbr>,<br>
+   fmt1(VK_FORMAT_R64G64B64_<wbr>SINT,          ISL_FORMAT_R64G64B64_PASSTHRU)<wbr>,<br>
+   fmt1(VK_FORMAT_R64G64B64_SFLO<wbr>AT,        ISL_FORMAT_R64G64B64_PASSTHRU)<wbr>,<br>
+   fmt1(VK_FORMAT_R64G64B64A64_U<wbr>INT,       ISL_FORMAT_R64G64B64A64_PASST<wbr>HRU),<br>
+   fmt1(VK_FORMAT_R64G64B64A64_S<wbr>INT,       ISL_FORMAT_R64G64B64A64_PASST<wbr>HRU),<br>
+   fmt1(VK_FORMAT_R64G64B64A64_S<wbr>FLOAT,     ISL_FORMAT_R64G64B64A64_PASST<wbr>HRU),<br>
+   fmt1(VK_FORMAT_B10G11R11_UFLO<wbr>AT_PACK32, ISL_FORMAT_R11G11B10_FLOAT),<br>
+   fmt1(VK_FORMAT_E5B9G9R9_UFLOA<wbr>T_PACK32,  ISL_FORMAT_R9G9B9E5_SHAREDEXP)<wbr>,<br>
+<br>
+   fmt1(VK_FORMAT_D16_UNORM,               ISL_FORMAT_R16_UNORM),<br>
+   fmt1(VK_FORMAT_X8_D24_UNORM_P<wbr>ACK32,     ISL_FORMAT_R24_UNORM_X8_TYPEL<wbr>ESS),<br>
+   fmt1(VK_FORMAT_D32_SFLOAT,              ISL_FORMAT_R32_FLOAT),<br>
+   fmt1(VK_FORMAT_S8_UINT,                 ISL_FORMAT_R8_UINT),<br>
+   fmt1(VK_FORMAT_D16_UNORM_S8_U<wbr>INT,       ISL_FORMAT_UNSUPPORTED),<br>
+   ds_fmt(VK_FORMAT_D24_UNORM_<wbr>S8_UINT,     ISL_FORMAT_R24_UNORM_X8_TYPEL<wbr>ESS, ISL_FORMAT_R8_UINT),<br>
+   ds_fmt(VK_FORMAT_D32_SFLOAT_S<wbr>8_UINT,    ISL_FORMAT_R32_FLOAT, ISL_FORMAT_R8_UINT),<br>
+<br>
+   swiz_fmt1(VK_FORMAT_BC1_RGB_U<wbr>NORM_BLOCK,     ISL_FORMAT_BC1_UNORM, RGB1),<br>
+   swiz_fmt1(VK_FORMAT_BC1_RGB_S<wbr>RGB_BLOCK,      ISL_FORMAT_BC1_UNORM_SRGB, RGB1),<br>
+   fmt1(VK_FORMAT_BC1_RGBA_<wbr>UNORM_BLOCK,    ISL_FORMAT_BC1_UNORM),<br>
+   fmt1(VK_FORMAT_BC1_RGBA_SRGB_<wbr>BLOCK,     ISL_FORMAT_BC1_UNORM_SRGB),<br>
+   fmt1(VK_FORMAT_BC2_UNORM_BLOC<wbr>K,         ISL_FORMAT_BC2_UNORM),<br>
+   fmt1(VK_FORMAT_BC2_SRGB_<wbr>BLOCK,          ISL_FORMAT_BC2_UNORM_SRGB),<br>
+   fmt1(VK_FORMAT_BC3_UNORM_BLOC<wbr>K,         ISL_FORMAT_BC3_UNORM),<br>
+   fmt1(VK_FORMAT_BC3_SRGB_<wbr>BLOCK,          ISL_FORMAT_BC3_UNORM_SRGB),<br>
+   fmt1(VK_FORMAT_BC4_UNORM_BLOC<wbr>K,         ISL_FORMAT_BC4_UNORM),<br>
+   fmt1(VK_FORMAT_BC4_SNORM_BLOC<wbr>K,         ISL_FORMAT_BC4_SNORM),<br>
+   fmt1(VK_FORMAT_BC5_UNORM_BLOC<wbr>K,         ISL_FORMAT_BC5_UNORM),<br>
+   fmt1(VK_FORMAT_BC5_SNORM_BLOC<wbr>K,         ISL_FORMAT_BC5_SNORM),<br>
+   fmt1(VK_FORMAT_BC6H_UFLOAT_BL<wbr>OCK,       ISL_FORMAT_BC6H_UF16),<br>
+   fmt1(VK_FORMAT_BC6H_SFLOAT_BL<wbr>OCK,       ISL_FORMAT_BC6H_SF16),<br>
+   fmt1(VK_FORMAT_BC7_UNORM_BLOC<wbr>K,         ISL_FORMAT_BC7_UNORM),<br>
+   fmt1(VK_FORMAT_BC7_SRGB_<wbr>BLOCK,          ISL_FORMAT_BC7_UNORM_SRGB),<br>
+   fmt1(VK_FORMAT_ETC2_R8G8B8_UN<wbr>ORM_BLOCK, ISL_FORMAT_ETC2_RGB8),<br>
+   fmt1(VK_FORMAT_ETC2_R8G8B8_SR<wbr>GB_BLOCK,  ISL_FORMAT_ETC2_SRGB8),<br>
+   fmt1(VK_FORMAT_ETC2_R8G8B8A1_<wbr>UNORM_BLOCK, ISL_FORMAT_ETC2_RGB8_PTA),<br>
+   fmt1(VK_FORMAT_ETC2_R8G8B8A1_<wbr>SRGB_BLOCK, ISL_FORMAT_ETC2_SRGB8_PTA),<br>
+   fmt1(VK_FORMAT_ETC2_R8G8B8A8_<wbr>UNORM_BLOCK, ISL_FORMAT_ETC2_EAC_RGBA8),<br>
+   fmt1(VK_FORMAT_ETC2_R8G8B8A8_<wbr>SRGB_BLOCK, ISL_FORMAT_ETC2_EAC_SRGB8_A8),<br>
+   fmt1(VK_FORMAT_EAC_R11_UNORM_<wbr>BLOCK,     ISL_FORMAT_EAC_R11),<br>
+   fmt1(VK_FORMAT_EAC_R11_SNORM_<wbr>BLOCK,     ISL_FORMAT_EAC_SIGNED_R11),<br>
+   fmt1(VK_FORMAT_EAC_R11G11_UNO<wbr>RM_BLOCK,  ISL_FORMAT_EAC_RG11),<br>
+   fmt1(VK_FORMAT_EAC_R11G11_SNO<wbr>RM_BLOCK,  ISL_FORMAT_EAC_SIGNED_RG11),<br>
+   fmt1(VK_FORMAT_ASTC_4x4_SRGB_<wbr>BLOCK,     ISL_FORMAT_ASTC_LDR_2D_4X4_U8<wbr>SRGB),<br>
+   fmt1(VK_FORMAT_ASTC_5x4_SRGB_<wbr>BLOCK,     ISL_FORMAT_ASTC_LDR_2D_5X4_U8<wbr>SRGB),<br>
+   fmt1(VK_FORMAT_ASTC_5x5_SRGB_<wbr>BLOCK,     ISL_FORMAT_ASTC_LDR_2D_5X5_U8<wbr>SRGB),<br>
+   fmt1(VK_FORMAT_ASTC_6x5_SRGB_<wbr>BLOCK,     ISL_FORMAT_ASTC_LDR_2D_6X5_U8<wbr>SRGB),<br>
+   fmt1(VK_FORMAT_ASTC_6x6_SRGB_<wbr>BLOCK,     ISL_FORMAT_ASTC_LDR_2D_6X6_U8<wbr>SRGB),<br>
+   fmt1(VK_FORMAT_ASTC_8x5_SRGB_<wbr>BLOCK,     ISL_FORMAT_ASTC_LDR_2D_8X5_U8<wbr>SRGB),<br>
+   fmt1(VK_FORMAT_ASTC_8x6_SRGB_<wbr>BLOCK,     ISL_FORMAT_ASTC_LDR_2D_8X6_U8<wbr>SRGB),<br>
+   fmt1(VK_FORMAT_ASTC_8x8_SRGB_<wbr>BLOCK,     ISL_FORMAT_ASTC_LDR_2D_8X8_U8<wbr>SRGB),<br>
+   fmt1(VK_FORMAT_ASTC_10x5_<wbr>SRGB_BLOCK,    ISL_FORMAT_ASTC_LDR_2D_10X5_U8<wbr>SRGB),<br>
+   fmt1(VK_FORMAT_ASTC_10x6_<wbr>SRGB_BLOCK,    ISL_FORMAT_ASTC_LDR_2D_10X6_U8<wbr>SRGB),<br>
+   fmt1(VK_FORMAT_ASTC_10x8_<wbr>SRGB_BLOCK,    ISL_FORMAT_ASTC_LDR_2D_10X8_U8<wbr>SRGB),<br>
+   fmt1(VK_FORMAT_ASTC_10x10_SRG<wbr>B_BLOCK,   ISL_FORMAT_ASTC_LDR_2D_10X10_<wbr>U8SRGB),<br>
+   fmt1(VK_FORMAT_ASTC_12x10_SRG<wbr>B_BLOCK,   ISL_FORMAT_ASTC_LDR_2D_12X10_<wbr>U8SRGB),<br>
+   fmt1(VK_FORMAT_ASTC_12x12_SRG<wbr>B_BLOCK,   ISL_FORMAT_ASTC_LDR_2D_12X12_<wbr>U8SRGB),<br>
+   fmt1(VK_FORMAT_ASTC_4x4_<wbr>UNORM_BLOCK,    ISL_FORMAT_ASTC_LDR_2D_4X4_FLT<wbr>16),<br>
+   fmt1(VK_FORMAT_ASTC_5x4_<wbr>UNORM_BLOCK,    ISL_FORMAT_ASTC_LDR_2D_5X4_FLT<wbr>16),<br>
+   fmt1(VK_FORMAT_ASTC_5x5_<wbr>UNORM_BLOCK,    ISL_FORMAT_ASTC_LDR_2D_5X5_FLT<wbr>16),<br>
+   fmt1(VK_FORMAT_ASTC_6x5_<wbr>UNORM_BLOCK,    ISL_FORMAT_ASTC_LDR_2D_6X5_FLT<wbr>16),<br>
+   fmt1(VK_FORMAT_ASTC_6x6_<wbr>UNORM_BLOCK,    ISL_FORMAT_ASTC_LDR_2D_6X6_FLT<wbr>16),<br>
+   fmt1(VK_FORMAT_ASTC_8x5_<wbr>UNORM_BLOCK,    ISL_FORMAT_ASTC_LDR_2D_8X5_FLT<wbr>16),<br>
+   fmt1(VK_FORMAT_ASTC_8x6_<wbr>UNORM_BLOCK,    ISL_FORMAT_ASTC_LDR_2D_8X6_FLT<wbr>16),<br>
+   fmt1(VK_FORMAT_ASTC_8x8_<wbr>UNORM_BLOCK,    ISL_FORMAT_ASTC_LDR_2D_8X8_FLT<wbr>16),<br>
+   fmt1(VK_FORMAT_ASTC_10x5_UNOR<wbr>M_BLOCK,   ISL_FORMAT_ASTC_LDR_2D_10X5_F<wbr>LT16),<br>
+   fmt1(VK_FORMAT_ASTC_10x6_UNOR<wbr>M_BLOCK,   ISL_FORMAT_ASTC_LDR_2D_10X6_F<wbr>LT16),<br>
+   fmt1(VK_FORMAT_ASTC_10x8_UNOR<wbr>M_BLOCK,   ISL_FORMAT_ASTC_LDR_2D_10X8_F<wbr>LT16),<br>
+   fmt1(VK_FORMAT_ASTC_10x10_UNO<wbr>RM_BLOCK,  ISL_FORMAT_ASTC_LDR_2D_10X10_F<wbr>LT16),<br>
+   fmt1(VK_FORMAT_ASTC_12x10_UNO<wbr>RM_BLOCK,  ISL_FORMAT_ASTC_LDR_2D_12X10_F<wbr>LT16),<br>
+   fmt1(VK_FORMAT_ASTC_12x12_UNO<wbr>RM_BLOCK,  ISL_FORMAT_ASTC_LDR_2D_12X12_F<wbr>LT16),<br>
+   fmt1(VK_FORMAT_B8G8R8_UNORM,            ISL_FORMAT_UNSUPPORTED),<br></blockquote><div><br></div><div>While we're at it, maybe add a fmt_unsupported macro.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+   fmt1(VK_FORMAT_B8G8R8_SNORM,            ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_B8G8R8_<wbr>USCALED,          ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_B8G8R8_<wbr>SSCALED,          ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_B8G8R8_UINT,             ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_B8G8R8_SINT,             ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_B8G8R8_SRGB,             ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_B8G8R8A8_<wbr>UNORM,          ISL_FORMAT_B8G8R8A8_UNORM),<br>
+   fmt1(VK_FORMAT_B8G8R8A8_<wbr>SNORM,          ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_B8G8R8A8_USCAL<wbr>ED,        ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_B8G8R8A8_SSCAL<wbr>ED,        ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_B8G8R8A8_UINT,<wbr>           ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_B8G8R8A8_SINT,<wbr>           ISL_FORMAT_UNSUPPORTED),<br>
+   fmt1(VK_FORMAT_B8G8R8A8_SRGB,<wbr>           ISL_FORMAT_B8G8R8A8_UNORM_SRG<wbr>B),<br>
+};<br>
+<br>
+static const struct {<br>
+   const struct anv_format *formats;<br>
+   uint32_t n_formats;<br>
+} anv_formats[] = {<br>
+   [0] = { .formats = main_formats, .n_formats = ARRAY_SIZE(main_formats), },<br>
 };<br>
<br>
+#undef _fmt<br>
+#undef swiz_fmt1<br>
+#undef fmt1<br>
 #undef fmt<br>
<br>
-static bool<br>
-format_supported(VkFormat vk_format)<br>
+const struct anv_format *<br>
+anv_get_format(VkFormat vk_format)<br>
 {<br>
-   if (vk_format >= ARRAY_SIZE(anv_formats))<br>
-      return false;<br>
+   uint32_t enum_offset = vk_enum_offset(vk_format);<br>
+   uint32_t ext_number = vk_enum_extension(vk_format);<br>
<br>
-   return anv_formats[vk_format].isl_for<wbr>mat != ISL_FORMAT_UNSUPPORTED;<br>
+   if (ext_number >= ARRAY_SIZE(anv_formats) ||<br>
+       enum_offset >= anv_formats[ext_number].n_form<wbr>ats ||<br>
+       anv_formats[ext_number].forma<wbr>ts[enum_offset].n_planes == 0 ||<br>
+       anv_formats[ext_number].forma<wbr>ts[enum_offset].planes[0].isl_<wbr>format == ISL_FORMAT_UNSUPPORTED)<br>
+      return NULL;<br>
+<br>
+   return &anv_formats[ext_number].forma<wbr>ts[enum_offset];<br>
 }<br>
<br>
 /**<br>
  * Exactly one bit must be set in \a aspect.<br>
  */<br>
-struct anv_format<br>
-anv_get_format(const struct gen_device_info *devinfo, VkFormat vk_format,<br>
-               VkImageAspectFlags aspect, VkImageTiling tiling)<br>
+struct anv_format_plane<br>
+anv_get_plane_format(const struct gen_device_info *devinfo, VkFormat vk_format,<br>
+                     VkImageAspectFlags aspect, VkImageTiling tiling)<br>
 {<br>
-   if (!format_supported(vk_format))<br>
-      return anv_formats[VK_FORMAT_UNDEFINE<wbr>D];<br>
+   const struct anv_format *format = anv_get_format(vk_format);<br>
+   struct anv_format_plane plane_format = {<br>
+      .isl_format = ISL_FORMAT_UNSUPPORTED,<br>
+   };<br>
<br>
-   struct anv_format format = anv_formats[vk_format];<br>
+   if (format == NULL)<br>
+      return plane_format;<br>
<br>
-   if (aspect == VK_IMAGE_ASPECT_STENCIL_BIT) {<br>
-      assert(vk_format_aspects(vk_fo<wbr>rmat) & VK_IMAGE_ASPECT_STENCIL_BIT);<br>
-      format.isl_format = ISL_FORMAT_R8_UINT;<br>
-      return format;<br>
-   }<br>
+   uint32_t plane = anv_image_aspect_to_plane(vk_f<wbr>ormat_aspects(vk_format), aspect);<br>
+   plane_format = format->planes[plane];<br>
+   if (plane_format.isl_format == ISL_FORMAT_UNSUPPORTED)<br></blockquote><div><br></div><div>I don't think we'll ever hit this case in practice.  anv_get_format will return NULL if plane 0 has ISL_FORMAT_UNSUPPORTED.  If you're asking for higher planes than exist, then I think you're using this helper wrong.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+      return plane_format;<br>
<br>
-   if (aspect & VK_IMAGE_ASPECT_DEPTH_BIT) {<br>
-      assert(vk_format_aspects(vk_fo<wbr>rmat) & VK_IMAGE_ASPECT_DEPTH_BIT);<br>
-      return format;<br>
+   if (aspect & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {<br>
+      assert(vk_format_aspects(vk_fo<wbr>rmat) &<br>
+             (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT));<br>
+      return plane_format;<br>
    }<br>
<br>
    assert(aspect == VK_IMAGE_ASPECT_COLOR_BIT);<br>
    assert(vk_format_aspects(vk_fo<wbr>rmat) == VK_IMAGE_ASPECT_COLOR_BIT);<br>
<br>
    const struct isl_format_layout *isl_layout =<br>
-      isl_format_get_layout(format.i<wbr>sl_format);<br>
+      isl_format_get_layout(plane_fo<wbr>rmat.isl_format);<br>
<br>
    if (tiling == VK_IMAGE_TILING_OPTIMAL &&<br>
        !util_is_power_of_two(isl_layo<wbr>ut->bpb)) {<br>
@@ -295,13 +333,14 @@ anv_get_format(const struct gen_device_info *devinfo, VkFormat vk_format,<br>
        * this by switching them over to RGBX or RGBA formats under the<br>
        * hood.<br>
        */<br>
-      enum isl_format rgbx = isl_format_rgb_to_rgbx(format.<wbr>isl_format);<br>
+      enum isl_format rgbx = isl_format_rgb_to_rgbx(plane_f<wbr>ormat.isl_format);<br>
       if (rgbx != ISL_FORMAT_UNSUPPORTED &&<br>
           isl_format_supports_<wbr>rendering(devinfo, rgbx)) {<br>
-         format.isl_format = rgbx;<br>
+         plane_format.isl_format = rgbx;<br>
       } else {<br>
-         format.isl_format = isl_format_rgb_to_rgba(format.<wbr>isl_format);<br>
-         format.swizzle = ISL_SWIZZLE(RED, GREEN, BLUE, ONE);<br>
+         plane_format.isl_format =<br>
+            isl_format_rgb_to_rgba(plane_f<wbr>ormat.isl_format);<br>
+         plane_format.swizzle = ISL_SWIZZLE(RED, GREEN, BLUE, ONE);<br>
       }<br>
    }<br>
<br>
@@ -309,20 +348,18 @@ anv_get_format(const struct gen_device_info *devinfo, VkFormat vk_format,<br>
     * back to a format with a more complex swizzle.<br>
     */<br>
    if (vk_format == VK_FORMAT_B4G4R4A4_UNORM_PACK1<wbr>6 && devinfo->gen < 8) {<br>
-      return (struct anv_format) {<br>
-         .isl_format = ISL_FORMAT_B4G4R4A4_UNORM,<br>
-         .swizzle = ISL_SWIZZLE(GREEN, RED, ALPHA, BLUE),<br>
-      };<br>
+      plane_format.isl_format = ISL_FORMAT_B4G4R4A4_UNORM;<br>
+      plane_format.swizzle = ISL_SWIZZLE(GREEN, RED, ALPHA, BLUE);<br></blockquote><div><br></div><div>This whole function is a mess but that's not your fault.  I may clean some of this up after we land the extension.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    }<br>
<br>
-   return format;<br>
+   return plane_format;<br>
 }<br>
<br>
 // Format capabilities<br>
<br>
 static VkFormatFeatureFlags<br>
 get_image_format_properties(c<wbr>onst struct gen_device_info *devinfo,<br>
-                            enum isl_format base, struct anv_format format)<br>
+                            enum isl_format base, struct anv_format_plane format)<br>
 {<br>
    if (format.isl_format == ISL_FORMAT_UNSUPPORTED)<br>
       return 0;<br>
@@ -392,19 +429,20 @@ get_buffer_format_properties(c<wbr>onst struct gen_device_info *devinfo,<br>
<br>
 static void<br>
 anv_physical_device_get_forma<wbr>t_properties(struct anv_physical_device *physical_device,<br>
-                                          VkFormat format,<br>
+                                          VkFormat vk_format,<br>
                                           VkFormatProperties *out_properties)<br>
 {<br>
    int gen = physical_device->info.gen * 10;<br>
    if (physical_device->info.is_hasw<wbr>ell)<br>
       gen += 5;<br>
<br>
+   const struct anv_format *format = anv_get_format(vk_format);<br>
    VkFormatFeatureFlags linear = 0, tiled = 0, buffer = 0;<br>
-   if (!format_supported(format)) {<br>
+   if (format == NULL) {<br>
       /* Nothing to do here */<br>
-   } else if (vk_format_is_depth_or_stencil<wbr>(format)) {<br>
+   } else if (vk_format_is_depth_or_stencil<wbr>(vk_format)) {<br>
       tiled |= VK_FORMAT_FEATURE_DEPTH_STENCI<wbr>L_ATTACHMENT_BIT;<br>
-      if (vk_format_aspects(format) == VK_IMAGE_ASPECT_DEPTH_BIT ||<br>
+      if (vk_format_aspects(vk_format) == VK_IMAGE_ASPECT_DEPTH_BIT ||<br>
           physical_device->info.gen >= 8)<br>
          tiled |= VK_FORMAT_FEATURE_SAMPLED_IMAG<wbr>E_BIT;<br>
<br>
@@ -413,13 +451,13 @@ anv_physical_device_get_format<wbr>_properties(struct anv_physical_device *physical_d<br>
                VK_FORMAT_FEATURE_TRANSFER_SRC<wbr>_BIT_KHR |<br>
                VK_FORMAT_FEATURE_TRANSFER_DST<wbr>_BIT_KHR;<br>
    } else {<br>
-      struct anv_format linear_fmt, tiled_fmt;<br>
-      linear_fmt = anv_get_format(&physical_devic<wbr>e->info, format,<br>
-                                  VK_IMAGE_ASPECT_COLOR_BIT,<br>
-                                  VK_IMAGE_TILING_LINEAR);<br>
-      tiled_fmt = anv_get_format(&physical_devic<wbr>e->info, format,<br>
-                                 VK_IMAGE_ASPECT_COLOR_BIT,<br>
-                                 VK_IMAGE_TILING_OPTIMAL);<br>
+      struct anv_format_plane linear_fmt, tiled_fmt;<br>
+      linear_fmt = anv_get_plane_format(&physical<wbr>_device->info, vk_format,<br>
+                                        VK_IMAGE_ASPECT_COLOR_BIT,<br>
+                                        VK_IMAGE_TILING_LINEAR);<br>
+      tiled_fmt = anv_get_plane_format(&physical<wbr>_device->info, vk_format,<br>
+                                       VK_IMAGE_ASPECT_COLOR_BIT,<br>
+                                       VK_IMAGE_TILING_OPTIMAL);<br>
<br>
       linear = get_image_format_properties(&p<wbr>hysical_device->info,<br>
                                            linear_fmt.isl_format, linear_fmt);<br>
@@ -497,8 +535,9 @@ anv_get_image_format_propertie<wbr>s(<br>
    uint32_t maxMipLevels;<br>
    uint32_t maxArraySize;<br>
    VkSampleCountFlags sampleCounts = VK_SAMPLE_COUNT_1_BIT;<br>
+   const struct anv_format *format = anv_get_format(info->format);<br>
<br>
-   if (!format_supported(info->forma<wbr>t))<br>
+   if (format == NULL)<br>
       goto unsupported;<br>
<br>
    anv_physical_device_get_format<wbr>_properties(physical_device, info->format,<br>
@@ -552,7 +591,7 @@ anv_get_image_format_propertie<wbr>s(<br>
     *    * This field cannot be ASTC format if the Surface Type is SURFTYPE_1D.<br>
     */<br>
    if (info->type == VK_IMAGE_TYPE_1D &&<br>
-       isl_format_is_compressed(anv_<wbr>formats[info->format].isl_form<wbr>at)) {<br>
+       isl_format_is_compressed(form<wbr>at->planes[0].isl_format)) {<br>
        goto unsupported;<br>
    }<br>
<br>
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c<br>
index 2aa83154f82..905d7d087cc 100644<br>
--- a/src/intel/vulkan/anv_image.c<br>
+++ b/src/intel/vulkan/anv_image.c<br>
@@ -231,8 +231,9 @@ make_surface(const struct anv_device *dev,<br>
    image->extent = anv_sanitize_image_extent(vk_i<wbr>nfo->imageType,<br>
                                              vk_info->extent);<br>
<br>
-   enum isl_format format = anv_get_isl_format(&dev->info, vk_info->format,<br>
-                                               aspect, vk_info->tiling);<br>
+   enum isl_format format =<br>
+      anv_get_isl_plane_format(&dev-<wbr>>info, vk_info->format,<br>
+                               aspect, vk_info->tiling);<br>
    assert(format != ISL_FORMAT_UNSUPPORTED);<br>
<br>
    ok = isl_surf_init(&dev->isl_dev, &anv_surf->isl,<br>
@@ -734,8 +735,9 @@ anv_CreateImageView(VkDevice _device,<br>
    iview->aspect_mask = pCreateInfo->subresourceRange.<wbr>aspectMask;<br>
    iview->vk_format = pCreateInfo->format;<br>
<br>
-   struct anv_format format = anv_get_format(&device->info, pCreateInfo->format,<br>
-                                             range->aspectMask, image->tiling);<br>
+   struct anv_format_plane format =<br>
+      anv_get_plane_format(&device-><wbr>info, pCreateInfo->format,<br>
+                           range->aspectMask, image->tiling);<br>
<br>
    iview->isl = (struct isl_view) {<br>
       .format = format.isl_format,<br>
@@ -931,9 +933,9 @@ anv_CreateBufferView(VkDevice _device,<br>
<br>
    /* TODO: Handle the format swizzle? */<br>
<br>
-   view->format = anv_get_isl_format(&device->in<wbr>fo, pCreateInfo->format,<br>
-                                     VK_IMAGE_ASPECT_COLOR_BIT,<br>
-                                     VK_IMAGE_TILING_LINEAR);<br>
+   view->format = anv_get_isl_plane_format(&devi<wbr>ce->info, pCreateInfo->format,<br>
+                                           VK_IMAGE_ASPECT_COLOR_BIT,<br>
+                                           VK_IMAGE_TILING_LINEAR);<br>
    const uint32_t format_bs = isl_format_get_layout(view->fo<wbr>rmat)->bpb / 8;<br>
    view->bo = buffer->bo;<br>
    view->offset = buffer->offset + pCreateInfo->offset;<br>
diff --git a/src/intel/vulkan/anv_private<wbr>.h b/src/intel/vulkan/anv_private<wbr>.h<br>
index df8de8d9407..fde562294c0 100644<br>
--- a/src/intel/vulkan/anv_private<wbr>.h<br>
+++ b/src/intel/vulkan/anv_private<wbr>.h<br>
@@ -2159,20 +2159,60 @@ anv_pipeline_compile_cs(struct anv_pipeline *pipeline,<br>
                         const char *entrypoint,<br>
                         const VkSpecializationInfo *spec_info);<br>
<br>
-struct anv_format {<br>
+struct anv_format_plane {<br>
    enum isl_format isl_format:16;<br>
    struct isl_swizzle swizzle;<br>
 };<br>
<br>
-struct anv_format<br>
-anv_get_format(const struct gen_device_info *devinfo, VkFormat format,<br>
-               VkImageAspectFlags aspect, VkImageTiling tiling);<br>
+<br>
+struct anv_format {<br>
+   struct anv_format_plane planes[3];<br>
+   uint8_t n_planes;<br>
+};<br>
+<br>
+static inline uint32_t<br>
+anv_image_aspect_to_plane(VkI<wbr>mageAspectFlags image_aspects,<br>
+                          VkImageAspectFlags aspect_mask)<br>
+{<br>
+   switch (aspect_mask) {<br>
+   case VK_IMAGE_ASPECT_COLOR_BIT:<br>
+   case VK_IMAGE_ASPECT_DEPTH_BIT:<br>
+   case VK_IMAGE_ASPECT_PLANE_0_BIT_KH<wbr>R:<br>
+      return 0;<br>
+   case VK_IMAGE_ASPECT_STENCIL_BIT:<br>
+      if ((image_aspects & VK_IMAGE_ASPECT_DEPTH_BIT) == 0)<br>
+         return 0;<br>
+      /* Fall-through */<br>
+   case VK_IMAGE_ASPECT_PLANE_1_BIT_KH<wbr>R:<br>
+      return 1;<br>
+   case VK_IMAGE_ASPECT_PLANE_2_BIT_KH<wbr>R:<br>
+      return 2;<br>
+   default:<br>
+      unreachable("invalid image aspect");<br>
+   }<br>
+}<br>
+<br>
+const struct anv_format *<br>
+anv_get_format(VkFormat format);<br>
+<br>
+static inline uint32_t<br>
+anv_get_format_planes(VkForma<wbr>t vk_format)<br></blockquote><div><br></div><div>get_format_num_planes?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+{<br>
+   const struct anv_format *format = anv_get_format(vk_format);<br>
+<br>
+   return format != NULL ? format->n_planes : 0;<br>
+}<br>
+<br>
+struct anv_format_plane<br>
+anv_get_plane_format(const struct gen_device_info *devinfo, VkFormat vk_format,<br></blockquote><div><br></div><div>get_format_plane?</div><div><br></div><div>Also, it's a bit weird to me that <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+                     VkImageAspectFlags aspect, VkImageTiling tiling);<br>
<br>
 static inline enum isl_format<br>
-anv_get_isl_format(const struct gen_device_info *devinfo, VkFormat vk_format,<br>
-                   VkImageAspectFlags aspect, VkImageTiling tiling)<br>
+anv_get_isl_plane_format(cons<wbr>t struct gen_device_info *devinfo,<br></blockquote><div><br></div><div>Does this really need to be renamed?  We're not changing the parameters or return type as it already takes an aspect.  Not renaming it would reduce the churn quite a bit.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+                         VkFormat vk_format, VkImageAspectFlags aspect,<br>
+                         VkImageTiling tiling)<br>
 {<br>
-   return anv_get_format(devinfo, vk_format, aspect, tiling).isl_format;<br>
+   return anv_get_plane_format(devinfo, vk_format, aspect, tiling).isl_format;<br>
 }<br>
<br>
 static inline struct isl_swizzle<br>
diff --git a/src/intel/vulkan/genX_pipeli<wbr>ne.c b/src/intel/vulkan/genX_pipeli<wbr>ne.c<br>
index 6dfa49b8737..5350f54b39e 100644<br>
--- a/src/intel/vulkan/genX_pipeli<wbr>ne.c<br>
+++ b/src/intel/vulkan/genX_pipeli<wbr>ne.c<br>
@@ -119,10 +119,10 @@ emit_vertex_input(struct anv_pipeline *pipeline,<br>
    for (uint32_t i = 0; i < info->vertexAttributeDescripti<wbr>onCount; i++) {<br>
       const VkVertexInputAttributeDescript<wbr>ion *desc =<br>
          &info->pVertexAttributeDescrip<wbr>tions[i];<br>
-      enum isl_format format = anv_get_isl_format(&pipeline-><wbr>device->info,<br>
-                                                  desc->format,<br>
-                                                  VK_IMAGE_ASPECT_COLOR_BIT,<br>
-                                                  VK_IMAGE_TILING_LINEAR);<br>
+      enum isl_format format =<br>
+         anv_get_isl_plane_format(&pip<wbr>eline->device->info, desc->format,<br>
+                                  VK_IMAGE_ASPECT_COLOR_BIT,<br>
+                                  VK_IMAGE_TILING_LINEAR);<br>
<br>
       assert(desc->binding < MAX_VBS);<br>
<br>
@@ -504,9 +504,9 @@ emit_rs_state(struct anv_pipeline *pipeline,<br>
       assert(vk_format_is_depth_or_<wbr>stencil(vk_format));<br>
       if (vk_format_aspects(vk_format) & VK_IMAGE_ASPECT_DEPTH_BIT) {<br>
          enum isl_format isl_format =<br>
-            anv_get_isl_format(&pipeline-><wbr>device->info, vk_format,<br>
-                               VK_IMAGE_ASPECT_DEPTH_BIT,<br>
-                               VK_IMAGE_TILING_OPTIMAL);<br>
+            anv_get_isl_plane_format(&pipe<wbr>line->device->info, vk_format,<br>
+                                     VK_IMAGE_ASPECT_DEPTH_BIT,<br>
+                                     VK_IMAGE_TILING_OPTIMAL);<br>
          sf.DepthBufferSurfaceFormat =<br>
             isl_format_get_depth_format(i<wbr>sl_format, false);<br>
       }<br>
<span class="m_797360457852279970HOEnZb"><font color="#888888">--<br>
2.14.1<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>