mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-22 07:21:04 +01:00
Fix initializing buffer with unaligned data
In wgpu 0.7, this was a valid operation, the zero padding was done by hand. However in #872 this was removed as an optimization since buffers are zero padded, however the slice end was taken from buffer.slice which has to be aligned when mapped.
This commit is contained in:
1 parent
c5443c7f55
commit
fb442bfa26
1 file changed
+1
-3
+1
-3
@@ -65,9 +65,7 @@ impl DeviceExt for crate::Device {
|
||||
|
||||
let buffer = self.create_buffer(&wgt_descriptor);
|
||||
|
||||
buffer
|
||||
.slice(..unpadded_size)
|
||||
.get_mapped_range_mut()
|
||||
buffer.slice(..).get_mapped_range_mut()[..unpadded_size as usize]
|
||||
.copy_from_slice(descriptor.contents);
|
||||
buffer.unmap();
|
||||
|
||||
|
||||
Reference in new issue
Block a user