0

So this is a very curious issue I've come across, and to start, there is another stackoverflow question along similar lines that is unanswered:

DirectX 11 application slows down dramatically when not foreground application

The suggested answer of disabling Windows Game Mode (essentially prioritizes foreground applications) does not seem to affect this to a great degree.

Here's the issue:

When I call EndDraw, execution is stalled on average 5-70ms if the application is not in foreground. The severity of this is random. For instance, my application will maintain an average render time of around 5ms, but it will spike to 15, 20, 25, etc. When the application is in foreground, it will remain a constant 5ms.

How can I prioritize my application and my draws over another applications (such as a game). I have found zero documentation of throttling and prioritization of Direct2d1 devices outside of SetRenderingPriority, which consists of two pointless paramters (regular or low, no option for high), and one undocumented "force dword" parameter, as well as a vague reference to other throttling that may occur. There is no documentation for D2D1_RENDERING_PRIORITY_FORCE_DWORD anywhere (just google it verbatim), and it does not appear to make a difference anyways.This just makes the enum DWORD size, whoops.

To add additional information, changing the presentation method (such as immediate, and none [which waits for the display to refresh]) does not seem to affect this either.

Ben
  • 749
  • 1
  • 7
  • 18
  • The linked question has no answer mainly because it's difficult to say more w/o some reproducing bits and/or steps, and as in the other question, there are good chances that the problems lies in your code. PS: D2D1_RENDERING_PRIORITY_FORCE_DWORD is bogus, it's just a marker that means "last/max value in the list of enum values". – Simon Mourier Jan 17 '22 at 09:08
  • @SimonMourier Thank you. And to be honest this does not lie in my code. You can take the official microsoft published examples and observe the same behavior using any AMD or NVIDIA gpu. I think this is throttling/prioritization done on the GPU side of things, and is unlikely to be able to be changed/messed with in order to provide the best performance for foreground games. I'm guessing this is a large reason almost every commercial "overlay" just hijacks/hooks the games DX device and inserts it's drawings rather than trying to draw graphics on top of the game with a separate device & window. – Ben Apr 16 '22 at 03:59
  • Actually, no, I don't observe the same behavior with Microsoft published samples, or tell us exactly what sample causes what behavior exactly. – Simon Mourier Apr 16 '22 at 06:42

0 Answers0