-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Unify all buffer types #2127
Merged
Merged
Unify all buffer types #2127
Conversation
This file contains 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
Rua
reviewed
Jan 7, 2023
It's ready. I wish the Discord bot would pick up on this. |
hakolao
pushed a commit
to hakolao/vulkano
that referenced
this pull request
Feb 20, 2024
* `CpuBufferPool` revamp * Fix oopsie * Fix docs * Add `Subbuffer` * Move `Buffer` to `buffer` module * Replace all buffer types with `Subbuffer` * Add constraints to `Index` and `QueryResultElement` traits * Fix oopsies * Fix examples * Fix doc tests * Rename `_unsized` to `_slice` * Rename `CpuBufferAllocator` * Implement `DeviceOwned` for `SubbufferAllocator` * Use better generic type params * Fix requirement message * Fix docs * Fix missing buffer alignment for texel buffer usage * Add more docs to `Subbuffer` * Add more utility functions to `Subbuffer` * Remove superfluous `dst_offset`s * Murder `FillBufferInfo` * Fix example * Add `Subbuffer::range` * Fix wrong atom size alignment check * Specify all fields in create infos derived from `BufferAllocateInfo`
hakolao
pushed a commit
to hakolao/vulkano
that referenced
this pull request
Feb 20, 2024
# for free
to join this conversation on GitHub.
Already have an account?
# 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.
This PR aims to unify the types
CpuAccessibleBuffer
,DeviceLocalBuffer
,BufferSlice
andCpuSubbuffer
(formerly two types,CpuBufferPoolSubbuffer
andCpuBufferPoolChunk
) into one:Subbuffer
.What this solves is the need for boxed trait objects, which can be detrimental to performance and might make the API harder to understand for newcommers. Another thing is that with the functionality spread like it is, some might not even be aware of what they can do. For example
BufferSlice
, was until now not that visible. With everything being in once place, people can discover things more easily. Another issue was that when slicing/indexing a buffer, since all the APIs expect anArc<dyn BufferAccess>
, you have to box everyBufferSlice
, which includes slices of slices, and would lead to a chain ofArc
s as long as the number of slicings. That's a bummer because ideally all that needs to change is an offset and size in the existing one.Another benefit of having only one type for buffers is type complexity: the
BufferAccess
,TypedBufferAccess
andBufferAccessObject
traits are gone and so are all the generics and trait bounds associated with them. Also,BufferView
no longer has a generic type parameter and theBufferViewAbstract
trait is also gone. I think this makes the API more approachable.This PR also addresses the long-standing issue of the (then)
CpuBufferPool
only working for download. The (now)SubbufferAllocator
can allocate subbuffers for any purpose.Fixes #867, fixes #962, fixes #1281, fixes #1733, fixes #2126.
Changelog: