Vulkan: Reformat the texture config table to look nicer

This commit is contained in:
Dr. Chat 2017-08-14 00:27:13 -05:00
parent 657d571c0d
commit 2f200f4a75
1 changed files with 74 additions and 68 deletions

View File

@ -28,84 +28,90 @@ constexpr uint32_t kMaxTextureSamplers = 32;
constexpr VkDeviceSize kStagingBufferSize = 32 * 1024 * 1024;
struct TextureConfig {
TextureFormat guest_format;
VkFormat host_format;
};
static const TextureConfig texture_configs[64] = {
{TextureFormat::k_1_REVERSE, VK_FORMAT_UNDEFINED},
{TextureFormat::k_1, VK_FORMAT_UNDEFINED},
{TextureFormat::k_8, VK_FORMAT_R8_UNORM},
{TextureFormat::k_1_5_5_5, VK_FORMAT_A1R5G5B5_UNORM_PACK16}, // ! A1BGR5
{TextureFormat::k_5_6_5, VK_FORMAT_R5G6B5_UNORM_PACK16},
{TextureFormat::k_6_5_5, VK_FORMAT_UNDEFINED},
{TextureFormat::k_8_8_8_8, VK_FORMAT_R8G8B8A8_UNORM},
{TextureFormat::k_2_10_10_10, VK_FORMAT_A2R10G10B10_UNORM_PACK32},
{TextureFormat::k_8_A, VK_FORMAT_UNDEFINED},
{TextureFormat::k_8_B, VK_FORMAT_UNDEFINED},
{TextureFormat::k_8_8, VK_FORMAT_R8G8_UNORM},
{TextureFormat::k_Cr_Y1_Cb_Y0, VK_FORMAT_UNDEFINED},
{TextureFormat::k_Y1_Cr_Y0_Cb, VK_FORMAT_UNDEFINED},
{TextureFormat::kUnknown, VK_FORMAT_UNDEFINED},
{TextureFormat::k_8_8_8_8_A, VK_FORMAT_UNDEFINED},
{TextureFormat::k_4_4_4_4, VK_FORMAT_R4G4B4A4_UNORM_PACK16},
{TextureFormat::k_10_11_11, VK_FORMAT_B10G11R11_UFLOAT_PACK32}, // ?
{TextureFormat::k_11_11_10, VK_FORMAT_B10G11R11_UFLOAT_PACK32}, // ?
{TextureFormat::k_DXT1, VK_FORMAT_BC1_RGBA_UNORM_BLOCK},
{TextureFormat::k_DXT2_3, VK_FORMAT_BC2_UNORM_BLOCK},
{TextureFormat::k_DXT4_5, VK_FORMAT_BC3_UNORM_BLOCK},
{TextureFormat::kUnknown, VK_FORMAT_UNDEFINED},
{TextureFormat::k_24_8, VK_FORMAT_D24_UNORM_S8_UINT}, // ! AMD
{TextureFormat::k_24_8_FLOAT, VK_FORMAT_D24_UNORM_S8_UINT}, // ! AMD
{TextureFormat::k_16, VK_FORMAT_R16_UNORM},
{TextureFormat::k_16_16, VK_FORMAT_R16G16_UNORM},
{TextureFormat::k_16_16_16_16, VK_FORMAT_R16G16B16A16_UNORM},
{TextureFormat::k_16_EXPAND, VK_FORMAT_R16_UNORM}, // ?
{TextureFormat::k_16_16_EXPAND, VK_FORMAT_R16G16_UNORM}, // ?
{TextureFormat::k_16_16_16_16_EXPAND, VK_FORMAT_R16G16B16A16_UNORM}, // ?
{TextureFormat::k_16_FLOAT, VK_FORMAT_R16_SFLOAT},
{TextureFormat::k_16_16_FLOAT, VK_FORMAT_R16G16_SFLOAT},
{TextureFormat::k_16_16_16_16_FLOAT, VK_FORMAT_R16G16B16A16_SFLOAT},
{TextureFormat::k_32, VK_FORMAT_R32_SINT},
{TextureFormat::k_32_32, VK_FORMAT_R32G32_SINT},
{TextureFormat::k_32_32_32_32, VK_FORMAT_R32G32B32A32_SINT},
{TextureFormat::k_32_FLOAT, VK_FORMAT_R32_SFLOAT},
{TextureFormat::k_32_32_FLOAT, VK_FORMAT_R32G32_SFLOAT},
{TextureFormat::k_32_32_32_32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT},
{TextureFormat::k_32_AS_8, VK_FORMAT_UNDEFINED},
{TextureFormat::k_32_AS_8_8, VK_FORMAT_UNDEFINED},
{TextureFormat::k_16_MPEG, VK_FORMAT_UNDEFINED},
{TextureFormat::k_16_16_MPEG, VK_FORMAT_UNDEFINED},
{TextureFormat::k_8_INTERLACED, VK_FORMAT_UNDEFINED},
{TextureFormat::k_32_AS_8_INTERLACED, VK_FORMAT_UNDEFINED},
{TextureFormat::k_32_AS_8_8_INTERLACED, VK_FORMAT_UNDEFINED},
{TextureFormat::k_16_INTERLACED, VK_FORMAT_UNDEFINED},
{TextureFormat::k_16_MPEG_INTERLACED, VK_FORMAT_UNDEFINED},
{TextureFormat::k_16_16_MPEG_INTERLACED, VK_FORMAT_UNDEFINED},
/* k_1_REVERSE */ {VK_FORMAT_UNDEFINED},
/* k_1 */ {VK_FORMAT_UNDEFINED},
/* k_8 */ {VK_FORMAT_R8_UNORM},
// ! A1BGR5
/* k_1_5_5_5 */ {VK_FORMAT_A1R5G5B5_UNORM_PACK16},
/* k_5_6_5 */ {VK_FORMAT_R5G6B5_UNORM_PACK16},
/* 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_UNDEFINED},
/* k_8_B */ {VK_FORMAT_UNDEFINED},
/* k_8_8 */ {VK_FORMAT_R8G8_UNORM},
/* k_Cr_Y1_Cb_Y0 */ {VK_FORMAT_UNDEFINED},
/* k_Y1_Cr_Y0_Cb */ {VK_FORMAT_UNDEFINED},
/* k_Shadow */ {VK_FORMAT_UNDEFINED},
/* k_8_8_8_8_A */ {VK_FORMAT_UNDEFINED},
/* k_4_4_4_4 */ {VK_FORMAT_R4G4B4A4_UNORM_PACK16},
// TODO: Verify if these two are correct (I think not).
/* k_10_11_11 */ {VK_FORMAT_B10G11R11_UFLOAT_PACK32},
/* k_11_11_10 */ {VK_FORMAT_B10G11R11_UFLOAT_PACK32},
/* k_DXT1 */ {VK_FORMAT_BC1_RGBA_UNORM_BLOCK},
/* k_DXT2_3 */ {VK_FORMAT_BC2_UNORM_BLOCK},
/* k_DXT4_5 */ {VK_FORMAT_BC3_UNORM_BLOCK},
/* k_DXV */ {VK_FORMAT_UNDEFINED},
// TODO: D24 unsupported on AMD.
/* k_24_8 */ {VK_FORMAT_D24_UNORM_S8_UINT},
/* k_24_8_FLOAT */ {VK_FORMAT_D24_UNORM_S8_UINT},
/* k_16 */ {VK_FORMAT_R16_UNORM},
/* k_16_16 */ {VK_FORMAT_R16G16_UNORM},
/* k_16_16_16_16 */ {VK_FORMAT_R16G16B16A16_UNORM},
/* k_16_EXPAND */ {VK_FORMAT_R16_UNORM},
/* k_16_16_EXPAND */ {VK_FORMAT_R16G16_UNORM},
/* k_16_16_16_16_EXPAND */ {VK_FORMAT_R16G16B16A16_UNORM},
/* k_16_FLOAT */ {VK_FORMAT_R16_SFLOAT},
/* k_16_16_FLOAT */ {VK_FORMAT_R16G16_SFLOAT},
/* k_16_16_16_16_FLOAT */ {VK_FORMAT_R16G16B16A16_SFLOAT},
/* k_32 */ {VK_FORMAT_R32_SINT},
/* k_32_32 */ {VK_FORMAT_R32G32_SINT},
/* k_32_32_32_32 */ {VK_FORMAT_R32G32B32A32_SINT},
/* k_32_FLOAT */ {VK_FORMAT_R32_SFLOAT},
/* k_32_32_FLOAT */ {VK_FORMAT_R32G32_SFLOAT},
/* k_32_32_32_32_FLOAT */ {VK_FORMAT_R32G32B32A32_SFLOAT},
/* k_32_AS_8 */ {VK_FORMAT_UNDEFINED},
/* k_32_AS_8_8 */ {VK_FORMAT_UNDEFINED},
/* k_16_MPEG */ {VK_FORMAT_UNDEFINED},
/* k_16_16_MPEG */ {VK_FORMAT_UNDEFINED},
/* k_8_INTERLACED */ {VK_FORMAT_UNDEFINED},
/* k_32_AS_8_INTERLACED */ {VK_FORMAT_UNDEFINED},
/* k_32_AS_8_8_INTERLACED */ {VK_FORMAT_UNDEFINED},
/* k_16_INTERLACED */ {VK_FORMAT_UNDEFINED},
/* k_16_MPEG_INTERLACED */ {VK_FORMAT_UNDEFINED},
/* k_16_16_MPEG_INTERLACED */ {VK_FORMAT_UNDEFINED},
// http://fileadmin.cs.lth.se/cs/Personal/Michael_Doggett/talks/unc-xenos-doggett.pdf
{TextureFormat::k_DXN, VK_FORMAT_BC5_UNORM_BLOCK}, // ?
/* k_DXN */ {VK_FORMAT_BC5_UNORM_BLOCK}, // ?
{TextureFormat::k_8_8_8_8_AS_16_16_16_16, VK_FORMAT_R8G8B8A8_UNORM},
{TextureFormat::k_DXT1_AS_16_16_16_16, VK_FORMAT_BC1_RGBA_UNORM_BLOCK},
{TextureFormat::k_DXT2_3_AS_16_16_16_16, VK_FORMAT_BC2_UNORM_BLOCK},
{TextureFormat::k_DXT4_5_AS_16_16_16_16, VK_FORMAT_BC3_UNORM_BLOCK},
{TextureFormat::k_2_10_10_10_AS_16_16_16_16,
VK_FORMAT_A2R10G10B10_UNORM_PACK32},
{TextureFormat::k_10_11_11_AS_16_16_16_16,
VK_FORMAT_B10G11R11_UFLOAT_PACK32}, // ?
{TextureFormat::k_11_11_10_AS_16_16_16_16,
VK_FORMAT_B10G11R11_UFLOAT_PACK32}, // ?
{TextureFormat::k_32_32_32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT},
{TextureFormat::k_DXT3A, VK_FORMAT_UNDEFINED},
{TextureFormat::k_DXT5A, VK_FORMAT_UNDEFINED},
/* k_8_8_8_8_AS_16_16_16_16 */ {VK_FORMAT_R8G8B8A8_UNORM},
/* k_DXT1_AS_16_16_16_16 */ {VK_FORMAT_BC1_RGBA_UNORM_BLOCK},
/* k_DXT2_3_AS_16_16_16_16 */ {VK_FORMAT_BC2_UNORM_BLOCK},
/* k_DXT4_5_AS_16_16_16_16 */ {VK_FORMAT_BC3_UNORM_BLOCK},
/* k_2_10_10_10_AS_16_16_16_16 */ {VK_FORMAT_A2R10G10B10_UNORM_PACK32},
// TODO: Verify if these two are correct (I think not).
/* 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_UNDEFINED},
/* k_DXT5A */ {VK_FORMAT_UNDEFINED},
// http://fileadmin.cs.lth.se/cs/Personal/Michael_Doggett/talks/unc-xenos-doggett.pdf
{TextureFormat::k_CTX1, VK_FORMAT_R8G8_UINT},
/* k_CTX1 */ {VK_FORMAT_R8G8_UINT},
{TextureFormat::k_DXT3A_AS_1_1_1_1, VK_FORMAT_UNDEFINED},
{TextureFormat::kUnknown, VK_FORMAT_UNDEFINED},
{TextureFormat::kUnknown, VK_FORMAT_UNDEFINED},
/* k_DXT3A_AS_1_1_1_1 */ {VK_FORMAT_UNDEFINED},
// Unused.
/* kUnknown */ {VK_FORMAT_UNDEFINED},
/* kUnknown */ {VK_FORMAT_UNDEFINED},
};
TextureCache::TextureCache(Memory* memory, RegisterFile* register_file,