Input Lag investigation on 3D systems

After tuning all video and accuracy related settings, including shaders, I went on to test input lag. 2D systems are easy to configure (on a PC) by playing with the runahead values. Hard Sync at 0 (VSync ON) didn’t make a difference, at least testing with the Pause + Frame Advance procedure. 3D Systems however are harder to deal with, bugs, performance issues, etc Below I present a summary of my findings. PC specs: i5-4670K @ 4.1Ghz, GTX 1070 OC, 16Gb RAM, Win7 x64.

10 frames -> Saturn 3D (GL, kronos, tested with Sonic R)
5 frames -> N64 (Vulkan, parallel_n64)
5 frames -> PSX (Vulkan, mednafen_psx_hw)
4 frames -> Saturn 2D (GL, mednafen_saturn)
3 frames -> Dreamcast (GL, reicast)(p+k procedure is buggy)

OpenGL

Hard Sync Didn’t yield any changes even with high “Hard GPU Sync Frames”

Frame Delay Can save 1 frame of input lag at most before turning performance to crawl.


Vulkan

Max Swapchain Images Didn’t yield any changes even with higher values


Both backends

Runahead Mostly good, but specially with such high demanding 3D cores and input lag it proves to not be sufficient. Yielded issues on some cores explained below.



Saturn 3D Here I’m rendering at an increased resolution, then scaling down to native resolution with shaders. I tested with Sonic R so other titles might have a slight different input lag. Saturn is by far the slowest of all the main 3D systems I tested. Enabling runahead with a value of 1 turns performance down, even enabling the second instance. Hard Sync didn’t make a change. An issue with Kronos is that it crashes when getting in or out RetroArch menu, so it’s a difficult core to test things out.

N64 Basically the same as the Kronos core involving runahead. Since we use Vulkan Hard Sync is not an option. Because I’m using angrylion multithreaded a good candidate to alleviate the bottleneck would be to use the parallel RDP. I think in this case we could run runahead with a value of 1 or 2.

PSX I’m using super sampling here leveraging the increased resolution options of the core. When using runahead performance is fine but the IR is lost.

Saturn 2D Hard Sync had no effect. Runahead even at 1 and second instance enabled made the game unplayable (sub 60fps)

Dreamcast Testing with a 3D game at an increased resolution. Like Kronos getting into the menu and out of it can freeze Retroarch, although not always. Hard Sync didn’t improve things neither runahead at 1.

I thought on using Vulkan for the cores running on GL backend but I’m not sure how good compatibility is, if anyone can give me an opinion on that.

3 Likes

You can’t measure hard sync/frame delay/max swap chain effect with the pause + next frame method.
It happens outside of the internal emulation time, it’s a rendering thing.

Saturn and N64 are quite bad, I had similar results.
Many N64 games do triple buffering internally for effects and that’s at 30fps… so 100ms lag ugh…
Kronos has a +1 frame of lag issue at the moment that beetle or yabasanshiro don’t have.

Then various games, various results. Putting pause on in sega ages outrun was the fastest I got (on 1st frame iirc?).

1 Like

Yes, that was my suspicion, I didn’t read the whole “An input lag investigation” thread (seems I unconsciously borrowed the title), but most of it applies to 2D systems.

The Sonic R game has an awful input lag, but I feel it’s that game only, I chose it because a sudden jump is easily identified.

I guess hard sync can only be measured with screen recording? I might just slap vulkan to these cores raise swapchain and call it a day then.

What really made me bleed was mednanfen_saturn, I only use it for 2D games so resolution is native. I tested with “Saturn Bomberman (USA)” and it felt VERY slow, 4 frames for a 2D game, and runahead couldn’t be used. I will try to use vulkan and see how it goes.

I mostly use a runahead of 2 for 2D systems and 1 for 3D systems since it’s so computational expensive. The target for me is 3 frames of input lag in 3D systems for an acceptable gameplay.

I’m not sure about mednanfen_saturn, I can use 2 or 3 frames runahead in fba or genesisplusGX but here using only 1 frame with second instance drops the framerate to half. I don’t know what CPU requirements it has but it seems very high.

The game has to be able to run at twice the speed (120fps) for 1 frame of runahead, 3x (180fps) for 2 frames, and so on…
And beetle saturn is a cpu intensive core you can’t push really far atm.
It would be better if it had a dynarec …or the next gen of cpu could help.

Beetle Saturn gives me 7-8 frames of lag in Duke Nukem. Feels much more sluggish than the real machine despite using a PAL one. I think the emulator adds at least 4 frames of lag compared to the real thing.

Recent PPSSPP sore has also at least +3 frames of lag compared to older versions.

Has anyone measured Mame’s Saturn/ST-V drivers? It’s of course not supposed to be as good as the current Saturn emulators, but I tried a few games briefly in the past on standalone and it seems to indicate it has decent compatibility.

I was going to test until I noticed that retroarch’s dedicated cores supported it, then tested Hyper Neo Geo 64, still far away.

I checked stand alone Dolphin emulator input lag with New Super Mario Bros on DX11 backend (for the ubershaders) and everything else tuned for speed (Dual Core, EFB/XFB to Texture) at IR x3. I got 5 frames of input lag, a repeating pattern. Not sure how it is in retroarch.

*Looks like one frame can be shaved from this video. Uses triple buffering which requires OpenGL, but Ubershaders require D3D (on nvidia cards), quite a rabbit hole.

I want to measure latency more accurately but I don’t have a 60fps camera, is this the only way to measure it?

Recently I have been playing the following two PS1 3D platformers (by the same developer Behaviour Interactive), which have the same terrible input lag:

  • The Grinch
  • Monsters, Inc. Scream Team

Via the pause + next frame method the internal latency is 9 frames, which equals 150ms (the games are running in 30 FPS but retroarch runs in 60FPS). Now with the additional external input lag the total latency should be somewhere around ~200ms (setup dependent). Especially for a platformer this doesn’t feel good at all, even though you can adjust to it after some time. I have also played both Bugs Bunny PS1 games by the same developer in the past: though I can’t remember anything about the input lag. It’s possible that all the developer’s PS1 games are affected by the same input lag issue.

For comparison, I quickly checked out the internal input latency in Tekken 3 which is quite low and I assume actually the standard:

  • 2 frames in main menu
  • 3 frames in-game

Since The Grinch has also a Dreamcast port, I tested its internal latency via Flycast. It’s 2 frames which is 67ms (the game runs in 30 FPS and that’s what retroarch’s framerate notification actually displays). That’s quite an improvement compared to the original PS1 version and it immediately felt better to control.

So at least on PS1 it appears that input lag varies quite a lot per game and can be quite high in some. I’m curious which PS1 game has the most amount of internal latency… could there be a game with more than 9 frames delay? :thinking: