mirror of
https://github.com/microsoft/DirectXTex.git
synced 2026-02-04 04:16:12 +01:00
texconv: updated with -dx9 switch; converted -bcuniform, -bcdither, -bcmax, -bcquick to -bc ??
This commit is contained in:
@@ -76,6 +76,7 @@ enum OPTIONS
|
||||
OPT_DDS_DWORD_ALIGN,
|
||||
OPT_DDS_BAD_DXTN_TAILS,
|
||||
OPT_USE_DX10,
|
||||
OPT_USE_DX9,
|
||||
OPT_TGA20,
|
||||
OPT_WIC_QUALITY,
|
||||
OPT_WIC_LOSSLESS,
|
||||
@@ -100,10 +101,7 @@ enum OPTIONS
|
||||
OPT_ALPHA_WEIGHT,
|
||||
OPT_NORMAL_MAP,
|
||||
OPT_NORMAL_MAP_AMPLITUDE,
|
||||
OPT_COMPRESS_UNIFORM,
|
||||
OPT_COMPRESS_MAX,
|
||||
OPT_COMPRESS_QUICK,
|
||||
OPT_COMPRESS_DITHER,
|
||||
OPT_BC_COMPRESS,
|
||||
OPT_COLORKEY,
|
||||
OPT_TONEMAP,
|
||||
OPT_X2_BIAS,
|
||||
@@ -166,6 +164,7 @@ const SValue g_pOptions[] =
|
||||
{ L"dword", OPT_DDS_DWORD_ALIGN },
|
||||
{ L"badtails", OPT_DDS_BAD_DXTN_TAILS },
|
||||
{ L"dx10", OPT_USE_DX10 },
|
||||
{ L"dx9", OPT_USE_DX9 },
|
||||
{ L"tga20", OPT_TGA20 },
|
||||
{ L"wicq", OPT_WIC_QUALITY },
|
||||
{ L"wiclossless", OPT_WIC_LOSSLESS },
|
||||
@@ -191,10 +190,7 @@ const SValue g_pOptions[] =
|
||||
{ L"aw", OPT_ALPHA_WEIGHT },
|
||||
{ L"nmap", OPT_NORMAL_MAP },
|
||||
{ L"nmapamp", OPT_NORMAL_MAP_AMPLITUDE },
|
||||
{ L"bcuniform", OPT_COMPRESS_UNIFORM },
|
||||
{ L"bcmax", OPT_COMPRESS_MAX },
|
||||
{ L"bcquick", OPT_COMPRESS_QUICK },
|
||||
{ L"bcdither", OPT_COMPRESS_DITHER },
|
||||
{ L"bc", OPT_BC_COMPRESS },
|
||||
{ L"c", OPT_COLORKEY },
|
||||
{ L"tonemap", OPT_TONEMAP },
|
||||
{ L"x2bias", OPT_X2_BIAS },
|
||||
@@ -752,6 +748,7 @@ namespace
|
||||
wprintf(L" -xlum expand legacy L8, L16, and A8P8 formats\n");
|
||||
wprintf(L"\n (DDS output only)\n");
|
||||
wprintf(L" -dx10 Force use of 'DX10' extended header\n");
|
||||
wprintf(L" -dx9 Force use of legacy DX9 header\n");
|
||||
wprintf(L"\n (TGA output only)\n");
|
||||
wprintf(L" -tga20 Write file including TGA 2.0 extension area\n");
|
||||
wprintf(L"\n (BMP, PNG, JPG, TIF, WDP output only)\n");
|
||||
@@ -765,10 +762,10 @@ namespace
|
||||
#endif
|
||||
wprintf(L" -gpu <adapter> Select GPU for DirectCompute-based codecs (0 is default)\n");
|
||||
wprintf(L" -nogpu Do not use DirectCompute-based codecs\n");
|
||||
wprintf(L" -bcuniform Use uniform rather than perceptual weighting for BC1-3\n");
|
||||
wprintf(L" -bcdither Use dithering for BC1-3\n");
|
||||
wprintf(L" -bcmax Use exhaustive compression (BC7 only)\n");
|
||||
wprintf(L" -bcquick Use quick compression (BC7 only)\n");
|
||||
wprintf(
|
||||
L"\n -bc <options> Sets options for BC compression\n"
|
||||
L" options must be one or more of\n"
|
||||
L" d, u, q, x\n");
|
||||
wprintf(
|
||||
L" -aw <weight> BC7 GPU compressor weighting for alpha error metric\n"
|
||||
L" (defaults to 1.0)\n");
|
||||
@@ -1201,6 +1198,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
case OPT_NORMAL_MAP:
|
||||
case OPT_NORMAL_MAP_AMPLITUDE:
|
||||
case OPT_WIC_QUALITY:
|
||||
case OPT_BC_COMPRESS:
|
||||
case OPT_COLORKEY:
|
||||
case OPT_FILELIST:
|
||||
case OPT_ROTATE_COLOR:
|
||||
@@ -1508,33 +1506,50 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
}
|
||||
break;
|
||||
|
||||
case OPT_COMPRESS_UNIFORM:
|
||||
dwCompress |= TEX_COMPRESS_UNIFORM;
|
||||
break;
|
||||
case OPT_BC_COMPRESS:
|
||||
{
|
||||
dwCompress = TEX_COMPRESS_DEFAULT;
|
||||
|
||||
case OPT_COMPRESS_MAX:
|
||||
if (dwCompress & TEX_COMPRESS_BC7_QUICK)
|
||||
bool found = false;
|
||||
if (wcschr(pValue, L'u'))
|
||||
{
|
||||
wprintf(L"Can't use -bcmax and -bcquick at same time\n\n");
|
||||
dwCompress |= TEX_COMPRESS_UNIFORM;
|
||||
found = true;
|
||||
}
|
||||
|
||||
if (wcschr(pValue, L'd'))
|
||||
{
|
||||
dwCompress |= TEX_COMPRESS_DITHER;
|
||||
found = true;
|
||||
}
|
||||
|
||||
if (wcschr(pValue, L'q'))
|
||||
{
|
||||
dwCompress |= TEX_COMPRESS_BC7_QUICK;
|
||||
found = true;
|
||||
}
|
||||
|
||||
if (wcschr(pValue, L'x'))
|
||||
{
|
||||
dwCompress |= TEX_COMPRESS_BC7_USE_3SUBSETS;
|
||||
found = true;
|
||||
}
|
||||
|
||||
if ((dwCompress & (TEX_COMPRESS_BC7_QUICK | TEX_COMPRESS_BC7_USE_3SUBSETS)) == (TEX_COMPRESS_BC7_QUICK | TEX_COMPRESS_BC7_USE_3SUBSETS))
|
||||
{
|
||||
wprintf(L"Can't use -bc x (max) and -bc q (quick) at same time\n\n");
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
dwCompress |= TEX_COMPRESS_BC7_USE_3SUBSETS;
|
||||
break;
|
||||
|
||||
case OPT_COMPRESS_QUICK:
|
||||
if (dwCompress & TEX_COMPRESS_BC7_USE_3SUBSETS)
|
||||
if (!found)
|
||||
{
|
||||
wprintf(L"Can't use -bcmax and -bcquick at same time\n\n");
|
||||
wprintf(L"Invalid value specified for -bc (%ls), missing d, u, q, or x\n\n", pValue);
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
dwCompress |= TEX_COMPRESS_BC7_QUICK;
|
||||
break;
|
||||
|
||||
case OPT_COMPRESS_DITHER:
|
||||
dwCompress |= TEX_COMPRESS_DITHER;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case OPT_WIC_QUALITY:
|
||||
if (swscanf_s(pValue, L"%f", &wicQuality) != 1
|
||||
@@ -1563,6 +1578,24 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
dwConvert |= TEX_FILTER_FLOAT_X2BIAS;
|
||||
break;
|
||||
|
||||
case OPT_USE_DX10:
|
||||
if (dwOptions & (DWORD64(1) << OPT_USE_DX9))
|
||||
{
|
||||
wprintf(L"Can't use -dx9 and -dx10 at same time\n\n");
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case OPT_USE_DX9:
|
||||
if (dwOptions & (DWORD64(1) << OPT_USE_DX10))
|
||||
{
|
||||
wprintf(L"Can't use -dx9 and -dx10 at same time\n\n");
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case OPT_FILELIST:
|
||||
{
|
||||
std::wifstream inFile(pValue);
|
||||
@@ -3090,10 +3123,20 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
switch (FileType)
|
||||
{
|
||||
case CODEC_DDS:
|
||||
hr = SaveToDDSFile(img, nimg, info,
|
||||
(dwOptions & (DWORD64(1) << OPT_USE_DX10)) ? (DDS_FLAGS_FORCE_DX10_EXT | DDS_FLAGS_FORCE_DX10_EXT_MISC2) : DDS_FLAGS_NONE,
|
||||
pConv->szDest);
|
||||
{
|
||||
DWORD ddsFlags = DDS_FLAGS_NONE;
|
||||
if (dwOptions & (DWORD64(1) << OPT_USE_DX10))
|
||||
{
|
||||
ddsFlags |= DDS_FLAGS_FORCE_DX10_EXT | DDS_FLAGS_FORCE_DX10_EXT_MISC2;
|
||||
}
|
||||
else if (dwOptions & (DWORD64(1) << OPT_USE_DX9))
|
||||
{
|
||||
ddsFlags |= DDS_FLAGS_FORCE_DX9_LEGACY;
|
||||
}
|
||||
|
||||
hr = SaveToDDSFile(img, nimg, info, ddsFlags, pConv->szDest);
|
||||
break;
|
||||
}
|
||||
|
||||
case CODEC_TGA:
|
||||
hr = SaveToTGAFile(img[0], pConv->szDest, (dwOptions & (DWORD64(1) << OPT_TGA20)) ? &info : nullptr);
|
||||
|
||||
Reference in New Issue
Block a user