Git Product home page Git Product logo

Comments (6)

aevyrie avatar aevyrie commented on June 2, 2024 1

Since vsync is not always on, you'd need an additional framerate limiter just prior to the frame presentation step, which can absorb any remaining time to reach the target frametime.

FWIW, this was actually the initial design of this plugin.

0ms -----------------------
            Estimate how long the next frame will take, minus a small margin to give us space if it takes longer
            Sleep for this duration. (Forward estimation)
8ms         Start of event loop. Get input. Do stuff.
11.8ms      See how close our estimate was to the requested frame time, sleep if required to get the frametime just right
12ms        Send to GPU, present frame (input is 4ms out of date)
16ms ----------------------

That was taken from my comments in the initial discussion that spawned this plugin: bevyengine/bevy#3317

However, in practice I had a lot of trouble getting good results from it. This may have predated my use of spin_sleep, so it may be worth revisiting that approach.

from bevy_framepace.

UkoeHB avatar UkoeHB commented on June 2, 2024 1

@MatthewScholefield a comprehensive rework of this crate is blocked by bevy's render code, which doesn't currently expose timing information for presenting frames.

from bevy_framepace.

UkoeHB avatar UkoeHB commented on June 2, 2024

However, in practice I had a lot of trouble getting good results from it. This may have predated my use of spin_sleep, so it may be worth revisiting that approach.

Yeah you'd essentially need to duplicate the framepace PID controller for the framerate limiter. You need very accurate sleep times.

from bevy_framepace.

aevyrie avatar aevyrie commented on June 2, 2024

Yup, I did play around with writing a PID controller, but I may have been limited by platform sleep time accuracy/variance. Definitely worth revisiting this, I appreciate your deep-dive.

from bevy_framepace.

MatthewScholefield avatar MatthewScholefield commented on June 2, 2024

Appreciate the investigation into this. Would be great to get this improved. I can replicate frequent stutters on my machine under Wayland.

from bevy_framepace.

aevyrie avatar aevyrie commented on June 2, 2024

Unfortunately that is the case. I can take another look at the PID impl if I get the time, but it's low on my priority list as I expect improvements will be minor until we can properly measure vblanks.

from bevy_framepace.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.