[Vulkan] Better swizzle for DXT3A/DXT5A?

This commit is contained in:
gibbed 2018-05-28 17:25:32 -05:00
parent e665c0a3fb
commit 2bd9bae0f4
1 changed files with 7 additions and 3 deletions

View File

@ -40,6 +40,8 @@ struct TextureConfig {
#define SWIZ(r, g, b, a) r, g, b, a
#define ___R SWIZ(-7, -7, -7, 0)
#define ___A SWIZ(-7, -7, -7, 3)
#define OOOR SWIZ(-6, -6, -6, 0)
#define OOOA SWIZ(-6, -6, -6, 3)
#define RRRR SWIZ(0, 0, 0, 0)
#define RRRA SWIZ(0, 0, 0, 3)
#define RGBA SWIZ(0, 1, 2, 3)
@ -57,7 +59,7 @@ static const TextureConfig texture_configs[64] = {
/* k_6_5_5 */ {VK_FORMAT_UNDEFINED},
/* k_8_8_8_8 */ {VK_FORMAT_R8G8B8A8_UNORM},
/* k_2_10_10_10 */ {VK_FORMAT_A2R10G10B10_UNORM_PACK32},
/* k_8_A */ {VK_FORMAT_R8_UNORM, ___R},
/* k_8_A */ {VK_FORMAT_R8_UNORM, OOOR},
/* k_8_B */ {VK_FORMAT_UNDEFINED},
/* k_8_8 */ {VK_FORMAT_R8G8_UNORM},
/* k_Cr_Y1_Cb_Y0 */ {VK_FORMAT_UNDEFINED},
@ -119,8 +121,8 @@ static const TextureConfig texture_configs[64] = {
/* k_10_11_11_AS_16_16_16_16 */ {VK_FORMAT_B10G11R11_UFLOAT_PACK32}, // ?
/* k_11_11_10_AS_16_16_16_16 */ {VK_FORMAT_B10G11R11_UFLOAT_PACK32}, // ?
/* k_32_32_32_FLOAT */ {VK_FORMAT_R32G32B32_SFLOAT},
/* k_DXT3A */ {VK_FORMAT_BC2_UNORM_BLOCK, ___A},
/* k_DXT5A */ {VK_FORMAT_BC4_UNORM_BLOCK, ___R}, // ATI1N
/* k_DXT3A */ {VK_FORMAT_BC2_UNORM_BLOCK, OOOA},
/* k_DXT5A */ {VK_FORMAT_BC4_UNORM_BLOCK, OOOR}, // ATI1N
// http://fileadmin.cs.lth.se/cs/Personal/Michael_Doggett/talks/unc-xenos-doggett.pdf
/* k_CTX1 */ {VK_FORMAT_R8G8_UINT},
@ -139,6 +141,8 @@ static const TextureConfig texture_configs[64] = {
#undef RGBA
#undef RRRA
#undef RRRR
#undef OOOA
#undef OOOR
#undef ___A
#undef ___R
#undef SWIZ