Problems with HDR and Nvidia Driver (on 3070)

I’m a game developer using the latest NVidia driver and the 3070 is a pretty recent card. I have a Vulkan-based game, and when toggling the HDR on/off button in the Windows Display Settings panel, the swapchain appears shifted up and to the left. The pixels appear under the titlebar, and results in a flashing right/bottom gap as frames are displayed in the game. When first moving the window, the swapchain snaps into the the right location. The driver is responsible for the location of the win32surface and swapchain. The window hasn’t moved, the hwnd size hasn’t changed. Toggling hdr on/off continues to exhibit the bug.

The second bug is that when dragging a window from an SDR to HDR monitor, all is well. Our game kicks into HDR. But when dragging from HDR back to SDR, the colors get blown out and change to extremes. So there is something wrong with both the fast-flip and non fast-flip (Vulkan/OpenGL present method) case here. Colors are fine SDR to SDR, and HDR to HDR. So something is getting set when dragged to an HDR monitor that doesn’t get set back in the driver. HDR is Rec2020, and SDR is srgba8.

Note that on the second bug with colors blown out, the RenderDoc capture of the scene is correct. So it’s something after the srgb8 framebuffer is sent to the swapchain. So seems like it’s on the driver end

The right/bottom gap issue also occurs on “Aperture Desk Job”. It’s simple to repro in windowed mode, and just toggle “HDR” from the Win10 display settings. I’m assuming that Valve is also using Vulkan here, so that it runs well on SteamDeck.

This also causes the window or sometimes entire desktop to exhibit the color blow out. The only way to fix this is to turn “HDR” back on, but obviously we should be able to set SDR or HDR and have the driver do the right thing.

Hi there @user9448 and welcome to the NVIDIA developer forums.

Possibly. But to do so it also needs to get the correct dimensions in the imageExtent member of the Swapchain info. If the color format changes, this might also change and you should explicitly derive the extent from the FrameBuffer size.
This might be worth checking, but of course it could still be a bug elsewhere.

Regarding the second issue, just to clarify, when moving back to the SDR monitor, do you also switch back to the SDR color format on your end?

A couple of questions so i can forward this to some experts:

  • Which Windows version is this exactly?
  • Which NVIDIA driver version?
  • Which Window “manager” are you using? I guess GLFW?

Thanks!

But to do so it also needs to get the correct dimensions in the imageExtent member of the Swapchain info.

The extent doesn’t change in this case. There’s no dpi or resize change occurring. Just the HDR change on/off. And we have no control of the swapchain offset, only it’s size. So the extension is responsible for grabbing the right clientRect of the HWND. Seems like it’s not accounting for window border or titlebar in this case during the switch.

Regarding the second issue, just to clarify, when moving back to the SDR monitor, do you also switch back to the SDR color format on your end?
Yes, the HDR side is Rec2020 +10A2, the SDR side is sRGB + sRGBA8. This is all working properly, and the swapchain is rebuilt.

Then the driver seems to be leaving some HDR state stuck on when I drag back from HDR to SDR monitor. The color space and the format are set, and the swapchain is rebuilt for that. But something in the display hw causes the entire display to go super bright like the driver is still applying Rec2020_PQ curve to the outgoing sRGBA8 swapchain in SDR mode.

  • Which Windows version is this exactly?
    Win 10 Pro 10.0.19045; en

  • Which NVIDIA driver version?
    DeviceName:NVIDIA GeForce RTX 3070 (0x00002488)
    DeviceType:GpuDiscrete
    Vendor:NVIDIA (0x000010DE)
    ApiVersion:1.3
    DriverVersion:537.52.0 (0x86434000)

  • Which Window “manager” are you using? I guess GLFW?
    No it’s just a custom Win32 app. I’m just referencing the Win 10 DWM.

This also happens when I turn on a second HDR monitor positioned on the left side, and the windowed game shifts up and to the left on the first HDR monitor. Moving the window corrects the incorrect rendering.

Thank you for all the additional details!

You might be onto something there.

For now I opened an internal issue on this so the driver experts can look at it. If they need more details I will follow-up with you here.

Thanks!