Permalink
Browse files

Merge pull request #1209 from Triang3l/all_format_info

[GPU] Add info about unknown texture formats
  • Loading branch information...
DrChat committed Sep 7, 2018
2 parents 413a04e + d75a372 commit 91c53f975ee60a79c81b064cf186caf8f86f4a30
@@ -19,7 +19,8 @@
namespace xe {
namespace gpu {
// a2xx_sq_surfaceformat
// a2xx_sq_surfaceformat + D3D::GetGpuFormatFromEDRAMColorFormat::formatMap and
// FMT_ string table from game executables.
enum class TextureFormat : uint32_t {
k_1_REVERSE = 0,
k_1 = 1,
@@ -83,7 +84,8 @@ enum class TextureFormat : uint32_t {
k_DXT5A = 59,
k_CTX1 = 60,
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,
};
@@ -111,6 +113,8 @@ inline TextureFormat GetBaseFormat(TextureFormat texture_format) {
return TextureFormat::k_10_11_11;
case TextureFormat::k_11_11_10_AS_16_16_16_16:
return TextureFormat::k_11_11_10;
case TextureFormat::k_8_8_8_8_GAMMA:
return TextureFormat::k_8_8_8_8;
default:
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_10_11_11_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;
default:
return false;
@@ -224,14 +229,18 @@ inline TextureFormat ColorRenderTargetToTextureFormat(
case ColorRenderTargetFormat::k_8_8_8_8:
return TextureFormat::k_8_8_8_8;
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:
return TextureFormat::k_2_10_10_10;
case ColorRenderTargetFormat::k_2_10_10_10_FLOAT:
return TextureFormat::k_2_10_10_10_FLOAT;
case ColorRenderTargetFormat::k_16_16:
// TODO(Triang3l): Check if this needs to be k_Shadow according to
// GetGpuFormatFromEDRAMColorFormat.
return TextureFormat::k_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;
case ColorRenderTargetFormat::k_16_16_FLOAT:
return TextureFormat::k_16_16_FLOAT;
@@ -33,15 +33,15 @@ const FormatInfo* FormatInfo::Get(uint32_t gpu_format) {
FORMAT_INFO(k_8_8 , kUncompressed, 1, 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(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_4_4_4_4 , kUncompressed, 1, 1, 16),
FORMAT_INFO(k_10_11_11 , kUncompressed, 1, 1, 32),
FORMAT_INFO(k_11_11_10 , kUncompressed, 1, 1, 32),
FORMAT_INFO(k_DXT1 , kCompressed , 4, 4, 4),
FORMAT_INFO(k_DXT2_3 , 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_FLOAT , kUncompressed, 1, 1, 32),
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_CTX1 , 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(kUnknown , kUncompressed, 0, 0, 0), // invalid
FORMAT_INFO(k_8_8_8_8_GAMMA , kUncompressed, 1, 1, 32),
FORMAT_INFO(k_2_10_10_10_FLOAT , kUncompressed, 1, 1, 32),
};
return &format_infos[gpu_format];
}
@@ -990,9 +990,9 @@ static const char* kColorFormatNames[] = {
/* 7 */ "k_16_16_16_16_FLOAT",
/* 8 */ "unknown(8)",
/* 9 */ "unknown(9)",
/* 10 */ "k_2_10_10_10_unknown",
/* 10 */ "k_2_10_10_10_AS_16_16_16_16",
/* 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)",
/* 14 */ "k_32_FLOAT",
/* 15 */ "k_32_32_FLOAT",
@@ -121,9 +121,8 @@ const TextureConfig texture_configs[64] = {
/* k_DXT3A_AS_1_1_1_1 */ ___(UNDEFINED),
// Unused.
/* kUnknown */ ___(UNDEFINED),
/* kUnknown */ ___(UNDEFINED),
/* k_8_8_8_8_GAMMA */ ___(R8G8B8A8_UNORM),
/* k_2_10_10_10_FLOAT */ ___(UNDEFINED),
};
#undef _cv
@@ -196,9 +196,9 @@ enum class ColorFormat : uint32_t {
k_32_FLOAT = 36,
k_32_32_FLOAT = 37,
k_32_32_32_32_FLOAT = 38,
k_2_10_10_10_FLOAT = 62,
kUnknown0x36 = 0x36, // not sure, but like 8888
k_2_10_10_10_AS_16_16_16_16 = 54,
k_8_8_8_8_GAMMA = 62,
k_2_10_10_10_FLOAT = 63,
};
enum class VertexFormat : uint32_t {

0 comments on commit 91c53f9

Please sign in to comment.