OSDN Git Service

anv/formats: Add support for VK_FORMAT_B4G4R4A4_UNORM pre-gen8
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 16 May 2016 18:02:57 +0000 (11:02 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 17 May 2016 19:17:22 +0000 (12:17 -0700)
src/intel/vulkan/anv_formats.c

index bd8d11f..b52c7ca 100644 (file)
@@ -287,6 +287,16 @@ anv_get_format(const struct brw_device_info *devinfo, VkFormat vk_format,
       }
    }
 
+   /* The B4G4R4A4 format isn't available prior to Sky Lake so we have to fall
+    * back to a format with a more complex swizzle.
+    */
+   if (vk_format == VK_FORMAT_B4G4R4A4_UNORM_PACK16 && devinfo->gen < 9) {
+      return (struct anv_format) {
+         .isl_format = ISL_FORMAT_B4G4R4A4_UNORM,
+         .swizzle = ISL_SWIZZLE(GREEN, RED, ALPHA, BLUE),
+      };
+   }
+
    return format;
 }