Merge pull request #1209 from Triang3l/all_format_info

[GPU] Add info about unknown texture formats
This commit is contained in:
Justin Moore 2018-09-07 17:08:07 -05:00 committed by GitHub
commit 91c53f975e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 15 deletions

View File

@ -19,7 +19,8 @@
namespace xe { namespace xe {
namespace gpu { namespace gpu {
// a2xx_sq_surfaceformat // a2xx_sq_surfaceformat + D3D::GetGpuFormatFromEDRAMColorFormat::formatMap and
// FMT_ string table from game executables.
enum class TextureFormat : uint32_t { enum class TextureFormat : uint32_t {
k_1_REVERSE = 0, k_1_REVERSE = 0,
k_1 = 1, k_1 = 1,
@ -83,7 +84,8 @@ enum class TextureFormat : uint32_t {
k_DXT5A = 59, k_DXT5A = 59,
k_CTX1 = 60, k_CTX1 = 60,
k_DXT3A_AS_1_1_1_1 = 61, k_DXT3A_AS_1_1_1_1 = 61,
k_2_10_10_10_FLOAT = 62, k_8_8_8_8_GAMMA = 62,
k_2_10_10_10_FLOAT = 63,
kUnknown = 0xFFFFFFFFu, kUnknown = 0xFFFFFFFFu,
}; };
@ -111,6 +113,8 @@ inline TextureFormat GetBaseFormat(TextureFormat texture_format) {
return TextureFormat::k_10_11_11; return TextureFormat::k_10_11_11;
case TextureFormat::k_11_11_10_AS_16_16_16_16: case TextureFormat::k_11_11_10_AS_16_16_16_16:
return TextureFormat::k_11_11_10; return TextureFormat::k_11_11_10;
case TextureFormat::k_8_8_8_8_GAMMA:
return TextureFormat::k_8_8_8_8;
default: default:
break; break;
} }
@ -208,6 +212,7 @@ inline bool IsSRGBCapable(TextureFormat format) {
case TextureFormat::k_2_10_10_10_AS_16_16_16_16: case TextureFormat::k_2_10_10_10_AS_16_16_16_16:
case TextureFormat::k_10_11_11_AS_16_16_16_16: case TextureFormat::k_10_11_11_AS_16_16_16_16:
case TextureFormat::k_11_11_10_AS_16_16_16_16: case TextureFormat::k_11_11_10_AS_16_16_16_16:
case TextureFormat::k_8_8_8_8_GAMMA:
return true; return true;
default: default:
return false; return false;
@ -224,14 +229,18 @@ inline TextureFormat ColorRenderTargetToTextureFormat(
case ColorRenderTargetFormat::k_8_8_8_8: case ColorRenderTargetFormat::k_8_8_8_8:
return TextureFormat::k_8_8_8_8; return TextureFormat::k_8_8_8_8;
case ColorRenderTargetFormat::k_8_8_8_8_GAMMA: case ColorRenderTargetFormat::k_8_8_8_8_GAMMA:
return TextureFormat::k_8_8_8_8; return TextureFormat::k_8_8_8_8_GAMMA;
case ColorRenderTargetFormat::k_2_10_10_10: case ColorRenderTargetFormat::k_2_10_10_10:
return TextureFormat::k_2_10_10_10; return TextureFormat::k_2_10_10_10;
case ColorRenderTargetFormat::k_2_10_10_10_FLOAT: case ColorRenderTargetFormat::k_2_10_10_10_FLOAT:
return TextureFormat::k_2_10_10_10_FLOAT; return TextureFormat::k_2_10_10_10_FLOAT;
case ColorRenderTargetFormat::k_16_16: case ColorRenderTargetFormat::k_16_16:
// TODO(Triang3l): Check if this needs to be k_Shadow according to
// GetGpuFormatFromEDRAMColorFormat.
return TextureFormat::k_16_16; return TextureFormat::k_16_16;
case ColorRenderTargetFormat::k_16_16_16_16: case ColorRenderTargetFormat::k_16_16_16_16:
// TODO(Triang3l): Check if this needs to be k_DXV according to
// GetGpuFormatFromEDRAMColorFormat.
return TextureFormat::k_16_16_16_16; return TextureFormat::k_16_16_16_16;
case ColorRenderTargetFormat::k_16_16_FLOAT: case ColorRenderTargetFormat::k_16_16_FLOAT:
return TextureFormat::k_16_16_FLOAT; return TextureFormat::k_16_16_FLOAT;

View File

@ -33,7 +33,7 @@ const FormatInfo* FormatInfo::Get(uint32_t gpu_format) {
FORMAT_INFO(k_8_8 , kUncompressed, 1, 1, 16), FORMAT_INFO(k_8_8 , kUncompressed, 1, 1, 16),
FORMAT_INFO(k_Cr_Y1_Cb_Y0 , kCompressed , 2, 1, 16), FORMAT_INFO(k_Cr_Y1_Cb_Y0 , kCompressed , 2, 1, 16),
FORMAT_INFO(k_Y1_Cr_Y0_Cb , kCompressed , 2, 1, 16), FORMAT_INFO(k_Y1_Cr_Y0_Cb , kCompressed , 2, 1, 16),
FORMAT_INFO(kUnknown , kUncompressed, 0, 0, 0), // k_Shadow FORMAT_INFO(k_Shadow , kUncompressed, 1, 1, 32),
FORMAT_INFO(k_8_8_8_8_A , kUncompressed, 1, 1, 32), FORMAT_INFO(k_8_8_8_8_A , kUncompressed, 1, 1, 32),
FORMAT_INFO(k_4_4_4_4 , kUncompressed, 1, 1, 16), FORMAT_INFO(k_4_4_4_4 , kUncompressed, 1, 1, 16),
FORMAT_INFO(k_10_11_11 , kUncompressed, 1, 1, 32), FORMAT_INFO(k_10_11_11 , kUncompressed, 1, 1, 32),
@ -41,7 +41,7 @@ const FormatInfo* FormatInfo::Get(uint32_t gpu_format) {
FORMAT_INFO(k_DXT1 , kCompressed , 4, 4, 4), FORMAT_INFO(k_DXT1 , kCompressed , 4, 4, 4),
FORMAT_INFO(k_DXT2_3 , kCompressed , 4, 4, 8), FORMAT_INFO(k_DXT2_3 , kCompressed , 4, 4, 8),
FORMAT_INFO(k_DXT4_5 , kCompressed , 4, 4, 8), FORMAT_INFO(k_DXT4_5 , kCompressed , 4, 4, 8),
FORMAT_INFO(kUnknown , kUncompressed, 0, 0, 0), // k_DXV FORMAT_INFO(k_DXV , kUncompressed, 1, 1, 64),
FORMAT_INFO(k_24_8 , kUncompressed, 1, 1, 32), FORMAT_INFO(k_24_8 , kUncompressed, 1, 1, 32),
FORMAT_INFO(k_24_8_FLOAT , kUncompressed, 1, 1, 32), FORMAT_INFO(k_24_8_FLOAT , kUncompressed, 1, 1, 32),
FORMAT_INFO(k_16 , kUncompressed, 1, 1, 16), FORMAT_INFO(k_16 , kUncompressed, 1, 1, 16),
@ -82,8 +82,8 @@ const FormatInfo* FormatInfo::Get(uint32_t gpu_format) {
FORMAT_INFO(k_DXT5A , kCompressed , 4, 4, 4), FORMAT_INFO(k_DXT5A , kCompressed , 4, 4, 4),
FORMAT_INFO(k_CTX1 , kCompressed , 4, 4, 4), FORMAT_INFO(k_CTX1 , kCompressed , 4, 4, 4),
FORMAT_INFO(k_DXT3A_AS_1_1_1_1 , kCompressed , 4, 4, 4), FORMAT_INFO(k_DXT3A_AS_1_1_1_1 , kCompressed , 4, 4, 4),
FORMAT_INFO(kUnknown , kUncompressed, 0, 0, 0), // k_2_10_10_10_FLOAT FORMAT_INFO(k_8_8_8_8_GAMMA , kUncompressed, 1, 1, 32),
FORMAT_INFO(kUnknown , kUncompressed, 0, 0, 0), // invalid FORMAT_INFO(k_2_10_10_10_FLOAT , kUncompressed, 1, 1, 32),
}; };
return &format_infos[gpu_format]; return &format_infos[gpu_format];
} }

View File

@ -990,9 +990,9 @@ static const char* kColorFormatNames[] = {
/* 7 */ "k_16_16_16_16_FLOAT", /* 7 */ "k_16_16_16_16_FLOAT",
/* 8 */ "unknown(8)", /* 8 */ "unknown(8)",
/* 9 */ "unknown(9)", /* 9 */ "unknown(9)",
/* 10 */ "k_2_10_10_10_unknown", /* 10 */ "k_2_10_10_10_AS_16_16_16_16",
/* 11 */ "unknown(11)", /* 11 */ "unknown(11)",
/* 12 */ "k_2_10_10_10_FLOAT_unknown", /* 12 */ "k_2_10_10_10_FLOAT_AS_16_16_16_16",
/* 13 */ "unknown(13)", /* 13 */ "unknown(13)",
/* 14 */ "k_32_FLOAT", /* 14 */ "k_32_FLOAT",
/* 15 */ "k_32_32_FLOAT", /* 15 */ "k_32_32_FLOAT",

View File

@ -121,9 +121,8 @@ const TextureConfig texture_configs[64] = {
/* k_DXT3A_AS_1_1_1_1 */ ___(UNDEFINED), /* k_DXT3A_AS_1_1_1_1 */ ___(UNDEFINED),
// Unused. /* k_8_8_8_8_GAMMA */ ___(R8G8B8A8_UNORM),
/* kUnknown */ ___(UNDEFINED), /* k_2_10_10_10_FLOAT */ ___(UNDEFINED),
/* kUnknown */ ___(UNDEFINED),
}; };
#undef _cv #undef _cv

View File

@ -196,9 +196,9 @@ enum class ColorFormat : uint32_t {
k_32_FLOAT = 36, k_32_FLOAT = 36,
k_32_32_FLOAT = 37, k_32_32_FLOAT = 37,
k_32_32_32_32_FLOAT = 38, k_32_32_32_32_FLOAT = 38,
k_2_10_10_10_FLOAT = 62, k_2_10_10_10_AS_16_16_16_16 = 54,
k_8_8_8_8_GAMMA = 62,
kUnknown0x36 = 0x36, // not sure, but like 8888 k_2_10_10_10_FLOAT = 63,
}; };
enum class VertexFormat : uint32_t { enum class VertexFormat : uint32_t {