Re: Bug: Times passed to AnimationTimer should not fluctuate

2024-08-29 Thread John Hendrikx
On 29/08/2024 20:45, Michael Strauß wrote: Yes, that makes sense. In any case, we shouldn't be using a system timer, but simply record the timestamp at v-sync, and then pass this precise timestamp to all AnimationTimers. It shouldn't matter when Yeah, I still think however that this is not en

Re: Bug: Times passed to AnimationTimer should not fluctuate

2024-08-29 Thread John Hendrikx
, 2024 at 11:45 *To: * *Cc: *openjfx-dev@openjdk.org *Subject: *Re: Bug: Times passed to AnimationTimer should not fluctuate Yes, that makes sense. In any case, we shouldn't be using a system timer, but simply record the timestamp at v-sync, and then pass this precise timestamp to all AnimationTimers.

Re: Bug: Times passed to AnimationTimer should not fluctuate

2024-08-29 Thread Andy Goryachev
iscrepancy (AbstractPrimaryTimer:264). Does not explain the issue John raised though. -andy From: openjfx-dev on behalf of Michael Strauß Date: Thursday, August 29, 2024 at 11:45 To: Cc: openjfx-dev@openjdk.org Subject: Re: Bug: Times passed to AnimationTimer should not fluctuate Yes, that m

Re: Bug: Times passed to AnimationTimer should not fluctuate

2024-08-29 Thread Michael Strauß
Yes, that makes sense. In any case, we shouldn't be using a system timer, but simply record the timestamp at v-sync, and then pass this precise timestamp to all AnimationTimers. It shouldn't matter when AnimationTimers are invoked between frames, as long as the timestamp corresponds to the v-sync s

Re: Bug: Times passed to AnimationTimer should not fluctuate

2024-08-29 Thread John Hendrikx
I think they're a bit separate.  Even with VSync, the time it takes to kick the FX thread in action is still going to be between 0-30ms.  If it then passes `System.nanoTime()` to the AnimationRunnables, you're basically saying that they should render a frame at the precise time of VSync-Time +

Re: Bug: Times passed to AnimationTimer should not fluctuate

2024-08-29 Thread Michael Strauß
The entire idea of using a system timer in the presence of v-sync is wrong, it simply can't work reliably. We get accurate frame synchronization for free from Direct3D, we should use that instead of system timers. There's a JBS issue with a detailed analysis: https://bugs.openjdk.org/browse/JDK-81

Bug: Times passed to AnimationTimer should not fluctuate

2024-08-29 Thread John Hendrikx
TLDR; AnimationTimer is being fed a time not based on the time the next frame is expected to be rendered but the time of when the FX thread is finally scheduled to do the callbacks.  This time fluctuates wildly, and is a time that's useless for doing frame accurate calculations of animations (s