DuplicateOutput doesn't convert format

Daniel Beneš 1 Reputation point
2020-11-28T22:49:21.377+00:00

Hello.
I'm trying to get Desktop Duplication to work on HDR and 10bit displays. But for some reason DuplicateOutput function doesn't convert the output to R8G8B8A8.
If I do

IDXGIOutputDuplicationPtr duplication;   
const DXGI_FORMAT DesktopFormats[] = { DXGI_FORMAT_B8G8R8A8_UNORM };   
const unsigned DesktopFormatsCounts = ARRAYSIZE(DesktopFormats);   
hr = output6->DuplicateOutput1(device, 0, DesktopFormatsCounts, DesktopFormats, &duplication);   
  
DXGI_OUTDUPL_DESC duplDesc;   
duplication->GetDesc(&duplDesc);   

And I look into the duplDesc, it say Format = R16G16B16A16_FLOAT (when I have enabled HDR in windows).
But from Remarks here it should convert the format: https://learn.microsoft.com/en-us/windows/win32/api/dxgi1_5/nf-dxgi1_5-idxgioutput5-duplicateoutput1

DXGI will pick one of the supplied formats and convert the fullscreen buffer to that format before returning from IDXGIOutputDuplication::AcquireNextFrame

Thanks

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,412 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Daniel Beneš 1 Reputation point
    2021-10-31T17:09:50.023+00:00

    Hello.
    Back to this problem after long time.
    I updated the Microsoft example of Desktop duplication: https://github.com/Benik3/Windows-classic-samples/tree/ddupl_update/Samples/DXGIDesktopDuplication
    When I switch setting of windows to HDR, m_DeskDupl->GetDesc(&duplDesc); will return format R16G16B16A16_FLOAT.
    Even that I have set up DuplicateOutput1 formats to only B8G8R8

    145167-obrazek.png

    145254-obrazek.png