libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.33k stars 1.84k forks source link

[Feature Request] leveraging/improving frameskip support #10133

Open barbudreadmon opened 4 years ago

barbudreadmon commented 4 years ago

Description

Damn, i was pretty sure i did this one a long time ago, but it seems i forgot.

So, in emulation, skipping a frame generally means updating the state of the machine while not drawing anything. It's useful for lowering the charge, it dramatically improves playability for emulated systems with complex rendering on lower-end devices, not sure there are other use cases (maybe for emulating content with higher framerate than the host device is capable of ?)

There are 2 ways to achieve this :

Expected behavior

For a given frame, the frontend decide if rendering is necessary, based on settings and computing, and will tell the core to actually render it or not, could be either an arg added to retro_run, or an environment callback, i guess the second one would be prefered to avoid breaking the api.

Actual behavior

The frontend doesn't compute this information, so the core can't be aware either, and is limited to using core options for setting fixed frameskip.

phcoder commented 4 years ago

You can use frame_time_callback for this

RobLoach commented 4 years ago

What are you trying to accomplish? Better performance on a core? Which core are you using? Which platform?

hizzlekizzle commented 4 years ago

I talked with barbudreadmon some about this in discord. There's not really any way to do frontend-based frameskip in a way that doesn't involve the core, but we could certainly have a uniform way of passing frameskip information from the frontend to the core. For example, most cores implement frameskip as a number of frames, so if we have a frontend option that mirrors that behavior, we can just pass the setting to the core's own frameskipping functionality.

barbudreadmon commented 4 years ago

Better performance on a core?

That would be the main benefit, as i said : "It's useful for lowering the charge, it dramatically improves playability for emulated systems with complex rendering on lower-end devices"

Which core are you using?

The cores i work on (fbneo, flycast, kronos) currently got a "skip X frame over Y frame" core option, the 2 other cores i'm involved with (yabause, yabasanshiro) have the broken auto-frameskip behavior i'm describing in my initial message, the goal would be to replace all of the current "should i render ?" code in those cores by something that would be decided by the frontend.

Which platform?

Any