[GPU/D3D12] Correct EDRAM texture format names

This commit is contained in:
Triang3l 2018-08-13 19:50:38 +03:00
parent 24c3bac898
commit 1200eaae24
6 changed files with 45 additions and 40 deletions

View File

@ -42,9 +42,9 @@ const TextureCache::HostFormat TextureCache::host_formats_[64] = {
{DXGI_FORMAT_R8_UNORM, CopyMode::k8bpb}, // k_8_A {DXGI_FORMAT_R8_UNORM, CopyMode::k8bpb}, // k_8_A
{DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_8_B {DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_8_B
{DXGI_FORMAT_R8G8_UNORM, CopyMode::k16bpb}, // k_8_8 {DXGI_FORMAT_R8G8_UNORM, CopyMode::k16bpb}, // k_8_8
{DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_Cr_Y1_Cb_Y0 {DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_Cr_Y1_Cb_Y0_REP
{DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_Y1_Cr_Y0_Cb {DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_Y1_Cr_Y0_Cb_REP
{DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_Shadow {DXGI_FORMAT_R16G16_UNORM, CopyMode::k32bpb}, // k_16_16_EDRAM
{DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_8_8_8_8_A {DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_8_8_8_8_A
{DXGI_FORMAT_B4G4R4A4_UNORM, CopyMode::k16bpb}, // k_4_4_4_4 {DXGI_FORMAT_B4G4R4A4_UNORM, CopyMode::k16bpb}, // k_4_4_4_4
{DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_10_11_11 {DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_10_11_11
@ -52,15 +52,15 @@ const TextureCache::HostFormat TextureCache::host_formats_[64] = {
{DXGI_FORMAT_BC1_UNORM, CopyMode::k64bpb}, // k_DXT1 {DXGI_FORMAT_BC1_UNORM, CopyMode::k64bpb}, // k_DXT1
{DXGI_FORMAT_BC2_UNORM, CopyMode::k128bpb}, // k_DXT2_3 {DXGI_FORMAT_BC2_UNORM, CopyMode::k128bpb}, // k_DXT2_3
{DXGI_FORMAT_BC3_UNORM, CopyMode::k128bpb}, // k_DXT4_5 {DXGI_FORMAT_BC3_UNORM, CopyMode::k128bpb}, // k_DXT4_5
{DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_DXV {DXGI_FORMAT_R16G16B16A16_UNORM, CopyMode::k64bpb}, // k_16_16_16_16_EDRAM
{DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_24_8 {DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_24_8
{DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_24_8_FLOAT {DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_24_8_FLOAT
{DXGI_FORMAT_R16_UNORM, CopyMode::k16bpb}, // k_16 {DXGI_FORMAT_R16_UNORM, CopyMode::k16bpb}, // k_16
{DXGI_FORMAT_R16G16_UNORM, CopyMode::k32bpb}, // k_16_16 {DXGI_FORMAT_R16G16_UNORM, CopyMode::k32bpb}, // k_16_16
{DXGI_FORMAT_R16G16B16A16_UNORM, CopyMode::k64bpb}, // k_16_16_16_16 {DXGI_FORMAT_R16G16B16A16_UNORM, CopyMode::k64bpb}, // k_16_16_16_16
{DXGI_FORMAT_R16_UNORM, CopyMode::k16bpb}, // k_16_EXPAND {DXGI_FORMAT_R16_FLOAT, CopyMode::k16bpb}, // k_16_EXPAND
{DXGI_FORMAT_R16G16_UNORM, CopyMode::k32bpb}, // k_16_16_EXPAND {DXGI_FORMAT_R16G16_FLOAT, CopyMode::k32bpb}, // k_16_16_EXPAND
{DXGI_FORMAT_R16G16B16A16_UNORM, CopyMode::k64bpb}, // k_16_16_16_16_EXPAND {DXGI_FORMAT_R16G16B16A16_FLOAT, CopyMode::k64bpb}, // k_16_16_16_16_EXPAND
{DXGI_FORMAT_R16_FLOAT, CopyMode::k16bpb}, // k_16_FLOAT {DXGI_FORMAT_R16_FLOAT, CopyMode::k16bpb}, // k_16_FLOAT
{DXGI_FORMAT_R16G16_FLOAT, CopyMode::k32bpb}, // k_16_16_FLOAT {DXGI_FORMAT_R16G16_FLOAT, CopyMode::k32bpb}, // k_16_16_FLOAT
{DXGI_FORMAT_R16G16B16A16_FLOAT, CopyMode::k64bpb}, // k_16_16_16_16_FLOAT {DXGI_FORMAT_R16G16B16A16_FLOAT, CopyMode::k64bpb}, // k_16_16_16_16_FLOAT
@ -95,7 +95,7 @@ const TextureCache::HostFormat TextureCache::host_formats_[64] = {
{DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_CTX1 {DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_CTX1
{DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_DXT3A_AS_1_1_1_1 {DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_DXT3A_AS_1_1_1_1
{DXGI_FORMAT_R8G8B8A8_UNORM, CopyMode::k32bpb}, // k_8_8_8_8_GAMMA {DXGI_FORMAT_R8G8B8A8_UNORM, CopyMode::k32bpb}, // k_8_8_8_8_GAMMA
{DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_2_10_10_10_FLOAT {DXGI_FORMAT_UNKNOWN, CopyMode::kUnknown}, // k_2_10_10_10_FLOAT_EDRAM
}; };
const char* const TextureCache::dimension_names_[4] = {"1D", "2D", "3D", const char* const TextureCache::dimension_names_[4] = {"1D", "2D", "3D",

View File

@ -19,7 +19,8 @@
namespace xe { namespace xe {
namespace gpu { namespace gpu {
// a2xx_sq_surfaceformat // a2xx_sq_surfaceformat +
// https://github.com/indirivacua/RAGE-Console-Texture-Editor/blob/master/Console.Xbox360.Graphics.pas
enum class TextureFormat : uint32_t { enum class TextureFormat : uint32_t {
k_1_REVERSE = 0, k_1_REVERSE = 0,
k_1 = 1, k_1 = 1,
@ -32,9 +33,9 @@ enum class TextureFormat : uint32_t {
k_8_A = 8, k_8_A = 8,
k_8_B = 9, k_8_B = 9,
k_8_8 = 10, k_8_8 = 10,
k_Cr_Y1_Cb_Y0 = 11, k_Cr_Y1_Cb_Y0_REP = 11,
k_Y1_Cr_Y0_Cb = 12, k_Y1_Cr_Y0_Cb_REP = 12,
k_Shadow = 13, k_16_16_EDRAM = 13,
k_8_8_8_8_A = 14, k_8_8_8_8_A = 14,
k_4_4_4_4 = 15, k_4_4_4_4 = 15,
k_10_11_11 = 16, k_10_11_11 = 16,
@ -42,7 +43,7 @@ enum class TextureFormat : uint32_t {
k_DXT1 = 18, k_DXT1 = 18,
k_DXT2_3 = 19, k_DXT2_3 = 19,
k_DXT4_5 = 20, k_DXT4_5 = 20,
k_DXV = 21, k_16_16_16_16_EDRAM = 21,
k_24_8 = 22, k_24_8 = 22,
k_24_8_FLOAT = 23, k_24_8_FLOAT = 23,
k_16 = 24, k_16 = 24,
@ -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_EDRAM = 62,
k_2_10_10_10_FLOAT_EDRAM = 63,
kUnknown = 0xFFFFFFFFu, kUnknown = 0xFFFFFFFFu,
}; };
@ -91,6 +93,10 @@ enum class TextureFormat : uint32_t {
inline TextureFormat GetBaseFormat(TextureFormat texture_format) { inline TextureFormat GetBaseFormat(TextureFormat texture_format) {
// These formats are used for resampling textures / gamma control. // These formats are used for resampling textures / gamma control.
switch (texture_format) { switch (texture_format) {
case TextureFormat::k_16_16_EDRAM:
return TextureFormat::k_16_16;
case TextureFormat::k_16_16_16_16_EDRAM:
return TextureFormat::k_16_16_16_16;
case TextureFormat::k_16_EXPAND: case TextureFormat::k_16_EXPAND:
return TextureFormat::k_16_FLOAT; return TextureFormat::k_16_FLOAT;
case TextureFormat::k_16_16_EXPAND: case TextureFormat::k_16_16_EXPAND:
@ -98,6 +104,7 @@ inline TextureFormat GetBaseFormat(TextureFormat texture_format) {
case TextureFormat::k_16_16_16_16_EXPAND: case TextureFormat::k_16_16_16_16_EXPAND:
return TextureFormat::k_16_16_16_16_FLOAT; return TextureFormat::k_16_16_16_16_FLOAT;
case TextureFormat::k_8_8_8_8_AS_16_16_16_16: case TextureFormat::k_8_8_8_8_AS_16_16_16_16:
case TextureFormat::k_8_8_8_8_GAMMA_EDRAM:
return TextureFormat::k_8_8_8_8; return TextureFormat::k_8_8_8_8;
case TextureFormat::k_DXT1_AS_16_16_16_16: case TextureFormat::k_DXT1_AS_16_16_16_16:
return TextureFormat::k_DXT1; return TextureFormat::k_DXT1;
@ -171,8 +178,8 @@ inline bool IsSRGBCapable(TextureFormat format) {
case TextureFormat::k_6_5_5: case TextureFormat::k_6_5_5:
case TextureFormat::k_8_8_8_8: case TextureFormat::k_8_8_8_8:
case TextureFormat::k_8_8: case TextureFormat::k_8_8:
case TextureFormat::k_Cr_Y1_Cb_Y0: case TextureFormat::k_Cr_Y1_Cb_Y0_REP:
case TextureFormat::k_Y1_Cr_Y0_Cb: case TextureFormat::k_Y1_Cr_Y0_Cb_REP:
case TextureFormat::k_4_4_4_4: case TextureFormat::k_4_4_4_4:
case TextureFormat::k_DXT1: case TextureFormat::k_DXT1:
case TextureFormat::k_DXT2_3: case TextureFormat::k_DXT2_3:
@ -224,15 +231,15 @@ 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_EDRAM;
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_EDRAM;
case ColorRenderTargetFormat::k_16_16: case ColorRenderTargetFormat::k_16_16:
return TextureFormat::k_16_16; return TextureFormat::k_16_16_EDRAM;
case ColorRenderTargetFormat::k_16_16_16_16: case ColorRenderTargetFormat::k_16_16_16_16:
return TextureFormat::k_16_16_16_16; return TextureFormat::k_16_16_16_16_EDRAM;
case ColorRenderTargetFormat::k_16_16_FLOAT: case ColorRenderTargetFormat::k_16_16_FLOAT:
return TextureFormat::k_16_16_FLOAT; return TextureFormat::k_16_16_FLOAT;
case ColorRenderTargetFormat::k_16_16_16_16_FLOAT: case ColorRenderTargetFormat::k_16_16_16_16_FLOAT:
@ -240,7 +247,7 @@ inline TextureFormat ColorRenderTargetToTextureFormat(
case ColorRenderTargetFormat::k_2_10_10_10_AS_16_16_16_16: case ColorRenderTargetFormat::k_2_10_10_10_AS_16_16_16_16:
return TextureFormat::k_2_10_10_10_AS_16_16_16_16; return TextureFormat::k_2_10_10_10_AS_16_16_16_16;
case ColorRenderTargetFormat::k_2_10_10_10_FLOAT_AS_16_16_16_16: case ColorRenderTargetFormat::k_2_10_10_10_FLOAT_AS_16_16_16_16:
return TextureFormat::k_2_10_10_10_FLOAT; return TextureFormat::k_2_10_10_10_FLOAT_EDRAM;
case ColorRenderTargetFormat::k_32_FLOAT: case ColorRenderTargetFormat::k_32_FLOAT:
return TextureFormat::k_32_FLOAT; return TextureFormat::k_32_FLOAT;
case ColorRenderTargetFormat::k_32_32_FLOAT: case ColorRenderTargetFormat::k_32_32_FLOAT:

View File

@ -31,9 +31,9 @@ const FormatInfo* FormatInfo::Get(uint32_t gpu_format) {
FORMAT_INFO(k_8_A , kUncompressed, 1, 1, 8), FORMAT_INFO(k_8_A , kUncompressed, 1, 1, 8),
FORMAT_INFO(k_8_B , kUncompressed, 1, 1, 8), FORMAT_INFO(k_8_B , kUncompressed, 1, 1, 8),
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_REP , kCompressed , 2, 1, 16),
FORMAT_INFO(k_Y1_Cr_Y0_Cb , kCompressed , 2, 1, 16), FORMAT_INFO(k_Y1_Cr_Y0_Cb_REP , kCompressed , 2, 1, 16),
FORMAT_INFO(kUnknown , kUncompressed, 1, 1, 32), // k_Shadow FORMAT_INFO(k_16_16_EDRAM , 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, 1, 1, 64), // k_DXV FORMAT_INFO(k_16_16_16_16_EDRAM , 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, 1, 1, 32), // k_2_10_10_10_FLOAT FORMAT_INFO(k_8_8_8_8_GAMMA_EDRAM , kUncompressed, 1, 1, 32),
FORMAT_INFO(kUnknown , kUncompressed, 1, 1, 32), // invalid FORMAT_INFO(k_2_10_10_10_FLOAT_EDRAM , 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

@ -54,9 +54,9 @@ const TextureConfig texture_configs[64] = {
/* k_8_A */ ___(R8_UNORM), /* k_8_A */ ___(R8_UNORM),
/* k_8_B */ ___(UNDEFINED), /* k_8_B */ ___(UNDEFINED),
/* k_8_8 */ ___(R8G8_UNORM), /* k_8_8 */ ___(R8G8_UNORM),
/* k_Cr_Y1_Cb_Y0 */ ___(UNDEFINED), /* k_Cr_Y1_Cb_Y0_REP */ ___(UNDEFINED),
/* k_Y1_Cr_Y0_Cb */ ___(UNDEFINED), /* k_Y1_Cr_Y0_Cb_REP */ ___(UNDEFINED),
/* k_Shadow */ ___(UNDEFINED), /* k_16_16_EDRAM */ ___(R16G16_UNORM),
/* k_8_8_8_8_A */ ___(UNDEFINED), /* k_8_8_8_8_A */ ___(UNDEFINED),
/* k_4_4_4_4 */ __v(R4G4B4A4_UNORM_PACK16, YXWZ), /* k_4_4_4_4 */ __v(R4G4B4A4_UNORM_PACK16, YXWZ),
// TODO: Verify if these two are correct (I think not). // TODO: Verify if these two are correct (I think not).
@ -66,7 +66,7 @@ const TextureConfig texture_configs[64] = {
/* k_DXT1 */ ___(BC1_RGBA_UNORM_BLOCK), /* k_DXT1 */ ___(BC1_RGBA_UNORM_BLOCK),
/* k_DXT2_3 */ ___(BC2_UNORM_BLOCK), /* k_DXT2_3 */ ___(BC2_UNORM_BLOCK),
/* k_DXT4_5 */ ___(BC3_UNORM_BLOCK), /* k_DXT4_5 */ ___(BC3_UNORM_BLOCK),
/* k_DXV */ ___(UNDEFINED), /* k_16_16_16_16_EDRAM */ ___(R16G16B16A16_UNORM),
// TODO: D24 unsupported on AMD. // TODO: D24 unsupported on AMD.
/* k_24_8 */ ___(D24_UNORM_S8_UINT), /* k_24_8 */ ___(D24_UNORM_S8_UINT),
@ -74,9 +74,9 @@ const TextureConfig texture_configs[64] = {
/* k_16 */ ___(R16_UNORM), /* k_16 */ ___(R16_UNORM),
/* k_16_16 */ ___(R16G16_UNORM), /* k_16_16 */ ___(R16G16_UNORM),
/* k_16_16_16_16 */ ___(R16G16B16A16_UNORM), /* k_16_16_16_16 */ ___(R16G16B16A16_UNORM),
/* k_16_EXPAND */ ___(R16_UNORM), /* k_16_EXPAND */ ___(R16_SFLOAT),
/* k_16_16_EXPAND */ ___(R16G16_UNORM), /* k_16_16_EXPAND */ ___(R16G16_SFLOAT),
/* k_16_16_16_16_EXPAND */ ___(R16G16B16A16_UNORM), /* k_16_16_16_16_EXPAND */ ___(R16G16B16A16_SFLOAT),
/* k_16_FLOAT */ ___(R16_SFLOAT), /* k_16_FLOAT */ ___(R16_SFLOAT),
/* k_16_16_FLOAT */ ___(R16G16_SFLOAT), /* k_16_16_FLOAT */ ___(R16G16_SFLOAT),
/* k_16_16_16_16_FLOAT */ ___(R16G16B16A16_SFLOAT), /* k_16_16_16_16_FLOAT */ ___(R16G16B16A16_SFLOAT),
@ -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_EDRAM */ ___(R8G8B8A8_UNORM),
/* kUnknown */ ___(UNDEFINED), /* k_2_10_10_10_FLOAT_EDRAM */ ___(UNDEFINED),
/* kUnknown */ ___(UNDEFINED),
}; };
#undef _cv #undef _cv

View File

@ -185,7 +185,6 @@ 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,
kUnknown0x36 = 0x36, // not sure, but like 8888 kUnknown0x36 = 0x36, // not sure, but like 8888
}; };