radv: Determine swizzles correctly.

Previously we were calculating the inverse swizzle instead and doing something
horrible to get 0/1 right, and then "fixing" our table.

Let's do it right an align with the mesa-wide table.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8797>
This commit is contained in:
Bas Nieuwenhuizen 2021-01-30 21:35:59 +01:00 committed by Marge Bot
parent a5685e4dd0
commit b71406dda1
8 changed files with 16 additions and 21 deletions

View File

@ -160,6 +160,8 @@ dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_snorm,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_srgb,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_uint,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_unorm,Fail
dEQP-VK.drm_format_modifiers.export_import.b4g4r4a4_unorm_pack16,Fail
dEQP-VK.drm_format_modifiers.export_import.b5g5r5a1_unorm_pack16,Fail
# Fixed by ffd6cbac3 ("Fix validation of DRM modifier compatibility with image properties")
dEQP-VK.drm_format_modifiers.create_list_modifiers.r16g16b16_sfloat,Crash

View File

@ -160,6 +160,8 @@ dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_snorm,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_srgb,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_uint,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_unorm,Fail
dEQP-VK.drm_format_modifiers.export_import.b4g4r4a4_unorm_pack16,Fail
dEQP-VK.drm_format_modifiers.export_import.b5g5r5a1_unorm_pack16,Fail
# Fixed by ffd6cbac3 ("Fix validation of DRM modifier compatibility with image properties")
dEQP-VK.drm_format_modifiers.create_list_modifiers.r16g16b16_sfloat,Crash

View File

@ -160,6 +160,8 @@ dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_snorm,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_srgb,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_uint,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_unorm,Fail
dEQP-VK.drm_format_modifiers.export_import.b4g4r4a4_unorm_pack16,Fail
dEQP-VK.drm_format_modifiers.export_import.b5g5r5a1_unorm_pack16,Fail
# Fixed by ffd6cbac3 ("Fix validation of DRM modifier compatibility with image properties")
dEQP-VK.drm_format_modifiers.create_list_modifiers.r16g16b16_sfloat,Crash

View File

@ -160,6 +160,8 @@ dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_snorm,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_srgb,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_uint,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_unorm,Fail
dEQP-VK.drm_format_modifiers.export_import.b4g4r4a4_unorm_pack16,Fail
dEQP-VK.drm_format_modifiers.export_import.b5g5r5a1_unorm_pack16,Fail
# Fixed by ffd6cbac3 ("Fix validation of DRM modifier compatibility with image properties")
dEQP-VK.drm_format_modifiers.create_list_modifiers.r16g16b16_sfloat,Crash

View File

@ -160,6 +160,8 @@ dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_snorm,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_srgb,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_uint,Fail
dEQP-VK.drm_format_modifiers.export_import.r8g8b8a8_unorm,Fail
dEQP-VK.drm_format_modifiers.export_import.b4g4r4a4_unorm_pack16,Fail
dEQP-VK.drm_format_modifiers.export_import.b5g5r5a1_unorm_pack16,Fail
# Fixed by ffd6cbac3 ("Fix validation of DRM modifier compatibility with image properties")
dEQP-VK.drm_format_modifiers.create_list_modifiers.r16g16b16_sfloat,Crash

View File

