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(?):
|
TODO(?):
|
||||||
|
|
||||||
|
- Unify the octtree rendering services into a single octree
|
||||||
|
|
||||||
- CFD
|
- CFD
|
||||||
- Internal Boundaries
|
- Internal Boundaries
|
||||||
- Multigrid optimization
|
- Multigrid optimization
|
||||||
|
|||||||
@ -1361,6 +1361,7 @@ Don't simulate extra frames if we're taking too much time
|
|||||||
Fluid sim toggle on client side
|
Fluid sim toggle on client side
|
||||||
Lower duplicate physics frame count
|
Lower duplicate physics frame count
|
||||||
Various code cleanup
|
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_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(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(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_SCROLL, new Control(ControlType.MOUSE_SCROLL,0,false,"",""));
|
||||||
handler.addControl(MENU_DRAG_START, new Control(ControlType.MOUSE_MOVEMENT,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"));
|
handler.addControl(MENU_CAPTURE_SCREEN, new Control(ControlType.KEY,GLFW.GLFW_KEY_F4,true,"Screenshot","Takes a screenshot of the engine"));
|
||||||
|
|||||||
@ -164,6 +164,10 @@ public class Globals {
|
|||||||
*/
|
*/
|
||||||
public static final int GC_FRAME_FREQUENCY = 15;
|
public static final int GC_FRAME_FREQUENCY = 15;
|
||||||
|
|
||||||
|
//
|
||||||
|
//Engine timing
|
||||||
|
//
|
||||||
|
public static boolean EXPLICIT_SLEEP = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
//Client connection to server
|
//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
|
/// 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.EXPLICIT_SLEEP && Globals.timekeeper.getMostRecentRawFrametime() < 0.01f){
|
||||||
if(Globals.timekeeper.getMostRecentRawFrametime() < targetFramePeriod){
|
Globals.profiler.beginCpuSample("sleep");
|
||||||
sleep((int)(1000.0 * (targetFramePeriod - Globals.timekeeper.getMostRecentRawFrametime())));
|
if(Globals.timekeeper.getMostRecentRawFrametime() < targetFramePeriod){
|
||||||
} else {
|
Main.sleep((int)(1000.0 * (targetFramePeriod - Globals.timekeeper.getMostRecentRawFrametime())));
|
||||||
sleep(1);
|
} else {
|
||||||
|
Main.sleep(1);
|
||||||
|
}
|
||||||
|
Globals.profiler.endCpuSample();
|
||||||
}
|
}
|
||||||
Globals.profiler.endCpuSample();
|
|
||||||
Globals.timekeeper.numberOfRenderedFrames++;
|
Globals.timekeeper.numberOfRenderedFrames++;
|
||||||
if(maxFrames > 0 && Globals.timekeeper.numberOfRenderedFrames > maxFrames){
|
if(maxFrames > 0 && Globals.timekeeper.numberOfRenderedFrames > maxFrames){
|
||||||
running = false;
|
running = false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user