d2phap / DXControl

🖌️ A WinForms hybrid control that supports Direct2D and GDI+ drawing
MIT License
24 stars 5 forks source link

Runtime exception with Nvidia GSYNC enabled #2

Closed jcbize closed 1 year ago

jcbize commented 1 year ago

Today I ran into an issue with ImageGlass 9.0 beta 3 (wonderful piece of software, btw) where it crashes a few seconds after startup with the following exception:

Version: ImageGlass v9.0.3.1225
Release code: moon
OS: Microsoft Windows NT 10.0.22621.0 64-bit

----------------------------------------------------
Error:

The wait operation timed out.
----------------------------------------------------

System.ComponentModel.Win32Exception (258): The wait operation timed out.
   at DirectN.VerticalBlankTicker.Wait(Object state) in D:\_GITHUB\@d2phap\DXControl\Source\DXControl\DirectN\DirectWrite\Extensions\VerticalBlankTicker.cs:line 129
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

This happens whether an image file is loaded or not. Clicking Continue in the exception dialog causes the application to crash to desktop. Note that I'm not able to reproduce this issue with ImageGlass 8.8.

After taking a quick look at the source, it seems that the culprit is the DXControl VerticalBlankTicker module waiting for vsync. I have a GSYNC monitor that supports a dynamic refresh rate, which affects how vsync works. Sure enough, the ImageGlass error can be bypassed by creating an application-specific profile for ImageGlass in the NVIDIA Control Panel, and changing the "Monitor Technology" from "GSYNC" to "Fixed Refresh." With this custom configuration, the application works as expected.

I'm running Windows 11 Pro 64-bit Build 22621, DirectX 12, WDDM 3.1, and the NVIDIA driver version 531.26.

I hope this helps. Let me know if I can provide any additional info.

d2phap commented 1 year ago

Thank you for the details.

d2phap commented 1 year ago

Hi @jcbize ImageGlass 9.0 beta 4 is released. Could you help me to verify if the issue still persists?