@ -556,7 +556,9 @@ radv_compose_swizzle(const struct vk_format_description *desc,
for (unsigned i = 0; i < 4; i++)
swizzle[i] = desc->swizzle[i];
} else if (desc->colorspace == VK_FORMAT_COLORSPACE_ZS) {
const unsigned char swizzle_xxxx[4] = {0, 0, 0, 0};
const unsigned char swizzle_xxxx[4] = {
VK_SWIZZLE_X, VK_SWIZZLE_0, VK_SWIZZLE_0, VK_SWIZZLE_1
};
vk_format_compose_swizzles(mapping, swizzle_xxxx, swizzle);
} else {
vk_format_compose_swizzles(mapping, desc->swizzle, swizzle);

View File

@ -277,8 +277,6 @@ vk_format_aspects(VkFormat format)
static inline enum vk_swizzle
radv_swizzle_conv(VkComponentSwizzle component, const unsigned char chan[4], VkComponentSwizzle vk_swiz)
{
int x;
if (vk_swiz == VK_COMPONENT_SWIZZLE_IDENTITY)
vk_swiz = component;
switch (vk_swiz) {
@ -287,25 +285,10 @@ radv_swizzle_conv(VkComponentSwizzle component, const unsigned char chan[4], VkC
case VK_COMPONENT_SWIZZLE_ONE:
return VK_SWIZZLE_1;
case VK_COMPONENT_SWIZZLE_R:
for (x = 0; x < 4; x++)
if (chan[x] == 0)
return (enum vk_swizzle)x;
return VK_SWIZZLE_0;
case VK_COMPONENT_SWIZZLE_G:
for (x = 0; x < 4; x++)
if (chan[x] == 1)
return (enum vk_swizzle)x;
return VK_SWIZZLE_0;
case VK_COMPONENT_SWIZZLE_B:
for (x = 0; x < 4; x++)
if (chan[x] == 2)
return (enum vk_swizzle)x;
return VK_SWIZZLE_0;
case VK_COMPONENT_SWIZZLE_A:
for (x = 0; x < 4; x++)
if (chan[x] == 3)
return (enum vk_swizzle)x;
return VK_SWIZZLE_1;
return (enum vk_swizzle)chan[vk_swiz - VK_COMPONENT_SWIZZLE_R];
default:
unreachable("Illegal swizzle");
}

View File

@ -4,13 +4,13 @@
VK_FORMAT_UNDEFINED , plain, 1, 1, u8 , , , , x001, rgb
VK_FORMAT_R4G4_UNORM_PACK8 , plain, 1, 1, un4 , un4 , , , xy01, rgb
VK_FORMAT_R4G4B4A4_UNORM_PACK16 , plain, 1, 1, un4 , un4 , un4 , un4 , wzyx, rgb
VK_FORMAT_B4G4R4A4_UNORM_PACK16 , plain, 1, 1, un4 , un4 , un4 , un4 , wxyz, rgb
VK_FORMAT_B4G4R4A4_UNORM_PACK16 , plain, 1, 1, un4 , un4 , un4 , un4 , yzwx, rgb
VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT , plain, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb
VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT , plain, 1, 1, un4 , un4 , un4 , un4 , xyzw, rgb
VK_FORMAT_R5G6B5_UNORM_PACK16 , plain, 1, 1, un5 , un6 , un5 , , zyx1, rgb
VK_FORMAT_B5G6R5_UNORM_PACK16 , plain, 1, 1, un5 , un6 , un5 , , xyz1, rgb
VK_FORMAT_R5G5B5A1_UNORM_PACK16 , plain, 1, 1, un1 , un5 , un5 , un5 , wzyx, rgb
VK_FORMAT_B5G5R5A1_UNORM_PACK16 , plain, 1, 1, un1 , un5 , un5 , un5 , wxyz, rgb
VK_FORMAT_B5G5R5A1_UNORM_PACK16 , plain, 1, 1, un1 , un5 , un5 , un5 , yzwx, rgb
VK_FORMAT_A1R5G5B5_UNORM_PACK16 , plain, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb
VK_FORMAT_R8_UNORM , plain, 1, 1, un8 , , , , x001, rgb
VK_FORMAT_R8_SNORM , plain, 1, 1, sn8 , , , , x001, rgb

1 /* this is pretty much taken from the gallium one. */
4 VK_FORMAT_R4G4B4A4_UNORM_PACK16 , plain, 1, 1, un4 , un4 , un4 , un4 , wzyx, rgb
5 VK_FORMAT_B4G4R4A4_UNORM_PACK16 , plain, 1, 1, un4 , un4 , un4 , un4 , wxyz, rgb VK_FORMAT_B4G4R4A4_UNORM_PACK16 , plain, 1, 1, un4 , un4 , un4 , un4 , yzwx, rgb
6 VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT , plain, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb
7 VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT , plain, 1, 1, un4 , un4 , un4 , un4 , xyzw, rgb
8 VK_FORMAT_R5G6B5_UNORM_PACK16 , plain, 1, 1, un5 , un6 , un5 , , zyx1, rgb
9 VK_FORMAT_B5G6R5_UNORM_PACK16 , plain, 1, 1, un5 , un6 , un5 , , xyz1, rgb
10 VK_FORMAT_R5G5B5A1_UNORM_PACK16 , plain, 1, 1, un1 , un5 , un5 , un5 , wzyx, rgb
11 VK_FORMAT_B5G5R5A1_UNORM_PACK16 , plain, 1, 1, un1 , un5 , un5 , un5 , wxyz, rgb VK_FORMAT_B5G5R5A1_UNORM_PACK16 , plain, 1, 1, un1 , un5 , un5 , un5 , yzwx, rgb
12 VK_FORMAT_A1R5G5B5_UNORM_PACK16 , plain, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb
13 VK_FORMAT_R8_UNORM , plain, 1, 1, un8 , , , , x001, rgb
14 VK_FORMAT_R8_SNORM , plain, 1, 1, sn8 , , , , x001, rgb
15 VK_FORMAT_R8_USCALED , plain, 1, 1, us8 , , , , x001, rgb
16 VK_FORMAT_R8_SSCALED , plain, 1, 1, ss8 , , , , x001, rgb