ATOM-16320 Remove PVRTC and ETC compressor (#4557)
Signed-off-by: Qing Tao <qingtao@amazon.com>
This commit is contained in:
@@ -237,14 +237,8 @@ namespace ImageProcessingAtom
|
||||
const static AZ::u32 FOURCC_CEnd = IMAGE_BUIDER_MAKEFOURCC('C', 'E', 'n', 'd'); // O3DE extension end
|
||||
const static AZ::u32 FOURCC_AttC = IMAGE_BUIDER_MAKEFOURCC('A', 't', 't', 'C'); // Chunk Attached Channel
|
||||
|
||||
//Fourcc for pixel formats which aren't supported by dx10, such as astc formats, etc formats, pvrtc formats
|
||||
//Fourcc for pixel formats which aren't supported by dx10, such as astc formats
|
||||
//They are used for dwFourCC of dds header's DDS_PIXELFORMAT to identify non-dx10 pixel formats
|
||||
const static AZ::u32 FOURCC_EAC_R11 = IMAGE_BUIDER_MAKEFOURCC('E', 'A', 'R', ' ');
|
||||
const static AZ::u32 FOURCC_EAC_RG11 = IMAGE_BUIDER_MAKEFOURCC('E', 'A', 'R', 'G');
|
||||
const static AZ::u32 FOURCC_ETC2 = IMAGE_BUIDER_MAKEFOURCC('E', 'T', '2', ' ');
|
||||
const static AZ::u32 FOURCC_ETC2A = IMAGE_BUIDER_MAKEFOURCC('E', 'T', '2', 'A');
|
||||
const static AZ::u32 FOURCC_PVRTC2 = IMAGE_BUIDER_MAKEFOURCC('P', 'V', 'R', '2');
|
||||
const static AZ::u32 FOURCC_PVRTC4 = IMAGE_BUIDER_MAKEFOURCC('P', 'V', 'R', '4');
|
||||
const static AZ::u32 FOURCC_ASTC_4x4 = IMAGE_BUIDER_MAKEFOURCC('A', 'S', '4', '4');
|
||||
const static AZ::u32 FOURCC_ASTC_5x4 = IMAGE_BUIDER_MAKEFOURCC('A', 'S', '5', '4');
|
||||
const static AZ::u32 FOURCC_ASTC_5x5 = IMAGE_BUIDER_MAKEFOURCC('A', 'S', '5', '5');
|
||||
@@ -260,10 +254,10 @@ namespace ImageProcessingAtom
|
||||
const static AZ::u32 FOURCC_ASTC_12x10 = IMAGE_BUIDER_MAKEFOURCC('A', 'S', 'C', 'A');
|
||||
const static AZ::u32 FOURCC_ASTC_12x12 = IMAGE_BUIDER_MAKEFOURCC('A', 'S', 'C', 'C');
|
||||
|
||||
//legacy formats names. they are only used for load rc.exe's dds formats
|
||||
//legacy formats names. they are only used for load old dds formats.
|
||||
const static AZ::u32 FOURCC_DXT1 = IMAGE_BUIDER_MAKEFOURCC('D', 'X', 'T', '1');
|
||||
const static AZ::u32 FOURCC_DXT2 = IMAGE_BUIDER_MAKEFOURCC('D', 'X', 'T', '2');
|
||||
const static AZ::u32 FOURCC_DXT3 = IMAGE_BUIDER_MAKEFOURCC('D', 'X', 'T', '3');
|
||||
const static AZ::u32 FOURCC_DXT4 = IMAGE_BUIDER_MAKEFOURCC('D', 'X', 'T', '4');
|
||||
const static AZ::u32 FOURCC_DXT5 = IMAGE_BUIDER_MAKEFOURCC('D', 'X', 'T', '5');
|
||||
const static AZ::u32 FOURCC_3DCP = IMAGE_BUIDER_MAKEFOURCC('A', 'T', 'I', '1');
|
||||
const static AZ::u32 FOURCC_3DC = IMAGE_BUIDER_MAKEFOURCC('A', 'T', 'I', '2');
|
||||
}
|
||||
|
||||
@@ -52,19 +52,6 @@ namespace ImageProcessingAtom
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsETCFormat(EPixelFormat fmt)
|
||||
{
|
||||
if (fmt == ePixelFormat_ETC2
|
||||
|| fmt == ePixelFormat_ETC2a
|
||||
|| fmt == ePixelFormat_ETC2a1
|
||||
|| fmt == ePixelFormat_EAC_R11
|
||||
|| fmt == ePixelFormat_EAC_RG11)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
PixelFormatInfo::PixelFormatInfo(
|
||||
uint32_t a_bitsPerPixel,
|
||||
uint32_t a_Channels,
|
||||
@@ -96,7 +83,6 @@ namespace ImageProcessingAtom
|
||||
, fourCC(a_fourCC)
|
||||
, eSampleType(a_eSampleType)
|
||||
, szName(a_szName)
|
||||
, szLegacyName(a_szName)
|
||||
, szDescription(a_szDescription)
|
||||
, bCompressed(a_bCompressed)
|
||||
, bSelectable(a_bSelectable)
|
||||
@@ -122,15 +108,6 @@ namespace ImageProcessingAtom
|
||||
CPixelFormats::CPixelFormats()
|
||||
{
|
||||
InitPixelFormats();
|
||||
|
||||
m_removedLegacyFormats["DXT1"] = ePixelFormat_BC1;
|
||||
m_removedLegacyFormats["DXT1a"] = ePixelFormat_BC1a;
|
||||
m_removedLegacyFormats["DXT3"] = ePixelFormat_BC3;
|
||||
m_removedLegacyFormats["DXT3t"] = ePixelFormat_BC3t;
|
||||
m_removedLegacyFormats["DXT5"] = ePixelFormat_BC3;
|
||||
m_removedLegacyFormats["DXT5t"] = ePixelFormat_BC3t;
|
||||
m_removedLegacyFormats["3DCp"] = ePixelFormat_BC4;
|
||||
m_removedLegacyFormats["3DC"] = ePixelFormat_BC5;
|
||||
}
|
||||
|
||||
void CPixelFormats::InitPixelFormat(EPixelFormat format, const PixelFormatInfo& formatInfo)
|
||||
@@ -176,13 +153,6 @@ namespace ImageProcessingAtom
|
||||
InitPixelFormat(ePixelFormat_ASTC_10x10, PixelFormatInfo(0, 4, true, "?", 16, 16, 10, 10, 128, false, DXGI_FORMAT_UNKNOWN, FOURCC_ASTC_10x10, ESampleType::eSampleType_Compressed, "ASTC_10x10", "ASTC 10x10 compressed texture format", true, false));
|
||||
InitPixelFormat(ePixelFormat_ASTC_12x10, PixelFormatInfo(0, 4, true, "?", 16, 16, 12, 10, 128, false, DXGI_FORMAT_UNKNOWN, FOURCC_ASTC_12x10, ESampleType::eSampleType_Compressed, "ASTC_12x10", "ASTC 12x10 compressed texture format", true, false));
|
||||
InitPixelFormat(ePixelFormat_ASTC_12x12, PixelFormatInfo(0, 4, true, "?", 16, 16, 12, 12, 128, false, DXGI_FORMAT_UNKNOWN, FOURCC_ASTC_12x12, ESampleType::eSampleType_Compressed, "ASTC_12x12", "ASTC 12x12 compressed texture format", true, false));
|
||||
InitPixelFormat(ePixelFormat_PVRTC2, PixelFormatInfo(2, 4, true, "2", 16, 16, 8, 4, 64, true, DXGI_FORMAT_UNKNOWN, FOURCC_PVRTC2, ESampleType::eSampleType_Compressed, "PVRTC2", "POWERVR 2 bpp compressed texture format", true, false));
|
||||
InitPixelFormat(ePixelFormat_PVRTC4, PixelFormatInfo(4, 4, true, "2", 8, 8, 4, 4, 64, true, DXGI_FORMAT_UNKNOWN, FOURCC_PVRTC4, ESampleType::eSampleType_Compressed, "PVRTC4", "POWERVR 4 bpp compressed texture format", true, false));
|
||||
InitPixelFormat(ePixelFormat_EAC_R11, PixelFormatInfo(4, 1, true, "4", 4, 4, 4, 4, 64, false, DXGI_FORMAT_UNKNOWN, FOURCC_EAC_R11, ESampleType::eSampleType_Compressed, "EAC_R11", "EAC 4 bpp single channel texture format", true, false));
|
||||
InitPixelFormat(ePixelFormat_EAC_RG11, PixelFormatInfo(8, 2, false, "0", 4, 4, 4, 4, 128, false, DXGI_FORMAT_UNKNOWN, FOURCC_EAC_RG11, ESampleType::eSampleType_Compressed, "EAC_RG11", "EAC 8 bpp dual channel texture format", true, false));
|
||||
InitPixelFormat(ePixelFormat_ETC2, PixelFormatInfo(4, 3, false, "0", 4, 4, 4, 4, 64, false, DXGI_FORMAT_UNKNOWN, FOURCC_ETC2, ESampleType::eSampleType_Compressed, "ETC2", "ETC2 RGB 4 bpp compressed texture format", true, false));
|
||||
InitPixelFormat(ePixelFormat_ETC2a, PixelFormatInfo(8, 4, true, "4", 4, 4, 4, 4, 128, false, DXGI_FORMAT_UNKNOWN, FOURCC_ETC2A, ESampleType::eSampleType_Compressed, "ETC2a", "ETC2 RGBA 8 bpp compressed texture format", true, false));
|
||||
InitPixelFormat(ePixelFormat_ETC2a1, PixelFormatInfo(4, 4, true, "1", 4, 4, 4, 4, 64, false, DXGI_FORMAT_UNKNOWN, FOURCC_ETC2A, ESampleType::eSampleType_Compressed, "ETC2a1", "ETC2 RGBA1 8 bpp compressed texture format", true, false));
|
||||
|
||||
// Standardized Compressed DXGI Formats (DX10+)
|
||||
// Data in these compressed formats is hardware decodable on all DX10 chips, and manageable with the DX10-API.
|
||||
@@ -216,17 +186,6 @@ namespace ImageProcessingAtom
|
||||
|
||||
InitPixelFormat(ePixelFormat_R32, PixelFormatInfo(32, 1, false, "0", 1, 1, 1, 1, 32, false, DXGI_FORMAT_FORCE_UINT, FOURCC_DX10, ESampleType::eSampleType_Uint32, "R32", "32-bit red only", false, false));
|
||||
|
||||
//Set legacy name it can be used for convertion
|
||||
m_pixelFormatInfo[ePixelFormat_R8G8B8A8].szLegacyName = "A8R8G8B8";
|
||||
m_pixelFormatInfo[ePixelFormat_R8G8B8X8].szLegacyName = "X8R8G8B8";
|
||||
m_pixelFormatInfo[ePixelFormat_R8G8].szLegacyName = "G8R8";
|
||||
m_pixelFormatInfo[ePixelFormat_R16G16B16A16].szLegacyName = "A16B16G16R16";
|
||||
m_pixelFormatInfo[ePixelFormat_R16G16].szLegacyName = "G16R16";
|
||||
m_pixelFormatInfo[ePixelFormat_R32G32B32A32F].szLegacyName = "A32B32G32R32F";
|
||||
m_pixelFormatInfo[ePixelFormat_R32G32F].szLegacyName = "G32R32F";
|
||||
m_pixelFormatInfo[ePixelFormat_R16G16B16A16F].szLegacyName = "A16B16G16R16F";
|
||||
m_pixelFormatInfo[ePixelFormat_R16G16F].szLegacyName = "G16R16F";
|
||||
|
||||
//validate all pixel formats are proper initialized
|
||||
for (int i = 0; i < ePixelFormat_Count; ++i)
|
||||
{
|
||||
@@ -249,23 +208,6 @@ namespace ImageProcessingAtom
|
||||
return ePixelFormat_Unknown;
|
||||
}
|
||||
|
||||
EPixelFormat CPixelFormats::FindPixelFormatByLegacyName(const char* name)
|
||||
{
|
||||
if (m_removedLegacyFormats.find(name) != m_removedLegacyFormats.end())
|
||||
{
|
||||
return m_removedLegacyFormats[name];
|
||||
}
|
||||
|
||||
for (int i = 0; i < ePixelFormat_Count; ++i)
|
||||
{
|
||||
if (azstricmp(m_pixelFormatInfo[i].szLegacyName, name) == 0)
|
||||
{
|
||||
return (EPixelFormat)i;
|
||||
}
|
||||
}
|
||||
return ePixelFormat_Unknown;
|
||||
}
|
||||
|
||||
const PixelFormatInfo* CPixelFormats::GetPixelFormatInfo(EPixelFormat format)
|
||||
{
|
||||
AZ_Assert((format >= 0) && (format < ePixelFormat_Count), "Unsupport pixel format: %d", format);
|
||||
|
||||
@@ -119,7 +119,6 @@ namespace ImageProcessingAtom
|
||||
bool bSquarePow2; // whether the pixel format requires image size be square and power of 2.
|
||||
DXGI_FORMAT d3d10Format; // the mapping d3d10 pixel format
|
||||
ESampleType eSampleType; // the data type used to present pixel
|
||||
const char* szLegacyName; // name used for cryEngine
|
||||
const char* szName; // name for showing in editors
|
||||
const char* szDescription; // description for showing in editors
|
||||
bool bCompressed; // if it's a compressed format
|
||||
@@ -173,10 +172,6 @@ namespace ImageProcessingAtom
|
||||
bool IsFormatSigned(EPixelFormat fmt);
|
||||
bool IsFormatFloatingPoint(EPixelFormat fmt, bool bFullPrecision);
|
||||
|
||||
//find the pixel format for name used by Cry's RC.ini
|
||||
//returns ePixelFormat_Unknown if the name was not found in registed format list
|
||||
EPixelFormat FindPixelFormatByLegacyName(const char* name);
|
||||
|
||||
//find pixel format by its name
|
||||
EPixelFormat FindPixelFormatByName(const char* name);
|
||||
|
||||
@@ -208,9 +203,6 @@ namespace ImageProcessingAtom
|
||||
|
||||
//pixel format name to pixel format enum
|
||||
AZStd::map<AZStd::string, EPixelFormat> m_pixelFormatNameMap;
|
||||
|
||||
// some formats from cryEngine were removed. using this name-pixelFormat mapping to look for new format
|
||||
AZStd::map<AZStd::string, EPixelFormat> m_removedLegacyFormats;
|
||||
};
|
||||
|
||||
template <class TInteger>
|
||||
|
||||
@@ -102,32 +102,6 @@ namespace ImageProcessingAtom
|
||||
case AZ::RHI::Format::ASTC_12x12_UNORM:
|
||||
return ePixelFormat_ASTC_12x12;
|
||||
|
||||
case AZ::RHI::Format::PVRTC2_UNORM_SRGB:
|
||||
isSRGB = true;
|
||||
case AZ::RHI::Format::PVRTC2_UNORM:
|
||||
return ePixelFormat_PVRTC2;
|
||||
case AZ::RHI::Format::PVRTC4_UNORM_SRGB:
|
||||
isSRGB = true;
|
||||
case AZ::RHI::Format::PVRTC4_UNORM:
|
||||
return ePixelFormat_PVRTC4;
|
||||
|
||||
case AZ::RHI::Format::EAC_R11_UNORM:
|
||||
return ePixelFormat_EAC_R11;
|
||||
case AZ::RHI::Format::EAC_RG11_UNORM:
|
||||
return ePixelFormat_EAC_RG11;
|
||||
case AZ::RHI::Format::ETC2_UNORM_SRGB:
|
||||
isSRGB = true;
|
||||
case AZ::RHI::Format::ETC2_UNORM:
|
||||
return ePixelFormat_ETC2;
|
||||
case AZ::RHI::Format::ETC2A_UNORM_SRGB:
|
||||
isSRGB = true;
|
||||
case AZ::RHI::Format::ETC2A_UNORM:
|
||||
return ePixelFormat_ETC2a;
|
||||
case AZ::RHI::Format::ETC2A1_UNORM_SRGB:
|
||||
isSRGB = true;
|
||||
case AZ::RHI::Format::ETC2A1_UNORM:
|
||||
return ePixelFormat_ETC2a1;
|
||||
|
||||
case AZ::RHI::Format::BC1_UNORM_SRGB:
|
||||
isSRGB = true;
|
||||
case AZ::RHI::Format::BC1_UNORM:
|
||||
@@ -225,22 +199,6 @@ namespace ImageProcessingAtom
|
||||
case ePixelFormat_ASTC_12x12:
|
||||
return isSrgb ? RHI::Format::ASTC_12x12_UNORM_SRGB : RHI::Format::ASTC_12x12_UNORM;
|
||||
|
||||
case ePixelFormat_PVRTC2:
|
||||
return isSrgb ? RHI::Format::PVRTC2_UNORM_SRGB : RHI::Format::PVRTC2_UNORM;
|
||||
case ePixelFormat_PVRTC4:
|
||||
return isSrgb ? RHI::Format::PVRTC4_UNORM_SRGB : RHI::Format::PVRTC4_UNORM;
|
||||
|
||||
case ePixelFormat_EAC_R11:
|
||||
return RHI::Format::EAC_R11_UNORM;
|
||||
case ePixelFormat_EAC_RG11:
|
||||
return RHI::Format::EAC_RG11_UNORM;
|
||||
case ePixelFormat_ETC2:
|
||||
return isSrgb ? RHI::Format::ETC2_UNORM_SRGB : RHI::Format::ETC2_UNORM;
|
||||
case ePixelFormat_ETC2a:
|
||||
return isSrgb ? RHI::Format::ETC2A_UNORM_SRGB : RHI::Format::ETC2A_UNORM;
|
||||
case ePixelFormat_ETC2a1:
|
||||
return isSrgb ? RHI::Format::ETC2A1_UNORM_SRGB : RHI::Format::ETC2A1_UNORM;
|
||||
|
||||
case ePixelFormat_BC1:
|
||||
case ePixelFormat_BC1a:
|
||||
return isSrgb ? RHI::Format::BC1_UNORM_SRGB : RHI::Format::BC1_UNORM;
|
||||
|
||||
Reference in New Issue
Block a user