-
-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Suspiciously small delta argument to _process with thread model Multi-Threaded #35718
Description
Godot version: 3.2
OS/device including version: Linux (Manjaro), NVIDIA closed source driver 430.64
Issue description: Prerequisites: thread_model needs to be multi-threaded, a project with low CPU load and a machine with <=4 cores probably help, physics_jitter_fix = 0, vsync enabled.
The script-visible effect is that every once in a while, _process is called with a delta far smaller than the screen refresh would suggest. The attached sample project prints for me, for example
0.000244
0.000197
0.000105
0.000182
0.000244
0.000202
0.000132
0.000161
0.000101
0.000137
after a couple of seconds.
The calls with small delta are not neighbors to calls with suspiciously large delta, as would be the case if the time of one frame was measured wrong.
Steps to reproduce: Run the attached sample project. To build a new project from scratch, activate multithreading, set physics_jitter_fix to 0 (positive values of that cushion the effect somewhat).
Minimal reproduction project: MultithreadTimerSpikes.zip. Relevant script code just prints abnormal delta values:
var average_delta := 1/60.0
var warmup := 5
func _process(delta: float):
if warmup > 0:
warmup = warmup - 1
return
if delta < average_delta * .5 or delta > average_delta * 1.5:
print(delta)
average_delta = average_delta + .01 * (delta - average_delta)