[rs] Add Pod trait bound for all BufferMapAsyncResult data

This commit is contained in:
Paul Kernfeld 2019-06-23 20:53:29 -04:00
parent 2dd0b43e7e
commit d93bc7b362
2 changed files with 8 additions and 3 deletions

View File

@ -24,7 +24,7 @@ gl = ["wgn/gfx-backend-gl"]
[dependencies]
#TODO: only depend on the published version
wgn = { package = "wgpu-native", version = "0.2.6", features = ["local", "window-winit"], git = "https://github.com/gfx-rs/wgpu", rev = "a667d50d01c3df03b8540c523278e111da7fc82a" }
wgn = { package = "wgpu-native", version = "0.2.6", features = ["local", "window-winit"], git = "https://github.com/gfx-rs/wgpu", rev = "dbef9f397eda87b82ae1691b2f7e8ba0f3e2e5d2" }
arrayvec = "0.4"
[dev-dependencies]

View File

@ -37,6 +37,7 @@ pub use wgn::{
Limits,
LoadOp,
Origin3d,
Pod,
PowerPreference,
PrimitiveTopology,
RasterizationStateDescriptor,
@ -809,6 +810,7 @@ impl<T> Drop for BufferAsyncMapping<T> {
struct BufferMapReadAsyncUserData<T, F>
where
T: Pod,
F: FnOnce(BufferMapAsyncResult<&[T]>),
{
size: BufferAddress,
@ -819,6 +821,7 @@ where
struct BufferMapWriteAsyncUserData<T, F>
where
T: Pod,
F: FnOnce(BufferMapAsyncResult<&mut [T]>),
{
size: BufferAddress,
@ -830,7 +833,7 @@ where
impl Buffer {
pub fn map_read_async<T, F>(&self, start: BufferAddress, size: BufferAddress, callback: F)
where
T: 'static + Copy,
T: 'static + Pod,
F: FnOnce(BufferMapAsyncResult<&[T]>) + 'static,
{
let type_size = std::mem::size_of::<T>() as BufferAddress;
@ -842,6 +845,7 @@ impl Buffer {
data: *const u8,
user_data: *mut u8,
) where
T: Pod,
F: FnOnce(BufferMapAsyncResult<&[T]>),
{
let user_data =
@ -879,7 +883,7 @@ impl Buffer {
pub fn map_write_async<T, F>(&self, start: BufferAddress, size: BufferAddress, callback: F)
where
T: 'static + Copy,
T: 'static + Pod,
F: FnOnce(BufferMapAsyncResult<&mut [T]>) + 'static,
{
let type_size = std::mem::size_of::<T>() as BufferAddress;
@ -891,6 +895,7 @@ impl Buffer {
data: *mut u8,
user_data: *mut u8,
) where
T: Pod,
F: FnOnce(BufferMapAsyncResult<&mut [T]>),
{
let user_data =