summaryrefslogtreecommitdiffstats
path: root/gfx/wgpu_bindings/src/server.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /gfx/wgpu_bindings/src/server.rs
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz
firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/wgpu_bindings/src/server.rs')
-rw-r--r--gfx/wgpu_bindings/src/server.rs47
1 files changed, 39 insertions, 8 deletions
diff --git a/gfx/wgpu_bindings/src/server.rs b/gfx/wgpu_bindings/src/server.rs
index 7a7e08aa30..8417fe84fb 100644
--- a/gfx/wgpu_bindings/src/server.rs
+++ b/gfx/wgpu_bindings/src/server.rs
@@ -410,7 +410,9 @@ pub extern "C" fn wgpu_server_device_create_shader_module(
if let Some(err) = error {
out_message.set_error(&err, &source_str[..]);
let err_type = match &err {
- CreateShaderModuleError::Device(DeviceError::OutOfMemory) => ErrorBufferType::OutOfMemory,
+ CreateShaderModuleError::Device(DeviceError::OutOfMemory) => {
+ ErrorBufferType::OutOfMemory
+ }
CreateShaderModuleError::Device(DeviceError::Lost) => ErrorBufferType::DeviceLost,
_ => ErrorBufferType::Validation,
};
@@ -497,7 +499,8 @@ pub unsafe extern "C" fn wgpu_server_buffer_map(
// the returned value of buffer_map_async.
let result = gfx_select!(buffer_id => global.buffer_map_async(
buffer_id,
- start .. start + size,
+ start,
+ Some(size),
operation
));
@@ -580,9 +583,10 @@ pub extern "C" fn wgpu_server_get_device_fence_handle(
if device_id.backend() == wgt::Backend::Dx12 {
let mut handle = ptr::null_mut();
let dx12_device = unsafe {
- global.device_as_hal::<wgc::api::Dx12, _, Option<d3d12::Device>>(device_id, |hal_device| {
- hal_device.map(|device| device.raw_device().clone())
- })
+ global.device_as_hal::<wgc::api::Dx12, _, Option<d3d12::Device>>(
+ device_id,
+ |hal_device| hal_device.map(|device| device.raw_device().clone()),
+ )
};
let dx12_device = match dx12_device {
Some(device) => device,
@@ -592,9 +596,10 @@ pub extern "C" fn wgpu_server_get_device_fence_handle(
};
let dx12_fence = unsafe {
- global.device_fence_as_hal::<wgc::api::Dx12, _, Option<d3d12::Fence>>(device_id, |hal_fence| {
- hal_fence.map(|fence| fence.raw_fence().clone())
- })
+ global.device_fence_as_hal::<wgc::api::Dx12, _, Option<d3d12::Fence>>(
+ device_id,
+ |hal_fence| hal_fence.map(|fence| fence.raw_fence().clone()),
+ )
};
let dx12_fence = match dx12_fence {
Some(fence) => fence,
@@ -1054,6 +1059,32 @@ pub unsafe extern "C" fn wgpu_server_command_encoder_action(
}
#[no_mangle]
+pub unsafe extern "C" fn wgpu_server_render_pass(
+ global: &Global,
+ encoder_id: id::CommandEncoderId,
+ byte_buf: &ByteBuf,
+ error_buf: ErrorBuffer,
+) {
+ let pass = bincode::deserialize(byte_buf.as_slice()).unwrap();
+ let action = crate::command::replay_render_pass(encoder_id, &pass).into_command();
+
+ gfx_select!(encoder_id => global.command_encoder_action(encoder_id, action, error_buf));
+}
+
+#[no_mangle]
+pub unsafe extern "C" fn wgpu_server_compute_pass(
+ global: &Global,
+ encoder_id: id::CommandEncoderId,
+ byte_buf: &ByteBuf,
+ error_buf: ErrorBuffer,
+) {
+ let pass = bincode::deserialize(byte_buf.as_slice()).unwrap();
+ let action = crate::command::replay_compute_pass(encoder_id, &pass).into_command();
+
+ gfx_select!(encoder_id => global.command_encoder_action(encoder_id, action, error_buf));
+}
+
+#[no_mangle]
pub extern "C" fn wgpu_server_device_create_encoder(
global: &Global,
self_id: id::DeviceId,