aboutsummaryrefslogtreecommitdiffstats
path: root/components/webgpu/ipc_messages
diff options
context:
space:
mode:
authorSamson <16504129+sagudev@users.noreply.github.com>2024-08-27 09:54:55 +0200
committerGitHub <noreply@github.com>2024-08-27 07:54:55 +0000
commit7fce24f9d54a015db7ee813fc16c74d2feacbb12 (patch)
treee344ef00f1f1b99b59158b789c064fda52b495b6 /components/webgpu/ipc_messages
parentbb5926b3291877fb47d44ea376881c2d52701bbf (diff)
downloadservo-7fce24f9d54a015db7ee813fc16c74d2feacbb12.tar.gz
servo-7fce24f9d54a015db7ee813fc16c74d2feacbb12.zip
webgpu: Sync `GPUBuffer` (#33154)
* More helpers on `Promise` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Sync `GPUBuffer` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Set some good expectations Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Some bad expect also on firefox Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Extract DataBlock, DataView impl from GPUBuffer Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Fix size check to work on 32bit platforms Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Diffstat (limited to 'components/webgpu/ipc_messages')
-rw-r--r--components/webgpu/ipc_messages/recv.rs3
-rw-r--r--components/webgpu/ipc_messages/to_dom.rs12
2 files changed, 12 insertions, 3 deletions
diff --git a/components/webgpu/ipc_messages/recv.rs b/components/webgpu/ipc_messages/recv.rs
index b38856c851b..6e89806792b 100644
--- a/components/webgpu/ipc_messages/recv.rs
+++ b/components/webgpu/ipc_messages/recv.rs
@@ -267,9 +267,8 @@ pub enum WebGPURequest {
},
UnmapBuffer {
buffer_id: id::BufferId,
- device_id: id::DeviceId,
array_buffer: IpcSharedMemory,
- is_map_read: bool,
+ write_back: bool,
offset: u64,
size: u64,
},
diff --git a/components/webgpu/ipc_messages/to_dom.rs b/components/webgpu/ipc_messages/to_dom.rs
index b38e21c3038..8525a46d78c 100644
--- a/components/webgpu/ipc_messages/to_dom.rs
+++ b/components/webgpu/ipc_messages/to_dom.rs
@@ -4,10 +4,13 @@
//! IPC messages that are send to WebGPU DOM objects.
+use std::ops::Range;
+
use ipc_channel::ipc::IpcSharedMemory;
use serde::{Deserialize, Serialize};
use wgc::id;
use wgc::pipeline::CreateShaderModuleError;
+use wgpu_core::device::HostMap;
use wgpu_core::instance::{RequestAdapterError, RequestDeviceError};
use wgpu_core::resource::BufferAccessError;
pub use {wgpu_core as wgc, wgpu_types as wgt};
@@ -73,6 +76,13 @@ pub struct Pipeline<T: std::fmt::Debug + Serialize> {
}
#[derive(Debug, Deserialize, Serialize)]
+pub struct Mapping {
+ pub data: IpcSharedMemory,
+ pub mode: HostMap,
+ pub range: Range<u64>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
#[allow(clippy::large_enum_variant)]
pub enum WebGPUResponse {
/// WebGPU is disabled
@@ -85,7 +95,7 @@ pub enum WebGPUResponse {
Result<wgt::DeviceDescriptor<Option<String>>, RequestDeviceError>,
),
),
- BufferMapAsync(Result<IpcSharedMemory, BufferAccessError>),
+ BufferMapAsync(Result<Mapping, BufferAccessError>),
SubmittedWorkDone,
PoppedErrorScope(Result<Option<Error>, PopError>),
CompilationInfo(Option<ShaderCompilationInfo>),