MangoHud icon indicating copy to clipboard operation
MangoHud copied to clipboard

Show `DXVK_FRAME_RATE` limit on hud if set

Open HeroBrine1st opened this issue 2 years ago • 5 comments

Check if DXVK_FRAME_RATE is set and uses it to show instead of fps limit:

image

This change is purely visual. Of course it does not check DXVK config.

Tested on Elite: Dangerous in following combinations:

  1. No DXVK_FRAME_RATE variable set and no config limit - shows Fps limit [late]: 0
  2. DXVK_FRAME_RATE=75 and no config limit - shows like in screenshot
  3. With fps_limit=60 in config and DXVK_FRAME_RATE=75 - Fps limit [late]: 60
  4. The same as 3 but with fps_limit_method=early - works as expected
  5. The same as 3 but with fps_limit_method=late - works as 3

You may think this implementation is rather dirty and environment read should be decoupled from the hud element. If so, you can simply close this PR and think it is a feature request, because C++ is not my main language and thus I'm not able to deep dive in this project in reasonable amount of time.

HeroBrine1st avatar Aug 01 '23 11:08 HeroBrine1st

This should check if we're using dxvk by checking HUDElements.sw_stats->engine == EngineTypes::DXVK. If both mangohud and dxvk has fps limit it should display which ever has the lowest limit set. Not sure how to handle if both have the same limit, probably show dxvk?

flightlessmango avatar Aug 01 '23 12:08 flightlessmango

I think in the same limit case we should show dxvk because in late case mangohud presents frame and waits with dxvk, then mangohud requests frame, dxvk creates it and mangohud instantly presents it, or in early case mangohud, I guess, gets frame, instatly shows it and waits for next frame from dxvk. But I may be wrong, I read about late/early limiter like 30 minutes ago. UPD: In this wall of text I forgot to write that, I think, DXVK uses late limiter: I see no inputlag from it.

I implemented dxvk engine check and ^, btw. And tested it, but not as thorough as in first PR (simply checked that it shows lowest limit).

P.s. I forgot to add "dxvk engine check" to commit message, so I think I'll squash it before merge.

HeroBrine1st avatar Aug 01 '23 12:08 HeroBrine1st

Added a fix so that it still shows "Fps limit [late]: 0" if DXVK_FRAME_RATE is set to an invalid value and no fps limit is set in config. Sorry for interrupting actions (or it was a github bug, idk).

HeroBrine1st avatar Aug 01 '23 12:08 HeroBrine1st

Can you squash the commits? Otherwise I think we're good

flightlessmango avatar Aug 16 '23 14:08 flightlessmango

Also I found a bug by "squash verification" review: if there's no fps_limit in config, condition for showing dxvk won't be true (I tested it before fixing of course), so if(fpsDxvk > 0 && fpsDxvk <= fps) -> if(fpsDxvk > 0 && (!fps || fpsDxvk <= fps)). Squashed it as well and tested again: no fps_limit in config and it shows dxvk limit now.

HeroBrine1st avatar Aug 19 '23 15:08 HeroBrine1st