bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.84k stars 3.54k forks source link

Use u64 for change ticks #15683

Open richchurcher opened 2 weeks ago

richchurcher commented 2 weeks ago

[!NOTE] Tracking issue for closed 2022 PR #6327 (alternate approach: #6651) Original author: zakarumych

What problem does this solve or what need does it fill?

Avoids the complexity (and runtime perf overhead) of our current looping u32 implementation, at the cost of higher memory usage.

Implementation blocked on configurable change detection.

What solution would you like?

Replace u32 with u64 for tick values. Maintenance code to guard against overflow should be removed.

Downside - requires AtomicU64. A workaround should be implemented for when AtomicU64 is not available on target platform.

What alternative(s) have you considered?

See #6651 for context.

alice-i-cecile commented 2 weeks ago

I've updated the motivation a bit :) Thanks for extracting this!

BD103 commented 2 weeks ago

Downside - requires AtomicU64. A workaround should be implemented for when AtomicU64 is not available on target platform.

It is specifically PowerPC and MIPS that do not support AtomicU64, since I tried using it in Cargo.

It looks like MIPS is being phased out in favor of RISC-V. PowerPC also looks like it is dying, though it is notably used by the GameCube, Wii, and Wii U. If we want to support these platforms (which I think would be awesome), we definitely want some workaround.