- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4.2k
Instant fallback fix for aarch64 #21677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
02c4a4c    to
    3fac947      
    Compare
  
    | Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. | 
    
      
        2 similar comments
      
    
  
    | Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. | 
| Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. | 
| Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. | 
    
      
        1 similar comment
      
    
  
    | Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. | 
8f1cb41    to
    c8747b6      
    Compare
  
    | Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. | 
Objective
The current
Instantfallback implementation inbevy_platformcontains a bug on ARM CPUs, such as Apple Silicon. It appears only under specific conditions — when thestdfeature is disabled for desktop builds on ARM. For web builds, as I can see, the time implementation differs and does not exhibit this issue. Still, this remains a bug.In the current implementation, the code reads the system counter value (tick count) and incorrectly interprets it as nanoseconds. We have to additionally divide number by frequency to obtain elapsed time.
Solution
Query the system counter frequency and compute nanoseconds using the correct formula:
Testing
A test was added, but verifying this fix is tricky since it’s platform-specific.
The test checks the correct condition only on
aarch64when thestdfeature is disabled — which is somewhat cumbersome to configure in bevy’s root project. The best option I found for development is disablecrate::cfg::stdbranch inbevy_platform/src/time/mod.rsFor a visual sanity check, you can run the
move_spriteexample, if the time calculation is incorrect, the sprite’s movement appears roughly 10x slower than expected.