2 years ago

#25687

test-img

MoltenCore

Errors while trying to capture HDR content with DXGI OutputDuplication

I'm facing a strange error while trying to Duplicate Output on an HDR screen, particularly this is triggered when launching Doom Eternal.

I handle DXGI_ERROR_ACCESS_LOST error by resetting the OutputDuplication object, like so:

_session.Reset();
winrt::check_hresult(_item->DuplicateOutput1(_device.get(), // dxgi device
    0, // reserved, must be zero
    std::size(duplicationFormats),  // number of supported formats
    duplicationFormats,             // pointer to array of supported formats
    _session.GetAddressOf()));

_session is defined at class level, it's a WRL::ComPtr, duplicationFormats is an array with DXGI_FORMAT_R16G16B16A16_FLOAT and DXGI_FORMAT_B8G8R8A8_UNORM (that, according to docs should always be present).

With this setup, I can switch HDR modes at will on the display settings and desktop is always captured. However, when opening the game I got an E_INVALIDARG error, I activated DirectX debug Layer, and this message is printed when that happens (triggered by above check_hresult):

D3D11 ERROR: ID3D11Device::CreateTexture2D: Invalid format. The Format(0, UNKNOWN) is not supported as a D3D11_RESOURCE_MISC_SHARED_NTHANDLE format. [ STATE_CREATION ERROR #92: CREATETEXTURE2D_UNSUPPORTEDFORMAT]
D3D11 ERROR: ID3D11Device::CreateTexture2D: Returning E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION ERROR #104: CREATETEXTURE2D_INVALIDARG_RETURN]

I think it is rejecting the supported formats, even though I'm using a >10bpp format for HDR content, what surprises me is the mention of a (0, UNKNOWN) format, the texture is being created internally by DXGI implementation, as far as MS PDB can tell.

directx

directx-11

dxgi

desktop-duplication

0 Answers

Your Answer

Accepted video resources