From: Jason Ekstrand Date: Tue, 14 Jul 2020 22:59:49 +0000 (-0500) Subject: anv: Implement VK_EXT_4444_formats X-Git-Url: https://git.libre-soc.org/?p=mesa.git;a=commitdiff_plain;h=3c2a1af660f13e3598069e07d2fdedffd350017c anv: Implement VK_EXT_4444_formats We only support the ARGB format, not the ABGR one. Fortunately, the ARGB is the one required by D3D11. Reviewed-by: Joshua Ashton Reviewed-by: Kenneth Graunke Part-of: --- diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index e28d2422b6c..363ffbb0299 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -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 diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 96b4e320801..6cc513a159e 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -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; diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py index 3bbbe828141..bb9e429d066 100644 --- a/src/intel/vulkan/anv_extensions.py +++ b/src/intel/vulkan/anv_extensions.py @@ -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'), diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index 2f512baa024..6cbbc77337c 100644 --- a/src/intel/vulkan/anv_formats.c +++ b/src/intel/vulkan/anv_formats.c @@ -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), }, };