command-line tools updated to provide text description for HRESULTs
This commit is contained in:
Родитель
7b4b9b18f7
Коммит
d13f66af05
|
@ -396,7 +396,6 @@ namespace
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void SearchForFiles(const wchar_t* path, std::list<SConversion>& files, bool recursive)
|
||||
{
|
||||
// Process files
|
||||
|
@ -471,7 +470,6 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void PrintFormat(DXGI_FORMAT Format)
|
||||
{
|
||||
for (const SValue *pFormat = g_pFormats; pFormat->pName; pFormat++)
|
||||
|
@ -484,7 +482,6 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void PrintInfo(const TexMetadata& info)
|
||||
{
|
||||
wprintf(L" (%zux%zu", info.width, info.height);
|
||||
|
@ -544,7 +541,6 @@ namespace
|
|||
wprintf(L")");
|
||||
}
|
||||
|
||||
|
||||
void PrintList(size_t cch, const SValue *pValue)
|
||||
{
|
||||
while (pValue->pName)
|
||||
|
@ -565,7 +561,6 @@ namespace
|
|||
wprintf(L"\n");
|
||||
}
|
||||
|
||||
|
||||
void PrintLogo()
|
||||
{
|
||||
wchar_t version[32] = {};
|
||||
|
@ -602,6 +597,35 @@ namespace
|
|||
wprintf(L"\n");
|
||||
}
|
||||
|
||||
const wchar_t* GetErrorDesc(HRESULT hr)
|
||||
{
|
||||
static wchar_t desc[1024] = {};
|
||||
|
||||
LPWSTR errorText = nullptr;
|
||||
|
||||
DWORD result = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, nullptr,
|
||||
static_cast<DWORD>(hr),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast<LPWSTR>(&errorText), 0, nullptr);
|
||||
|
||||
*desc = 0;
|
||||
|
||||
if (result > 0 && errorText)
|
||||
{
|
||||
swprintf_s(desc, L": %ls", errorText);
|
||||
|
||||
size_t len = wcslen(desc);
|
||||
if (len >= 2)
|
||||
{
|
||||
desc[len - 2] = 0;
|
||||
desc[len - 1] = 0;
|
||||
}
|
||||
|
||||
if (errorText)
|
||||
LocalFree(errorText);
|
||||
}
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
void PrintUsage()
|
||||
{
|
||||
|
@ -654,7 +678,6 @@ namespace
|
|||
PrintList(13, g_pFeatureLevels);
|
||||
}
|
||||
|
||||
|
||||
HRESULT SaveImageFile(const Image& img, DWORD fileType, const wchar_t* szOutputFile)
|
||||
{
|
||||
switch (fileType)
|
||||
|
@ -678,7 +701,6 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool ParseSwizzleMask(
|
||||
_In_reads_(4) const wchar_t* mask,
|
||||
_Out_writes_(4) uint32_t* permuteElements,
|
||||
|
@ -839,7 +861,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
HRESULT hr = hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"Failed to initialize COM (%08X)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L"Failed to initialize COM (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1215,7 +1237,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadAnimatedGif(conversion.front().szSrc, loadedImages, (dwOptions & (1 << OPT_GIF_BGCOLOR)) != 0);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1276,7 +1298,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromDDSFile(pConv->szSrc, DDS_FLAGS_ALLOW_LARGE_FILES, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1303,7 +1325,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromDDSFile(pConv->szSrc, DDS_FLAGS_ALLOW_LARGE_FILES, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1326,7 +1348,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromDDSFile(pConv->szSrc, DDS_FLAGS_ALLOW_LARGE_FILES, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1346,7 +1368,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromTGAFile(pConv->szSrc, TGA_FLAGS_NONE, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1355,7 +1377,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromHDRFile(pConv->szSrc, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1365,7 +1387,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromEXRFile(pConv->szSrc, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1383,7 +1405,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromWICFile(pConv->szSrc, WIC_FLAGS_ALL_FRAMES | dwFilter, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1412,7 +1434,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = ConvertToSinglePlane(img, nimg, info, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [converttosingleplane] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [converttosingleplane] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1448,7 +1470,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = Decompress(img, nimg, info, DXGI_FORMAT_UNKNOWN /* picks good default */, *timage.get());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [decompress] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [decompress] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1482,7 +1504,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = timage->Initialize(mdata);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [copy to single level] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [copy to single level] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1494,7 +1516,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
*timage->GetImage(0, 0, d), TEX_FILTER_DEFAULT, 0, 0);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [copy to single level] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [copy to single level] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1507,7 +1529,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
*timage->GetImage(0, i, 0), TEX_FILTER_DEFAULT, 0, 0);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [copy to single level] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [copy to single level] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1546,7 +1568,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = PremultiplyAlpha(img, nimg, info, TEX_PMALPHA_REVERSE | dwSRGB, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [demultiply alpha] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [demultiply alpha] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1586,7 +1608,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = Resize(image->GetImages(), image->GetImageCount(), image->GetMetadata(), width, height, dwFilter | dwFilterOpts, *timage.get());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [resize] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [resize] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1636,7 +1658,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
});
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [tonemap maxlum] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [tonemap maxlum] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1665,7 +1687,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
}, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [tonemap apply] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [tonemap apply] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1703,7 +1725,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
dwFilter | dwFilterOpts | dwSRGB, TEX_THRESHOLD_DEFAULT, *timage.get());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [convert] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [convert] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1810,7 +1832,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = result.Initialize2D(format, twidth, theight, 1, 1);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"FAILED setting up result image (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L"FAILED setting up result image (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1881,7 +1903,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = CopyRectangle(*img, rect, *dest, dwFilter | dwFilterOpts, offsetx, offsety);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"FAILED building result image (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L"FAILED building result image (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1909,7 +1931,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = SaveImageFile(*dest, fileType, szOutputFile);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
@ -1923,7 +1945,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
dwFilter | dwFilterOpts | dwSRGB, TEX_THRESHOLD_DEFAULT, tempImage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [convert second input] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [convert second input] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1950,7 +1972,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
}, result);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [merge image] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [merge image] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1977,7 +1999,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = SaveImageFile(*result.GetImage(0, 0, 0), fileType, szOutputFile);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
@ -1992,7 +2014,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = result.Initialize2D(format, twidth, theight, 1, 1);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"FAILED setting up result image (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L"FAILED setting up result image (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2020,7 +2042,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = CopyRectangle(*img, rect, *dest, dwFilter | dwFilterOpts, offsetx, offsety);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"FAILED building result image (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L"FAILED building result image (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -2048,7 +2070,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = SaveImageFile(*dest, fileType, szOutputFile);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
@ -2131,7 +2153,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"FAILED building result image (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L"FAILED building result image (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2160,7 +2182,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
szOutputFile);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"\nFAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L"\nFAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -890,6 +890,36 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
const wchar_t* GetErrorDesc(HRESULT hr)
|
||||
{
|
||||
static wchar_t desc[1024] = {};
|
||||
|
||||
LPWSTR errorText = nullptr;
|
||||
|
||||
DWORD result = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, nullptr,
|
||||
static_cast<DWORD>(hr),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast<LPWSTR>(&errorText), 0, nullptr);
|
||||
|
||||
*desc = 0;
|
||||
|
||||
if (result > 0 && errorText)
|
||||
{
|
||||
swprintf_s(desc, L": %ls", errorText);
|
||||
|
||||
size_t len = wcslen(desc);
|
||||
if (len >= 2)
|
||||
{
|
||||
desc[len - 2] = 0;
|
||||
desc[len - 1] = 0;
|
||||
}
|
||||
|
||||
if (errorText)
|
||||
LocalFree(errorText);
|
||||
}
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
_Success_(return != false)
|
||||
bool CreateDevice(int adapter, _Outptr_ ID3D11Device** pDevice)
|
||||
{
|
||||
|
@ -1221,7 +1251,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"Failed to initialize COM (%08X)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L"Failed to initialize COM (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1876,7 +1906,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromDDSFile(pConv->szSrc, ddsFlags, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -1907,7 +1937,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromBMPEx(pConv->szSrc, WIC_FLAGS_NONE | dwFilter, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -1917,7 +1947,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromTGAFile(pConv->szSrc, TGA_FLAGS_NONE, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -1927,7 +1957,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromHDRFile(pConv->szSrc, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -1937,7 +1967,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromPortablePixMap(pConv->szSrc, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -1947,7 +1977,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromPortablePixMapHDR(pConv->szSrc, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -1958,7 +1988,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromEXRFile(pConv->szSrc, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -1981,7 +2011,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadFromWICFile(pConv->szSrc, wicFlags, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -2012,7 +2042,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = ConvertToSinglePlane(img, nimg, info, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [converttosingleplane] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [converttosingleplane] (%08X%ls)\n",
|
||||
static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -2064,7 +2095,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = timage->Initialize(mdata);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [BC non-multiple-of-4 fixup] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [BC non-multiple-of-4 fixup] (%08X%ls)\n",
|
||||
static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2114,7 +2146,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = Decompress(img, nimg, info, DXGI_FORMAT_UNKNOWN /* picks good default */, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [decompress] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [decompress] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -2172,7 +2204,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = PremultiplyAlpha(img, nimg, info, TEX_PMALPHA_REVERSE | dwSRGB, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [demultiply alpha] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [demultiply alpha] (%08X%ls)\n",
|
||||
static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -2216,7 +2249,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = FlipRotate(image->GetImages(), image->GetImageCount(), image->GetMetadata(), dwFlags, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [fliprotate] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [fliprotate] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2272,7 +2305,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = Resize(image->GetImages(), image->GetImageCount(), image->GetMetadata(), twidth, theight, dwFilter | dwFilterOpts, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [resize] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [resize] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2323,7 +2356,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
}, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [swizzle] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [swizzle] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2360,7 +2393,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
dwFilter | dwFilterOpts | dwSRGB | dwConvert, alphaThreshold, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [convert] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [convert] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2592,7 +2625,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
}
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [rotate color apply] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [rotate color apply] (%08X%ls)\n",
|
||||
static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2643,7 +2677,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
});
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [tonemap maxlum] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [tonemap maxlum] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2672,7 +2706,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
}, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [tonemap apply] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [tonemap apply] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2727,7 +2761,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = ComputeNormalMap(image->GetImages(), image->GetImageCount(), image->GetMetadata(), dwNormalMap, nmapAmplitude, nmfmt, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [normalmap] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [normalmap] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2760,7 +2794,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
dwFilter | dwFilterOpts | dwSRGB | dwConvert, alphaThreshold, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [convert] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [convert] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2819,7 +2853,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
}, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [colorkey] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [colorkey] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2868,7 +2902,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
}, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [inverty] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [inverty] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2929,7 +2963,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
}, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [reconstructz] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [reconstructz] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2989,7 +3023,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = timage->Initialize(mdata);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [copy to single level] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [copy to single level] (%08X%ls)\n",
|
||||
static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3001,7 +3036,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
*timage->GetImage(0, 0, d), TEX_FILTER_DEFAULT, 0, 0);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [copy to single level] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [copy to single level] (%08X%ls)\n",
|
||||
static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -3014,7 +3050,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
*timage->GetImage(0, i, 0), TEX_FILTER_DEFAULT, 0, 0);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [copy to single level] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [copy to single level] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -3031,7 +3067,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = timage->Initialize(mdata);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [copy compressed to single level] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [copy compressed to single level] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3083,7 +3119,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
}
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [mipmaps] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [mipmaps] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3115,7 +3151,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = timage->Initialize(image->GetMetadata());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [keepcoverage] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [keepcoverage] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3128,7 +3164,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = ScaleMipMapsAlphaForCoverage(img, info.mipLevels, info, item, preserveAlphaCoverageRef, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [keepcoverage] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [keepcoverage] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -3174,7 +3210,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = PremultiplyAlpha(img, nimg, info, TEX_PMALPHA_DEFAULT | dwSRGB, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [premultiply alpha] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [premultiply alpha] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -3292,7 +3328,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
}
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [compress] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [compress] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -3364,7 +3400,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
wchar_t szPath[MAX_PATH] = {};
|
||||
if (!GetFullPathNameW(szDest, MAX_PATH, szPath, nullptr))
|
||||
{
|
||||
wprintf(L" get full path FAILED (%x)\n", static_cast<unsigned int>(HRESULT_FROM_WIN32(GetLastError())));
|
||||
wprintf(L" get full path FAILED (%08X%ls)\n",
|
||||
static_cast<unsigned int>(HRESULT_FROM_WIN32(GetLastError())), GetErrorDesc(HRESULT_FROM_WIN32(GetLastError())));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -3372,7 +3409,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
auto err = static_cast<DWORD>(SHCreateDirectoryExW(nullptr, szPath, nullptr));
|
||||
if (err != ERROR_SUCCESS && err != ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
wprintf(L" directory creation FAILED (%x)\n", static_cast<unsigned int>(HRESULT_FROM_WIN32(err)));
|
||||
wprintf(L" directory creation FAILED (%08X%ls)\n",
|
||||
static_cast<unsigned int>(HRESULT_FROM_WIN32(err)), GetErrorDesc(HRESULT_FROM_WIN32(err)));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -3534,7 +3572,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -388,7 +388,6 @@ namespace
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const wchar_t* LookupByValue(DWORD pValue, const SValue *pArray)
|
||||
{
|
||||
while (pArray->pName)
|
||||
|
@ -402,7 +401,6 @@ namespace
|
|||
return L"";
|
||||
}
|
||||
|
||||
|
||||
void SearchForFiles(const wchar_t* path, std::list<SConversion>& files, bool recursive)
|
||||
{
|
||||
// Process files
|
||||
|
@ -477,7 +475,6 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void PrintFormat(DXGI_FORMAT Format)
|
||||
{
|
||||
for (const SValue *pFormat = g_pFormats; pFormat->pName; pFormat++)
|
||||
|
@ -501,7 +498,6 @@ namespace
|
|||
wprintf(L"*UNKNOWN*");
|
||||
}
|
||||
|
||||
|
||||
void PrintList(size_t cch, const SValue *pValue)
|
||||
{
|
||||
while (pValue->pName)
|
||||
|
@ -522,7 +518,6 @@ namespace
|
|||
wprintf(L"\n");
|
||||
}
|
||||
|
||||
|
||||
void PrintLogo()
|
||||
{
|
||||
wchar_t version[32] = {};
|
||||
|
@ -559,7 +554,6 @@ namespace
|
|||
wprintf(L"\n");
|
||||
}
|
||||
|
||||
|
||||
void PrintUsage()
|
||||
{
|
||||
PrintLogo();
|
||||
|
@ -603,6 +597,36 @@ namespace
|
|||
PrintList(15, g_pDumpFileTypes);
|
||||
}
|
||||
|
||||
const wchar_t* GetErrorDesc(HRESULT hr)
|
||||
{
|
||||
static wchar_t desc[1024] = {};
|
||||
|
||||
LPWSTR errorText = nullptr;
|
||||
|
||||
DWORD result = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, nullptr,
|
||||
static_cast<DWORD>(hr),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast<LPWSTR>(&errorText), 0, nullptr);
|
||||
|
||||
*desc = 0;
|
||||
|
||||
if (result > 0 && errorText)
|
||||
{
|
||||
swprintf_s(desc, L": %ls", errorText);
|
||||
|
||||
size_t len = wcslen(desc);
|
||||
if (len >= 2)
|
||||
{
|
||||
desc[len - 2] = 0;
|
||||
desc[len - 1] = 0;
|
||||
}
|
||||
|
||||
if (errorText)
|
||||
LocalFree(errorText);
|
||||
}
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
HRESULT LoadImage(
|
||||
const wchar_t *fileName,
|
||||
DWORD dwOptions,
|
||||
|
@ -826,7 +850,6 @@ namespace
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
struct AnalyzeBCData
|
||||
{
|
||||
|
@ -1266,7 +1289,6 @@ namespace
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
HRESULT Difference(
|
||||
const Image& image1,
|
||||
|
@ -1345,7 +1367,6 @@ namespace
|
|||
return Convert(diffImage.GetImages(), diffImage.GetImageCount(), diffImage.GetMetadata(), format, dwFilter, TEX_THRESHOLD_DEFAULT, result);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Partition, Shape, Fixup
|
||||
const uint8_t g_aFixUp[3][64][3] =
|
||||
|
@ -3087,7 +3108,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
HRESULT hr = hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"Failed to initialize COM (%08X)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L"Failed to initialize COM (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3358,7 +3379,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadImage(pImage1->szSrc, dwOptions, dwFilter, info1, image1);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3373,7 +3394,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadImage(pImage2->szSrc, dwOptions, dwFilter, info2, image2);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3410,7 +3431,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = Difference(*image1->GetImage(0, 0, 0), *image2->GetImage(0, 0, 0), dwFilter, diffFormat, diffImage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"Failed diffing images (%08X)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L"Failed diffing images (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3431,7 +3452,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = SaveImage(diffImage.GetImage(0, 0, 0), szOutputFile, fileType);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3453,7 +3474,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = ComputeMSE(*image1->GetImage(0, 0, 0), *image2->GetImage(0, 0, 0), mse, mseV);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"Failed comparing images (%08X)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L"Failed comparing images (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3500,7 +3521,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = ComputeMSE(*img1, *img2, mse, mseV);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"Failed comparing images at slice %3zu, mip %3zu (%08X)\n", slice, mip, static_cast<unsigned int>(hr));
|
||||
wprintf(L"Failed comparing images at slice %3zu, mip %3zu (%08X%ls)\n", slice, mip, static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3551,7 +3572,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = ComputeMSE(*img1, *img2, mse, mseV);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"Failed comparing images at item %3zu, mip %3zu (%08X)\n", item, mip, static_cast<unsigned int>(hr));
|
||||
wprintf(L"Failed comparing images at item %3zu, mip %3zu (%08X%ls)\n", item, mip, static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3611,7 +3632,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = LoadImage(pConv->szSrc, dwOptions, dwFilter, info, image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3725,7 +3746,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = SaveImage(img, szOutputFile, fileType);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -3768,7 +3789,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = SaveImage(img, szOutputFile, fileType);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -3821,7 +3842,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = DumpBCImage(*img, pixelx, pixely);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"ERROR: Failed dumping image at slice %3zu, mip %3zu (%08X)\n", slice, mip, static_cast<unsigned int>(hr));
|
||||
wprintf(L"ERROR: Failed dumping image at slice %3zu, mip %3zu (%08X%ls)\n", slice, mip, static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -3864,7 +3885,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = DumpBCImage(*img, tpixelx, tpixely);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"ERROR: Failed dumping image at item %3zu, mip %3zu (%08X)\n", item, mip, static_cast<unsigned int>(hr));
|
||||
wprintf(L"ERROR: Failed dumping image at item %3zu, mip %3zu (%08X%ls)\n", item, mip, static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -3897,7 +3918,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = ConvertToSinglePlane(img, nimg, info, *timage);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED [converttosingleplane] (%x)\n", static_cast<unsigned int>(hr));
|
||||
wprintf(L" FAILED [converttosingleplane] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3938,7 +3959,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = Analyze(*img, data);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"ERROR: Failed analyzing image at slice %3zu, mip %3zu (%08X)\n", slice, mip, static_cast<unsigned int>(hr));
|
||||
wprintf(L"ERROR: Failed analyzing image at slice %3zu, mip %3zu (%08X%ls)\n", slice, mip, static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3952,7 +3973,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = AnalyzeBC(*img, data);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"ERROR: Failed analyzing BC image at slice %3zu, mip %3zu (%08X)\n", slice, mip, static_cast<unsigned int>(hr));
|
||||
wprintf(L"ERROR: Failed analyzing BC image at slice %3zu, mip %3zu (%08X%ls)\n", slice, mip, static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3986,7 +4007,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = Analyze(*img, data);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"ERROR: Failed analyzing image at item %3zu, mip %3zu (%08X)\n", item, mip, static_cast<unsigned int>(hr));
|
||||
wprintf(L"ERROR: Failed analyzing image at item %3zu, mip %3zu (%08X%ls)\n", item, mip, static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -4003,7 +4024,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
|||
hr = AnalyzeBC(*img, data);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L"ERROR: Failed analyzing BC image at item %3zu, mip %3zu (%08X)\n", item, mip, static_cast<unsigned int>(hr));
|
||||
wprintf(L"ERROR: Failed analyzing BC image at item %3zu, mip %3zu (%08X%ls)\n", item, mip, static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче