From 8891860a6029c783df6e2a75fba9482b1698ebca Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Sun, 25 Sep 2016 16:34:00 -0700 Subject: [PATCH] texdiag: implement -tu and tf flags --- Texdiag/texdiag.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Texdiag/texdiag.cpp b/Texdiag/texdiag.cpp index 5861313..1b4e916 100644 --- a/Texdiag/texdiag.cpp +++ b/Texdiag/texdiag.cpp @@ -437,7 +437,28 @@ namespace if (dwOptions & (1 << OPT_DDS_BAD_DXTN_TAILS)) ddsFlags |= DDS_FLAGS_BAD_DXTN_TAILS; - return LoadFromDDSFile(fileName, ddsFlags, &info, *image.get()); + HRESULT hr = LoadFromDDSFile(fileName, ddsFlags, &info, *image.get()); + if (FAILED(hr)) + return hr; + + if (IsTypeless(info.format)) + { + if (dwOptions & (1 << OPT_TYPELESS_UNORM)) + { + info.format = MakeTypelessUNORM(info.format); + } + else if (dwOptions & (1 << OPT_TYPELESS_FLOAT)) + { + info.format = MakeTypelessFLOAT(info.format); + } + + if (IsTypeless(info.format)) + return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + + image->OverrideFormat(info.format); + } + + return S_OK; } else if (_wcsicmp(ext, L".tga") == 0) {