Skip to content

Commit

Permalink
[rs] Merge gfx-rs#30
Browse files Browse the repository at this point in the history
30: Add Pod trait bound for all BufferMapAsyncResult data r=kvark a=paulkernfeld



Co-authored-by: Paul Kernfeld <paulkernfeld@gmail.com>
  • Loading branch information
bors[bot] and Paul Kernfeld committed Jun 24, 2019
2 parents 4e33716 + d93bc7b commit a70eab2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub use wgn::{
Limits,
LoadOp,
Origin3d,
Pod,
PowerPreference,
PrimitiveTopology,
RasterizationStateDescriptor,
Expand Down Expand Up @@ -809,6 +810,7 @@ impl<T> Drop for BufferAsyncMapping<T> {

struct BufferMapReadAsyncUserData<T, F>
where
T: Pod,
F: FnOnce(BufferMapAsyncResult<&[T]>),
{
size: BufferAddress,
Expand All @@ -819,6 +821,7 @@ where

struct BufferMapWriteAsyncUserData<T, F>
where
T: Pod,
F: FnOnce(BufferMapAsyncResult<&mut [T]>),
{
size: BufferAddress,
Expand All @@ -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;
Expand All @@ -842,6 +845,7 @@ impl Buffer {
data: *const u8,
user_data: *mut u8,
) where
T: Pod,
F: FnOnce(BufferMapAsyncResult<&[T]>),
{
let user_data =
Expand Down Expand Up @@ -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;
Expand All @@ -891,6 +895,7 @@ impl Buffer {
data: *mut u8,
user_data: *mut u8,
) where
T: Pod,
F: FnOnce(BufferMapAsyncResult<&mut [T]>),
{
let user_data =
Expand Down

0 comments on commit a70eab2

Please sign in to comment.