I created a Texture Cube with NVidia's Texture Exporter Tool but I cannot load it with IWICDdsDecoder
.
It fails with 0x88982f61 : The image header is unrecognized.
.
On the other hand, normal 2D textures (Dimension = WICDdsTexture2D
) created with NVTET load correctly and work well.
Does IWICDdsLoader
support Cube Maps and if not, why is the WICDdsDimension.WICDdsTextureCube
specified?
Partial loader code that works for normal WICDdsTexture2D
textures written by the NVTET.
HRESULT lResult;
WICStream lStream;
lResult = gFactory->CreateStream(&lStream);
if (FAILED(lResult)) return lResult;
lResult = lStream->InitializeFromFilename(aPath, GENERIC_READ);
if (FAILED(lResult)) return lResult;
WICBitmapDecoder lBitmapDecoder;
lResult = gFactory->CreateDecoder(GUID_ContainerFormatDds, nullptr, &lBitmapDecoder);
if (FAILED(lResult)) return lResult;
lResult = lBitmapDecoder->Initialize(lStream, WICDecodeMetadataCacheOnDemand);
if (FAILED(lResult)) return lResult; // <-- it fails here!
// 0x88982f61 : The image header is unrecognized.
WICDdsDecoder lDecoder(lBitmapDecoder);
if (!lDecoder) return E_NOINTERFACE;
WICDdsParameters lParameters{};
lResult = lDecoder->GetParameters(&lParameters);
if (FAILED(lResult)) return lResult;
if (lParameters.Dimension != WICDdsTextureCube) return E_FAIL;
// etc.