-
previously using this worked. let buffer_slice = self.output_buffer.slice(..);
let buffer_future = buffer_slice.map_async(wgpu::MapMode::Read);
self.device.poll(wgpu::Maintain::Wait);
if futures::executor::block_on(buffer_future).is_ok() {
let padded_buffer = buffer_slice.get_mapped_range();
todo!();
}
output_buffer.unmap(); with i tried this: let buffer_slice = self.output_buffer.slice(..);
buffer_slice.map_async(wgpu::MapMode::Read, |_| ());
self.device.poll(wgpu::Maintain::Wait);
// if futures::executor::block_on(buffer_future).is_ok() {
let padded_buffer = buffer_slice.get_mapped_range();
todo!();
output_buffer.unmap(); i got error
|
Beta Was this translation helpful? Give feedback.
Answered by
sak96
Mar 1, 2023
Replies: 1 comment
-
adding padded_buffer to scope seems to have fixed issue but not sure if that is really a fix. let buffer_slice = self.output_buffer.slice(..);
let (tx, rx) = channel::oneshot::channel();
buffer_slice.map_async(wgpu::MapMode::Read, move |result| {
tx.send(result).unwrap();
});
self.device.poll(wgpu::Maintain::Wait);
if block_on(async {rx.await}).is_ok() {
let padded_buffer = buffer_slice.get_mapped_range();
todo!();
}
output_buffer.unmap(); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
sak96
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
adding padded_buffer to scope seems to have fixed issue but not sure if that is really a fix.