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.51k stars 404 forks source link

ScreenGrab DDS needs support for planar formats #271

Open walbourn opened 2 weeks ago

walbourn commented 2 weeks ago

Currently ScreenGrab only works on formats with a plane count of 1. This means you can't currently capture the following:

DXGI_FORMAT_NV12:      // 4:2:0 8-bit
DXGI_FORMAT_P010:      // 4:2:0 10-bit
DXGI_FORMAT_P016:      // 4:2:0 16-bit
DXGI_FORMAT_420_OPAQUE:// 4:2:0 8-bit
DXGI_FORMAT_NV11:      // 4:1:1 8-bit
walbourn commented 2 weeks ago

Also, on DX12 the depth formats are treated as planar, but in DX11 the DDS files were interleaved.

https://github.com/microsoft/DirectXTex/issues/46

This lack of support for planar formats means all depth formats with stencil also fail:

case DXGI_FORMAT_R32G8X24_TYPELESS:
case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
case DXGI_FORMAT_R24G8_TYPELESS:
case DXGI_FORMAT_D24_UNORM_S8_UINT:
case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
case XBOX_DXGI_FORMAT_D16_UNORM_S8_UINT:
case XBOX_DXGI_FORMAT_R16_UNORM_X8_TYPELESS:
case XBOX_DXGI_FORMAT_X16_TYPELESS_G8_UINT: