Commit Graph

8 Commits

Author SHA1 Message Date
Lorenz Junglas
4b09d3dbd9 Fix particle sprite perf regression (#4454)
* Upload SpriteBatchSceneObject buffer inside render context

* Bump particle pool size
2026-04-02 14:03:56 +02:00
Lorenz Junglas
26eebeb1c4 Calculate sprite batch bounds in parallel (#4318)
* Calculate sprite batch bounds in parallel

* Particle sprites pass bounds so we dont have to recalculate them

* Account for pivot when calculating bounds

* Use empty bbox isntead of infinite bounds for spriteless groups
2026-03-17 15:00:28 +01:00
Lorenz Junglas
d1012d030b Reduce SpriteSystem per frame allocations (#4249)
Avoid RenderGroupKey allocations

This would allocate a lot easily 60Mb/s.
Instead of a dedicated struct we now compute a 64bit hash and use that for render grouping.

Remove per frame HashSet, List and LINQ allocations
2026-03-06 18:57:31 +01:00
Lorenz Junglas
7258b356f8 Improve performance timing scopes (#4176)
Fixes timing scopes to more accurately represent a per-frame main thread breakdown, and prevents spikes when GC is executed.

- **GcPause**
  - New separate timing scope showing time spent in GC per frame
  - GC pause time is subtracted from all other scopes, so each scope now only tracks its own code execution and no longer includes GC overhead
  - e.g. when GC occurs during the audio scope, the audio scope no longer spikes to 20ms
- **AudioMixingThread** removed from the main scopes
  - Runs on a separate thread, so its timings are effectively meaningless in the main thread view
  - All other scopes are main thread only
  - No longer relevant given the audio optimisation work done over the past months
- **Scene** scope removed
  - Didn't make much sense as it was an aggregate wrapping many other timing scopes
  - Replaced with a finer `Update` scope that tracks `Component.FixedUpdate`/`Update`
- **Editor** scope no longer shows in-game
- Scopes reschuffled
  - e.g. verlet rope physics traces are now tracked under the physics scope
  - Audio occlusion queries are now tracked under the audio scope

https://files.facepunch.com/lolleko/2026/March/02_12-59-QuixoticMarten.png
2026-03-02 13:05:45 +01:00
Sam Pavlovic
8ab762fe93 Make bindless Envmaps, Particles and Light Cookies be flagged as used so texture eviction won't kill them 2026-02-23 21:05:25 +00:00
Lorenz Junglas
5f088c419e Avoid per-frame KeyValuePair[] allocations in Parallel.ForEach (#4128)
Parallel.ForEach(IEnumerable<T>) allocates KeyValuePair<long, T>[] chunks
internally for work distribution. Passing a List<T> avoids this entirely.
2026-02-23 17:52:20 +01:00
Antoine Pilote
9331f2bffa Fixed opaque & non-opaque sprite sorting (#3660) 2025-12-22 16:29:31 -08:00
s&box team
71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00