HyperionScreenCap icon indicating copy to clipboard operation
HyperionScreenCap copied to clipboard

Add HDR support to DX11 Capture

Open ktaeleman opened this issue 2 years ago • 4 comments

Add R16G16B16A16_Float support to the DX11Capture, allowing capturing of Windows HDR desktops (and games). This change switches the use of DuplicateOutput to DuplicateOutput1, which enables capturing of non B8G8R8A8 buffer formats.

This also fixes the washed out and incorrect colors that were being passed to Hyperion when using a HDR format. A good example of this is Orange, which always resulted in Yellow.

Notes:

  • To make DuplicateOuput1 work, the correct dpi awareness context needs to be set, else DXGI will fail with NOT_SUPPORTED.
  • There is some strangeness I could not figure out where the 16bit floats in the captured buffer range from 0.0f to 4.6f, instead of 0 to 1. This is corrected by an arbitrary sqrt(x/4.6) formula, which ends up giving good results.

Screenshot of preview in Hyperion: image

ktaeleman avatar Jan 13 '23 00:01 ktaeleman

woa nice! i have since switched to piccap (LG TV webOS capture) but will check this out! thank you

pho084 avatar Jan 13 '23 20:01 pho084

I got the issue "Texture format R10G10B10A2_UNorm is not supported" when using Radeon rx 570 graphic card with your commit (nvidia and intel are ok with yours). Please fix it!

tihoangyeudau avatar Mar 05 '23 15:03 tihoangyeudau

@ktaeleman Is it necessary to add something like this?

// Duplicate the output
            Format[] DesktopFormats = { Format.R16G16B16A16_Float, Format.B8G8R8A8_UNorm, Format.R10G10B10A2_UNorm };

tihoangyeudau avatar Mar 07 '23 21:03 tihoangyeudau

just wanted to say that this is working great so far with the HD108 strip. thank you.

r3vEngIT avatar Mar 24 '23 18:03 r3vEngIT