Prettify format info table.

This commit is contained in:
gibbed 2017-08-06 13:57:13 -05:00
parent eb022939d1
commit 791f81c484
1 changed files with 67 additions and 76 deletions

View File

@ -21,86 +21,77 @@ namespace gpu {
using namespace xe::gpu::xenos; using namespace xe::gpu::xenos;
#define FORMAT_INFO(texture_format, format, block_width, block_height, bits_per_pixel) \
{TextureFormat::texture_format, FormatType::format, block_width, block_height, bits_per_pixel}
const FormatInfo* FormatInfo::Get(uint32_t gpu_format) { const FormatInfo* FormatInfo::Get(uint32_t gpu_format) {
static const FormatInfo format_infos[64] = { static const FormatInfo format_infos[] = {
{TextureFormat::k_1_REVERSE, FormatType::kUncompressed, 1, 1, 1}, FORMAT_INFO(k_1 , kUncompressed, 1, 1, 1),
{TextureFormat::k_1, FormatType::kUncompressed, 1, 1, 1}, FORMAT_INFO(k_8 , kUncompressed, 1, 1, 8),
{TextureFormat::k_8, FormatType::kUncompressed, 1, 1, 8}, FORMAT_INFO(k_1_5_5_5 , kUncompressed, 1, 1, 16),
{TextureFormat::k_1_5_5_5, FormatType::kUncompressed, 1, 1, 16}, FORMAT_INFO(k_5_6_5 , kUncompressed, 1, 1, 16),
{TextureFormat::k_5_6_5, FormatType::kUncompressed, 1, 1, 16}, FORMAT_INFO(k_6_5_5 , kUncompressed, 1, 1, 16),
{TextureFormat::k_6_5_5, FormatType::kUncompressed, 1, 1, 16}, FORMAT_INFO(k_8_8_8_8 , kUncompressed, 1, 1, 32),
{TextureFormat::k_8_8_8_8, FormatType::kUncompressed, 1, 1, 32}, FORMAT_INFO(k_2_10_10_10 , kUncompressed, 1, 1, 32),
{TextureFormat::k_2_10_10_10, FormatType::kUncompressed, 1, 1, 32}, FORMAT_INFO(k_8_A , kUncompressed, 1, 1, 8),
{TextureFormat::k_8_A, FormatType::kUncompressed, 1, 1, 8}, FORMAT_INFO(k_8_B , kUncompressed, 1, 1, 8),
{TextureFormat::k_8_B, FormatType::kUncompressed, 1, 1, 8}, FORMAT_INFO(k_8_8 , kUncompressed, 1, 1, 16),
{TextureFormat::k_8_8, FormatType::kUncompressed, 1, 1, 16}, FORMAT_INFO(k_Cr_Y1_Cb_Y0 , kCompressed , 2, 1, 16),
{TextureFormat::k_Cr_Y1_Cb_Y0, FormatType::kCompressed, 2, 1, 16}, FORMAT_INFO(k_Y1_Cr_Y0_Cb , kCompressed , 2, 1, 16),
{TextureFormat::k_Y1_Cr_Y0_Cb, FormatType::kCompressed, 2, 1, 16}, FORMAT_INFO(kUnknown , kUncompressed, 0, 0, 0),
{TextureFormat::kUnknown, FormatType::kUncompressed, 0, 0}, FORMAT_INFO(k_8_8_8_8_A , kUncompressed, 1, 1, 32),
{TextureFormat::k_8_8_8_8_A, FormatType::kUncompressed, 1, 1, 32}, FORMAT_INFO(k_4_4_4_4 , kUncompressed, 1, 1, 16),
{TextureFormat::k_4_4_4_4, FormatType::kUncompressed, 1, 1, 16}, FORMAT_INFO(k_10_11_11 , kUncompressed, 1, 1, 32),
{TextureFormat::k_10_11_11, FormatType::kUncompressed, 1, 1, 32}, FORMAT_INFO(k_11_11_10 , kUncompressed, 1, 1, 32),
{TextureFormat::k_11_11_10, FormatType::kUncompressed, 1, 1, 32}, FORMAT_INFO(k_DXT1 , kCompressed , 4, 4, 4),
{TextureFormat::k_DXT1, FormatType::kCompressed, 4, 4, 4}, FORMAT_INFO(k_DXT2_3 , kCompressed , 4, 4, 8),
{TextureFormat::k_DXT2_3, FormatType::kCompressed, 4, 4, 8}, FORMAT_INFO(k_DXT4_5 , kCompressed , 4, 4, 8),
{TextureFormat::k_DXT4_5, FormatType::kCompressed, 4, 4, 8}, FORMAT_INFO(kUnknown , kUncompressed, 0, 0, 0),
{TextureFormat::kUnknown, FormatType::kUncompressed, 0, 0}, FORMAT_INFO(k_24_8 , kUncompressed, 1, 1, 32),
{TextureFormat::k_24_8, FormatType::kUncompressed, 1, 1, 32}, FORMAT_INFO(k_24_8_FLOAT , kUncompressed, 1, 1, 32),
{TextureFormat::k_24_8_FLOAT, FormatType::kUncompressed, 1, 1, 32}, FORMAT_INFO(k_16 , kUncompressed, 1, 1, 16),
{TextureFormat::k_16, FormatType::kUncompressed, 1, 1, 16}, FORMAT_INFO(k_16_16 , kUncompressed, 1, 1, 32),
{TextureFormat::k_16_16, FormatType::kUncompressed, 1, 1, 32}, FORMAT_INFO(k_16_16_16_16 , kUncompressed, 1, 1, 64),
{TextureFormat::k_16_16_16_16, FormatType::kUncompressed, 1, 1, 64}, FORMAT_INFO(k_16_EXPAND , kUncompressed, 1, 1, 16),
{TextureFormat::k_16_EXPAND, FormatType::kUncompressed, 1, 1, 16}, FORMAT_INFO(k_16_16_EXPAND , kUncompressed, 1, 1, 32),
{TextureFormat::k_16_16_EXPAND, FormatType::kUncompressed, 1, 1, 32}, FORMAT_INFO(k_16_16_16_16_EXPAND , kUncompressed, 1, 1, 64),
{TextureFormat::k_16_16_16_16_EXPAND, FormatType::kUncompressed, 1, 1, FORMAT_INFO(k_16_FLOAT , kUncompressed, 1, 1, 16),
64}, FORMAT_INFO(k_16_16_FLOAT , kUncompressed, 1, 1, 32),
{TextureFormat::k_16_FLOAT, FormatType::kUncompressed, 1, 1, 16}, FORMAT_INFO(k_16_16_16_16_FLOAT , kUncompressed, 1, 1, 64),
{TextureFormat::k_16_16_FLOAT, FormatType::kUncompressed, 1, 1, 32}, FORMAT_INFO(k_32 , kUncompressed, 1, 1, 32),
{TextureFormat::k_16_16_16_16_FLOAT, FormatType::kUncompressed, 1, 1, 64}, FORMAT_INFO(k_32_32 , kUncompressed, 1, 1, 64),
{TextureFormat::k_32, FormatType::kUncompressed, 1, 1, 32}, FORMAT_INFO(k_32_32_32_32 , kUncompressed, 1, 1, 128),
{TextureFormat::k_32_32, FormatType::kUncompressed, 1, 1, 64}, FORMAT_INFO(k_32_FLOAT , kUncompressed, 1, 1, 32),
{TextureFormat::k_32_32_32_32, FormatType::kUncompressed, 1, 1, 128}, FORMAT_INFO(k_32_32_FLOAT , kUncompressed, 1, 1, 64),
{TextureFormat::k_32_FLOAT, FormatType::kUncompressed, 1, 1, 32}, FORMAT_INFO(k_32_32_32_32_FLOAT , kUncompressed, 1, 1, 128),
{TextureFormat::k_32_32_FLOAT, FormatType::kUncompressed, 1, 1, 64}, FORMAT_INFO(k_32_AS_8 , kCompressed , 4, 1, 8),
{TextureFormat::k_32_32_32_32_FLOAT, FormatType::kUncompressed, 1, 1, FORMAT_INFO(k_32_AS_8_8 , kCompressed , 2, 1, 16),
128}, FORMAT_INFO(k_16_MPEG , kUncompressed, 1, 1, 16),
{TextureFormat::k_32_AS_8, FormatType::kCompressed, 4, 1, 8}, FORMAT_INFO(k_16_16_MPEG , kUncompressed, 1, 1, 32),
{TextureFormat::k_32_AS_8_8, FormatType::kCompressed, 2, 1, 16}, FORMAT_INFO(k_8_INTERLACED , kUncompressed, 1, 1, 8),
{TextureFormat::k_16_MPEG, FormatType::kUncompressed, 1, 1, 16}, FORMAT_INFO(k_32_AS_8_INTERLACED , kCompressed , 4, 1, 8),
{TextureFormat::k_16_16_MPEG, FormatType::kUncompressed, 1, 1, 32}, FORMAT_INFO(k_32_AS_8_8_INTERLACED , kCompressed , 1, 1, 16),
{TextureFormat::k_8_INTERLACED, FormatType::kUncompressed, 1, 1, 8}, FORMAT_INFO(k_16_INTERLACED , kUncompressed, 1, 1, 16),
{TextureFormat::k_32_AS_8_INTERLACED, FormatType::kCompressed, 4, 1, 8}, FORMAT_INFO(k_16_MPEG_INTERLACED , kUncompressed, 1, 1, 16),
{TextureFormat::k_32_AS_8_8_INTERLACED, FormatType::kCompressed, 1, 1, FORMAT_INFO(k_16_16_MPEG_INTERLACED , kUncompressed, 1, 1, 32),
16}, FORMAT_INFO(k_DXN , kCompressed , 4, 4, 8),
{TextureFormat::k_16_INTERLACED, FormatType::kUncompressed, 1, 1, 16}, FORMAT_INFO(k_8_8_8_8_AS_16_16_16_16 , kUncompressed, 1, 1, 32),
{TextureFormat::k_16_MPEG_INTERLACED, FormatType::kUncompressed, 1, 1, FORMAT_INFO(k_DXT1_AS_16_16_16_16 , kCompressed , 4, 4, 4),
16}, FORMAT_INFO(k_DXT2_3_AS_16_16_16_16 , kCompressed , 4, 4, 8),
{TextureFormat::k_16_16_MPEG_INTERLACED, FormatType::kUncompressed, 1, 1, FORMAT_INFO(k_DXT4_5_AS_16_16_16_16 , kCompressed , 4, 4, 8),
32}, FORMAT_INFO(k_2_10_10_10_AS_16_16_16_16, kUncompressed, 1, 1, 32),
{TextureFormat::k_DXN, FormatType::kCompressed, 4, 4, 8}, FORMAT_INFO(k_10_11_11_AS_16_16_16_16 , kUncompressed, 1, 1, 32),
{TextureFormat::k_8_8_8_8_AS_16_16_16_16, FormatType::kUncompressed, 1, 1, FORMAT_INFO(k_11_11_10_AS_16_16_16_16 , kUncompressed, 1, 1, 32),
32}, FORMAT_INFO(k_32_32_32_FLOAT , kUncompressed, 1, 1, 96),
{TextureFormat::k_DXT1_AS_16_16_16_16, FormatType::kCompressed, 4, 4, 4}, FORMAT_INFO(k_DXT3A , kCompressed , 4, 4, 4),
{TextureFormat::k_DXT2_3_AS_16_16_16_16, FormatType::kCompressed, 4, 4, FORMAT_INFO(k_DXT5A , kCompressed , 4, 4, 4),
8}, FORMAT_INFO(k_CTX1 , kCompressed , 4, 4, 4),
{TextureFormat::k_DXT4_5_AS_16_16_16_16, FormatType::kCompressed, 4, 4, FORMAT_INFO(k_DXT3A_AS_1_1_1_1 , kCompressed , 4, 4, 4),
8}, FORMAT_INFO(kUnknown , kUncompressed, 0, 0, 0),
{TextureFormat::k_2_10_10_10_AS_16_16_16_16, FormatType::kUncompressed, 1, FORMAT_INFO(kUnknown , kUncompressed, 0, 0, 0),
1, 32},
{TextureFormat::k_10_11_11_AS_16_16_16_16, FormatType::kUncompressed, 1,
1, 32},
{TextureFormat::k_11_11_10_AS_16_16_16_16, FormatType::kUncompressed, 1,
1, 32},
{TextureFormat::k_32_32_32_FLOAT, FormatType::kUncompressed, 1, 1, 96},
{TextureFormat::k_DXT3A, FormatType::kCompressed, 4, 4, 4},
{TextureFormat::k_DXT5A, FormatType::kCompressed, 4, 4, 4},
{TextureFormat::k_CTX1, FormatType::kCompressed, 4, 4, 4},
{TextureFormat::k_DXT3A_AS_1_1_1_1, FormatType::kCompressed, 4, 4, 4},
{TextureFormat::kUnknown, FormatType::kUncompressed, 0, 0},
{TextureFormat::kUnknown, FormatType::kUncompressed, 0, 0},
}; };
return &format_infos[gpu_format]; return &format_infos[gpu_format];
} }
#undef FORMAT_INFO
bool TextureInfo::Prepare(const xe_gpu_texture_fetch_t& fetch, bool TextureInfo::Prepare(const xe_gpu_texture_fetch_t& fetch,
TextureInfo* out_info) { TextureInfo* out_info) {