-
Notifications
You must be signed in to change notification settings - Fork 179
Use u8 for buffer mapping #127
Conversation
|
You're on your own for testing |
That deserves a separate bug, it's not expected! |
kvark
left a comment
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.
This is great, thank you! I only have one naming suggestion
| F: FnOnce(BufferMapAsyncResult<&[u8]>), | ||
| { | ||
| size: BufferAddress, | ||
| size: usize, |
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.
why is this type changed?
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.
To get rid of this:
Line 925 in a5921da
| slice::from_raw_parts(data as *const u8, usize::try_from(user_data.size).unwrap()) |
BufferMapXxxAsyncUserData is only used to pass info to the C callback in the respective map_xxx_async, and the input to those functions is already a usize. The current code converts to BufferAddress and back to usize.
fc146bc to
0227c08
Compare
|
Bors r+
… On Nov 21, 2019, at 20:36, Jacob Greenfield ***@***.***> wrote:
@Coder-256 commented on this pull request.
In src/lib.rs:
>
CreateBufferMapped { id, data }
}
+ /// Creates a new buffer, maps it into host-visible memory, copies data from the given slice,
+ /// and finally unmaps it, returning a [`Buffer`].
+ pub fn create_buffer_mapped_from(&self, data: &[u8], usage: BufferUsage) -> Buffer {
Done.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Build succeeded |
cc @kvark @grovesNL
This is a temporary solution for #119, and a follow-up for #126.