summaryrefslogtreecommitdiff
path: root/ext/webgpu/src/buffer.rs
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2023-01-30 15:14:16 +0100
committerGitHub <noreply@github.com>2023-01-30 15:14:16 +0100
commit3035dee9f14402f57d42ff0b362152140b4dca13 (patch)
treeb9a3d3d36e368b3585970ffe00127c90e16b7a09 /ext/webgpu/src/buffer.rs
parent266915d5ce354fde12b20f8f5ceb5ffdfacb7983 (diff)
chore: update webgpu (#17534)
Diffstat (limited to 'ext/webgpu/src/buffer.rs')
-rw-r--r--ext/webgpu/src/buffer.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/ext/webgpu/src/buffer.rs b/ext/webgpu/src/buffer.rs
index a10642f33..58348129e 100644
--- a/ext/webgpu/src/buffer.rs
+++ b/ext/webgpu/src/buffer.rs
@@ -13,6 +13,7 @@ use std::cell::RefCell;
use std::convert::TryFrom;
use std::rc::Rc;
use std::time::Duration;
+use wgpu_core::resource::BufferAccessResult;
use super::error::DomExceptionOperationError;
use super::error::WebGpuResult;
@@ -57,7 +58,7 @@ pub fn op_webgpu_create_buffer(
gfx_put!(device => instance.device_create_buffer(
device,
&descriptor,
- std::marker::PhantomData
+ ()
) => state, WebGpuBuffer)
}
@@ -70,7 +71,7 @@ pub async fn op_webgpu_buffer_get_map_async(
offset: u64,
size: u64,
) -> Result<WebGpuResult, AnyError> {
- let (sender, receiver) = oneshot::channel::<Result<(), AnyError>>();
+ let (sender, receiver) = oneshot::channel::<BufferAccessResult>();
let device;
{
@@ -85,12 +86,7 @@ pub async fn op_webgpu_buffer_get_map_async(
device = device_resource.0;
let callback = Box::new(move |status| {
- sender
- .send(match status {
- wgpu_core::resource::BufferMapAsyncStatus::Success => Ok(()),
- _ => unreachable!(), // TODO
- })
- .unwrap();
+ sender.send(status).unwrap();
});
// TODO(lucacasonato): error handling
@@ -120,7 +116,8 @@ pub async fn op_webgpu_buffer_get_map_async(
{
let state = state.borrow();
let instance = state.borrow::<super::Instance>();
- gfx_select!(device => instance.device_poll(device, wgpu_types::Maintain::Wait)).unwrap();
+ gfx_select!(device => instance.device_poll(device, wgpu_types::Maintain::Wait))
+ .unwrap();
}
tokio::time::sleep(Duration::from_millis(10)).await;
}