Skip to content
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

Allocate light data UBO from per-frame allocator, misc. fixes and cleanup #5970

Merged
merged 5 commits into from
Nov 17, 2024

Conversation

sturnclaw
Copy link
Member

Another general collection of "fix" commits.

This PR adds additional profiling information to the renderer, and resolves an "early serialization" point which required the previous frame's rendering to be ~mostly complete before starting to record commands for the current frame.

I don't expect any significant performance increase from this PR, except in the case of extremely GPU-bound devices where you might see an improvement of up to a few milliseconds in frame-time, as more CPU work is able to be overlapped with the previous frame's GPU execution time.

This change does fully enforce the existing invariant that you must call Renderer::SetLights() before attempting to record a draw command using a lit material. An assertion will be thrown in debug mode if this invariant is broken.

It also fixes #5940 - turned out to be quite a simple one-liner once I realized what the problem was.

- Instead of maintaining a separate uniform buffer for light data, allocate it from the per-frame temp allocator.
- Light data is typically updated one to several times per frame, making it a good candidate for temp buffer backing.
- This avoids an early serialization point, where we were attempting to modify the single light data buffer while it may have been in-use by the previously-submitted frame.
Copy link
Contributor

@fluffyfreak fluffyfreak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, took me a while to figure out the UniformBuffer only ever allocating but I got there.

@fluffyfreak
Copy link
Contributor

Also as tested on Windows this all works 👍

- The HashTable implementation expected that its memory would be externally zero-initialized before the constructor is called
- Since HashTable stores a raw pointer to the backing memory and allocates on construction, making a temporary copy of ZoneDumper in dumpzones() lead to a double-delete
@fluffyfreak
Copy link
Contributor

Significant performance improvement on the RPi5, at least as good as #5972 so I'll close that one 👍

@sturnclaw sturnclaw merged commit e03e743 into pioneerspacesim:master Nov 17, 2024
4 checks passed
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.

Negative delta-v displayed for certain ships in shipyard
2 participants