1 year ago
#281600
Milika
AMD OpenGL and HDR display problem on Windows
I have been using OpenGL to display HDR content following explanation from nvidia: https://on-demand.gputechconf.com/gtc/2017/presentation/s7394-tom-true-programming-for-high-dynamic-range.pdf
And it works great, but only on nVidia GPUs. Using the same method: Specify WGL_PIXEL_TYPE_ARB = WGL_TYPE_RGBA_FLOAT_ARB with color depth 16 (WGL_RED_BITS_ARB = 16, WGL_GREEN_BITS_ARB = 16, WGL_BLUE_BITS_ARB = 16)
On AMD GPUs it displays SDR image. That is to say it clamps the fragment shader values to 1.0, while on nvidia gpus it allows values to ~25.0 (or 10.000 nits as i understand it), and displays it correctly. This is using the same TV (LG B9) and same OS (Wind 10).
Note that other apps, like Chrome displays HDR content correctly on AMD gpus, and directX tests apps also.
Tried bunch of different AMD GPUs, drivers settings texture formats, pixel types etc, with no luck.
Read thru whole https://gpuopen.com/ for clues, no luck. Anyone have an idea or example how to create a proper OpenGL HDR Context/configuration?
I'll try an minimal example here, but its part of larger process and in Delphi, so it will be for orientation only
const
PixelaAttribList: array[0..20] of Integer =( //
WGL_DRAW_TO_WINDOW_ARB, 1, //
WGL_DOUBLE_BUFFER_ARB, 1, //
WGL_SUPPORT_OPENGL_ARB, 1, //
WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB, //
WGL_SWAP_METHOD_ARB, WGL_SWAP_EXCHANGE_ARB, //
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_FLOAT_ARB, //
WGL_RED_BITS_ARB, 16, //
WGL_GREEN_BITS_ARB, 16, //
WGL_BLUE_BITS_ARB, 16, //
WGL_ALPHA_BITS_ARB, 0, //
0);
var
piFormats: PGLint;
Begin
wglChoosePixelFormatARB(DC, @PixelaAttribList, NIL, 100, piFormats, @nNumFormats);
if nNumFormats = 0 then
exit;
if not SetPixelFormat(DC, piFormats^, nil) then
exit;
hrc:= wglCreateContextAttribsARB(DC, 0, nil);
if Result <> 0 then
ActivateRenderingContext(DC, hrc);
After the code i tested format with wglGetPixelFormatAttribivARB and I get 16 bit per color, so exactly whats needed.
Fragment shader is simple:
gl_FragColor = vec4(25.0,25.0,25.0,1.0);
Regards
windows
delphi
opengl
amd
hdr
0 Answers
Your Answer