stop sleep during high frametime
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
c64c72e17c
commit
7f5b2c67e1
@ -7,6 +7,8 @@ DONE:
|
||||
|
||||
TODO(?):
|
||||
|
||||
- Unify the octtree rendering services into a single octree
|
||||
|
||||
- CFD
|
||||
- Internal Boundaries
|
||||
- Multigrid optimization
|
||||
|
||||
@ -1361,6 +1361,7 @@ Don't simulate extra frames if we're taking too much time
|
||||
Fluid sim toggle on client side
|
||||
Lower duplicate physics frame count
|
||||
Various code cleanup
|
||||
Stop sleeping during high frame time
|
||||
|
||||
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ public class ControlCategoryMenuNav {
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_SELECT, new Control(ControlType.KEY,GLFW.GLFW_KEY_ENTER,false,"",""));
|
||||
handler.addControl(DATA_STRING_INPUT_CODE_MENU_BACKOUT, new Control(ControlType.KEY,GLFW.GLFW_KEY_ESCAPE,false,"",""));
|
||||
handler.addControl(MENU_MOUSE_MOVE, new Control(ControlType.MOUSE_MOVEMENT,0,false,"",""));
|
||||
handler.addControl(INPUT_CODE_MENU_MOUSE_PRIMARY, new Control(ControlType.MOUSE_BUTTON,GLFW.GLFW_MOUSE_BUTTON_LEFT,false,"",""));
|
||||
handler.addControl(INPUT_CODE_MENU_MOUSE_PRIMARY, new Control(ControlType.MOUSE_BUTTON,GLFW.GLFW_MOUSE_BUTTON_LEFT,false,"Mouse primary",""));
|
||||
handler.addControl(MENU_SCROLL, new Control(ControlType.MOUSE_SCROLL,0,false,"",""));
|
||||
handler.addControl(MENU_DRAG_START, new Control(ControlType.MOUSE_MOVEMENT,0,false,"",""));
|
||||
handler.addControl(MENU_CAPTURE_SCREEN, new Control(ControlType.KEY,GLFW.GLFW_KEY_F4,true,"Screenshot","Takes a screenshot of the engine"));
|
||||
|
||||
@ -163,7 +163,11 @@ public class Globals {
|
||||
* Number of frames to wait before triggering gc again
|
||||
*/
|
||||
public static final int GC_FRAME_FREQUENCY = 15;
|
||||
|
||||
|
||||
//
|
||||
//Engine timing
|
||||
//
|
||||
public static boolean EXPLICIT_SLEEP = true;
|
||||
|
||||
//
|
||||
//Client connection to server
|
||||
|
||||
@ -439,13 +439,15 @@ public class Main {
|
||||
///
|
||||
/// C L E A N U P T I M E V A R I A B L E S
|
||||
///
|
||||
Globals.profiler.beginCpuSample("sleep");
|
||||
if(Globals.timekeeper.getMostRecentRawFrametime() < targetFramePeriod){
|
||||
sleep((int)(1000.0 * (targetFramePeriod - Globals.timekeeper.getMostRecentRawFrametime())));
|
||||
} else {
|
||||
sleep(1);
|
||||
if(Globals.EXPLICIT_SLEEP && Globals.timekeeper.getMostRecentRawFrametime() < 0.01f){
|
||||
Globals.profiler.beginCpuSample("sleep");
|
||||
if(Globals.timekeeper.getMostRecentRawFrametime() < targetFramePeriod){
|
||||
Main.sleep((int)(1000.0 * (targetFramePeriod - Globals.timekeeper.getMostRecentRawFrametime())));
|
||||
} else {
|
||||
Main.sleep(1);
|
||||
}
|
||||
Globals.profiler.endCpuSample();
|
||||
}
|
||||
Globals.profiler.endCpuSample();
|
||||
Globals.timekeeper.numberOfRenderedFrames++;
|
||||
if(maxFrames > 0 && Globals.timekeeper.numberOfRenderedFrames > maxFrames){
|
||||
running = false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user