pygfx / shadertoy

Shadertoy implementation based on wgpu-py
BSD 2-Clause "Simplified" License
15 stars 2 forks source link

iDate.w milliseconds out of sync #34

Open Vipitis opened 4 months ago

Vipitis commented 4 months ago

Implemented way back in https://github.com/pygfx/wgpu-py/pull/428 and had an issue ever since.

milliseconds aren't in sync with seconds. The example clock we have includes milliseconds but it's difficult to spot the problem.

Run for example wgpu-shadertoy https://www.shadertoy.com/view/XXGXzK or wgpu-shadertoy https://www.shadertoy.com/view/ll3yWj and you will easily spot it.

the code in question: (milliseconds are from the perf_counter() used by iTime and iTimeDelta and not the time_struct for iDate) https://github.com/pygfx/shadertoy/blob/eb14d382a8de5c4e3cc260fac7e8707704fbecf9/wgpu_shadertoy/shadertoy.py#L616-L624

I think there are several better solutions, will try a few and hopefully open a PR next week.

Vipitis commented 3 months ago

would be great to also be able to mock iDate for taking snapshots that are reproducible. So that might be something to consider when addressing this!