Introduce createBufferWithData function for easy buffer creation.#1208
Merged
manon-traverse merged 5 commits intoMay 22, 2026
Merged
Conversation
941605f to
84cc421
Compare
MarijnS95
approved these changes
May 20, 2026
MarijnS95
left a comment
Collaborator
There was a problem hiding this comment.
Yes that is a nice approach.
(Albeit a bit hacky, this flow makes it easy to experiment with upload-less UMA by simply overriding all buffers to be CpuToGpu in createBufferWithData() 🙂)
Contributor
Author
At some point we could also check if the device is UMA and just map the GpuOnly buffer directly. |
bogner
approved these changes
May 21, 2026
bogner
left a comment
Contributor
There was a problem hiding this comment.
LGTM, but my comment here kind of applies generally across a lot of preexisting code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As a step towards making resource and descriptor creation the same across graphics APIs we need a function to handle creating buffers and uploading data. This includes optionally creating an upload buffer.
Right now, it's only used to create the vertex buffer and avoids the use of an upload buffer by placing the vertices in host visible memory.
In a future PR, all generic buffers should be created via this path, and the same for textures with similar functions. However, this is quite a bit of refactoring. Ideally, we do this in smaller steps so PRs are easier to review. On top of that, this work is fairly low priority.
Ideally at some point we do introduce lifetime tracking so that
createBufferWithDatabecomes even easier to use since the caller won't have to care about keeping the upload buffer alive.