anv: Implement VK_EXT_4444_formats
authorJason Ekstrand <jason@jlekstrand.net>
Tue, 14 Jul 2020 22:59:49 +0000 (17:59 -0500)
committerMarge Bot <eric+marge@anholt.net>
Mon, 3 Aug 2020 17:50:03 +0000 (17:50 +0000)
We only support the ARGB format, not the ABGR one.  Fortunately, the
ARGB is the one required by D3D11.

Reviewed-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6158>

docs/relnotes/new_features.txt
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_extensions.py
src/intel/vulkan/anv_formats.c

index e28d2422b6c5bc1603bf5b7d868fd23a3c88d769..363ffbb0299944a335b60917827b961fd8cffc4d 100644 (file)
@@ -23,3 +23,4 @@ RADV now uses ACO per default as backend
 RADV_DEBUG=llvm option to enable LLVM backend for RADV
 VK_EXT_image_robustness for ANV
 VK_EXT_shader_atomic_float on ANV
+VK_EXT_4444_formats on ANV
index 96b4e320801b7ce469f29cac223ec700fa6917e6..6cc513a159e55c0d81933b387ed073d7ec8121ec 100644 (file)
@@ -1082,6 +1082,14 @@ void anv_GetPhysicalDeviceFeatures2(
 
    vk_foreach_struct(ext, pFeatures->pNext) {
       switch (ext->sType) {
+      case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT: {
+         VkPhysicalDevice4444FormatsFeaturesEXT *features =
+            (VkPhysicalDevice4444FormatsFeaturesEXT *)ext;
+         features->formatA4R4G4B4 = true;
+         features->formatA4B4G4R4 = false;
+         break;
+      }
+
       case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR: {
          VkPhysicalDevice8BitStorageFeaturesKHR *features =
             (VkPhysicalDevice8BitStorageFeaturesKHR *)ext;
index 3bbbe828141f99b7e97f0b58cd963e3a795c5ece..bb9e429d06628e2876109b5b251d64b8269020b9 100644 (file)
@@ -118,6 +118,7 @@ EXTENSIONS = [
     Extension('VK_KHR_wayland_surface',                   6, 'VK_USE_PLATFORM_WAYLAND_KHR'),
     Extension('VK_KHR_xcb_surface',                       6, 'VK_USE_PLATFORM_XCB_KHR'),
     Extension('VK_KHR_xlib_surface',                      6, 'VK_USE_PLATFORM_XLIB_KHR'),
+    Extension('VK_EXT_4444_formats',                      1, True),
     Extension('VK_EXT_acquire_xlib_display',              1, 'VK_USE_PLATFORM_XLIB_XRANDR_EXT'),
     Extension('VK_EXT_buffer_device_address',             1, 'device->has_a64_buffer_access'),
     Extension('VK_EXT_calibrated_timestamps',             1, 'device->has_reg_timestamp'),
index 2f512baa024ec2317816e66102a9a4268560bdce..6cbbc77337c8c2fbd0aed2563ab8da141cde01aa 100644 (file)
@@ -333,6 +333,11 @@ static const struct anv_format main_formats[] = {
    fmt1(VK_FORMAT_B8G8R8A8_SRGB,                     ISL_FORMAT_B8G8R8A8_UNORM_SRGB),
 };
 
+static const struct anv_format _4444_formats[] = {
+   fmt1(VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT, ISL_FORMAT_B4G4R4A4_UNORM),
+   fmt_unsupported(VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT),
+};
+
 static const struct anv_format ycbcr_formats[] = {
    ycbcr_fmt(VK_FORMAT_G8B8G8R8_422_UNORM, 1,
              y_plane(0, ISL_FORMAT_YCRCB_SWAPUV, RGBA, _ISL_SWIZZLE(BLUE, GREEN, RED, ZERO), 1, 1)),
@@ -414,6 +419,8 @@ static const struct {
 } anv_formats[] = {
    [0]                                       = { .formats = main_formats,
                                                  .n_formats = ARRAY_SIZE(main_formats), },
+   [_VK_EXT_4444_formats_number]             = { .formats = _4444_formats,
+                                                 .n_formats = ARRAY_SIZE(_4444_formats), },
    [_VK_KHR_sampler_ycbcr_conversion_number] = { .formats = ycbcr_formats,
                                                  .n_formats = ARRAY_SIZE(ycbcr_formats), },
 };