question

DanielBene-4666 avatar image
0 Votes"
DanielBene-4666 asked DanielBene-4666 commented

DuplicateOutput doesn't convert format

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://docs.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
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @DanielBene-4666, the conversion happens when "the current fullscreen buffer format is not contained in the pSupportedFormats array". So what's your current fullscreen buffer format?

0 Votes 0 ·

Hello.
Well now I will look like an idiot, but where should I look? :D
I'm totally new to this, the project is this: https://github.com/psieg/Lightpack/blob/3dae6479de97a4e8adc58d170ea18c91cd769ec8/Software/grab/DDuplGrabber.cpp
I'm trying to learn something "on the way" but I must say that this is pretty hard.

EDIT:
The dxgiSwapChainDesc.BufferDesc contain dxgiModeDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;

0 Votes 0 ·

I fail to reproduce this issue because I got DXGI_ERROR_UNSUPPORTED error when calling DxgiOutput5->DuplicateOutput1(). Could you share (via GitHub) a mini, complete and reproducible sample so I can do a further investigation? Please make sure your private date removed before sharing. Thanks.

0 Votes 0 ·
Show more comments

1 Answer

DanielBene-4666 avatar image
0 Votes"
DanielBene-4666 answered

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



obrazek.png (43.8 KiB)
obrazek.png (12.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.