-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Batched/Linear uploads #56
Conversation
The smaller the PR the easier it is to review and less chance for mistakes. So Separate PRs 👍 |
This one is also appreciated! Don't see anything blocking the merge other than lints & merge conflicts |
Alright, merged and fixed up! Did a few reads over and I'm happy enough with it to open this up. I hope I did alright with the merge, still learning git.
I should not be allowed to benchmark/write PR messages at 2am. The improvements are much more modest at ~25% improvement in frametimes. The other improvements are still true - I just have no idea how i got that number lol. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking fine to me at this point and works at my end
* Batch upload images, skip 2 copies per image * Batch upload meshes, map only twice. * lints * Integrate packed fonts * Lints again, oops
* Batch upload images, skip 2 copies per image * Batch upload meshes, map only twice. * lints * Integrate packed fonts * Lints again, oops
* Batch upload images, skip 2 copies per image * Batch upload meshes, map only twice. * lints * Integrate packed fonts * Lints again, oops
* Batch upload images, skip 2 copies per image * Batch upload meshes, map only twice. * lints * Integrate packed fonts * Lints again, oops
* Batch upload images, skip 2 copies per image * Batch upload meshes, map only twice. * lints * Integrate packed fonts * Lints again, oops
Replaces the allocate-as-needed logic with bulk linear allocations for both image create, image update, and mesh upload.
Doubles the framerate over masterwhen compared using a modifieddemo_app.rs
withPresentMode::Mailbox
and a few spare swapchain images, even using 1% less of my CPU while doing so. It also starts up a sixteenth of a second faster, clearly the largest benefit here :PImage uploads are now batched per-frame and only synchronize once. Should help with stutter on UIs that load/modify fonts or images frequently (Scrubbing the font size slider on the
demo_app
's FontBook is a good example).Mesh uploads now only memmap the buffers twice-per-frame instead of twice-per-mesh.
bytemuck
this could be further reduced to a single memmap per frame, but it would require a private dependency addition and a public egui feature flag change for a somewhat trivial perf boost, and I'm not sure the policy on that (could also be achieved with some fairly trivialunsafe
ops).It should use substantially less memory during these operations, but I do not have a convenient way to measure. On current master, image creation/deltas involve 4 in-memory copies, reduced here to 2.
I have further optimizations in mind, namely deduplicating command buffer commands, as there are currently ~250 commands for 20 meshes which could be greatly reduced. Always unsure on whether I should bundle the changes into one PR since they're a bit disjoint -- please advise!