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 <joshua@froggi.es>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6158>
This commit is contained in:
Jason Ekstrand
2020-07-14 17:59:49 -05:00
committed by Marge Bot
parent b44139ef36
commit 3c2a1af660
4 changed files with 17 additions and 0 deletions

View 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

View 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;

View 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'),

View 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), },
};