Skip to content

Conversation

darksylinc
Copy link
Contributor

@darksylinc darksylinc commented Apr 15, 2025

Add CPU_GPU_SYNC_AUTO
Remove redundant calls to get_ticks_usec()

Fixes an unrelated bug when NAVIGATION_2D_DISABLED or NAVIGATION_3D_DISABLED are defined.

This is a modified version of #100031

Notable changes:

  1. Forbids the use of CPU_GPU_SYNC_SEQUENTIAL in production. It is allowed in the Editor, as it has its uses for debugging tight timing issues.
  2. Adds CPU_GPU_SYNC_AUTO which decides on realtime whether to use SEQUENTIAL or PARALLEL.
    • AUTO is disabled on OpenGL. The timing was too unreliable and every time it switched between SEQ and PAR a very visible stutter would occur.
    • AUTO has been tested by me on:
      • Vulkan Linux AMD (Mesa RADV)
      • Vulkan Windows AMD
      • Vulkan Windows NVIDIA
      • D3D12 Windows AMD
      • D3D12 Windows NVIDIA
  3. Refactors the code as it lives in RenderingServer, since frame pacing is irrespective of implementation. It addresses the problems found in this comment. Frame Pacing code is a bit odd, because it involves very low level mechanisms (e.g. synchronization) but it needs to be aware of the engine as a whole at a very high level (in fact changes, albeit small, go all way to main.cpp).
  4. Adds monitors to debug and understand by AUTO decides to use SEQ or PAR.
    • Those monitors are very useful even outside of frame pacing. They are very sensible to frame spikes and can detect issues that would cause stutter problems (even outside of AUTO/SEQ/PAR; as any frame time spike or hard missed target is very bad)

This is how the Monitors look like on a simple project, V-Sync enabled:

image

@darksylinc darksylinc requested review from a team as code owners April 15, 2025 19:21
@darksylinc darksylinc force-pushed the low-latency-mode branch 2 times, most recently from cbbb1e9 to bd03f7d Compare April 15, 2025 19:30
@Calinou Calinou added this to the 4.x milestone Apr 15, 2025
@darksylinc darksylinc force-pushed the low-latency-mode branch 2 times, most recently from 2500585 to d6ffb01 Compare April 15, 2025 22:10
Add CPU_GPU_SYNC_AUTO
Remove redundant calls to get_ticks_usec()

Fixes an unrelated bug when NAVIGATION_2D_DISABLED or
NAVIGATION_3D_DISABLED are defined

Co-authored-by: Danni <[email protected]>
Co-authored-by: Matias N. Goldberg <[email protected]>
@darksylinc
Copy link
Contributor Author

Superseeded by #106221

@darksylinc darksylinc closed this May 9, 2025
@AThousandShips AThousandShips removed this from the 4.x milestone May 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants