1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-24 13:20:13 +00:00

texconv: Added tgazeroalpha switch for some legacy TGA files (#360)

This commit is contained in:
Chuck Walbourn 2023-06-09 09:52:45 -07:00 committed by GitHub
parent 7a9a9e9e8f
commit 603efced7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,6 +97,7 @@ namespace
OPT_USE_DX10,
OPT_USE_DX9,
OPT_TGA20,
OPT_TGAZEROALPHA,
OPT_WIC_QUALITY,
OPT_WIC_LOSSLESS,
OPT_WIC_MULTIFRAME,
@ -186,6 +187,7 @@ namespace
{ L"dx10", OPT_USE_DX10 },
{ L"dx9", OPT_USE_DX9 },
{ L"tga20", OPT_TGA20 },
{ L"tgazeroalpha", OPT_TGAZEROALPHA },
{ L"wicq", OPT_WIC_QUALITY },
{ L"wiclossless", OPT_WIC_LOSSLESS },
{ L"wicmulti", OPT_WIC_MULTIFRAME },
@ -951,6 +953,9 @@ namespace
L" -dx10 Force use of 'DX10' extended header\n"
L" -dx9 Force use of legacy DX9 header\n"
L"\n"
L" (TGA input only)\n"
L" -tgazeroalpha Allow all zero alpha channel files to be loaded 'as is'\n"
L"\n"
L" (TGA output only)\n"
L" -tga20 Write file including TGA 2.0 extension area\n"
L"\n"
@ -2132,6 +2137,10 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
else if (_wcsicmp(ext, L".tga") == 0)
{
TGA_FLAGS tgaFlags = (IsBGR(format)) ? TGA_FLAGS_BGR : TGA_FLAGS_NONE;
if (dwOptions & (uint64_t(1) << OPT_TGAZEROALPHA))
{
tgaFlags |= TGA_FLAGS_ALLOW_ALL_ZERO_ALPHA;
}
hr = LoadFromTGAFile(pConv->szSrc, tgaFlags, &info, *image);
if (FAILED(hr))