microsoft / DirectXTK12

The DirectX Tool Kit (aka DirectXTK12) is a collection of helper classes for writing DirectX 12 code in C++
https://walbourn.github.io/directx-tool-kit-for-directx-12/
MIT License
1.5k stars 404 forks source link

Fails to load planar DDS format textures #9

Closed walbourn closed 7 years ago

walbourn commented 8 years ago

In DirectX 12, each plane of a planar format is it's own subsurface--in DX 11 all the planes were in the same subsurface. This means the current implementation of DDSTexutreLoader fails for:

walbourn commented 8 years ago

It would also fail for the JPEG Hardware decode formats added in DXGI 1.4

walbourn commented 7 years ago

Subresource indexing changed for planar types:

inline UINT D3D11CalcSubresource( UINT MipSlice, UINT ArraySlice, UINT MipLevels )
{
    return MipSlice + (ArraySlice * MipLevels); 
}

is now:

inline UINT D3D12CalcSubresource( UINT MipSlice, UINT ArraySlice, UINT PlaneSlice, UINT MipLevels, UINT ArraySize )
{ 
    return MipSlice + (ArraySlice * MipLevels) + (PlaneSlice * MipLevels * ArraySize); 
}
walbourn commented 7 years ago

Updated to support load of planar formats