From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- gfx/wgpu_bindings/src/server.rs | 47 ++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 8 deletions(-) (limited to 'gfx/wgpu_bindings/src/server.rs') 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::>(device_id, |hal_device| { - hal_device.map(|device| device.raw_device().clone()) - }) + global.device_as_hal::>( + 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::>(device_id, |hal_fence| { - hal_fence.map(|fence| fence.raw_fence().clone()) - }) + global.device_fence_as_hal::>( + device_id, + |hal_fence| hal_fence.map(|fence| fence.raw_fence().clone()), + ) }; let dx12_fence = match dx12_fence { Some(fence) => fence, @@ -1053,6 +1058,32 @@ pub unsafe extern "C" fn wgpu_server_command_encoder_action( gfx_select!(self_id => global.command_encoder_action(self_id, action, error_buf)); } +#[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, -- cgit v1.2.3