diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /gfx/wgpu_bindings | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/wgpu_bindings')
-rw-r--r-- | gfx/wgpu_bindings/Cargo.toml | 14 | ||||
-rw-r--r-- | gfx/wgpu_bindings/moz.yaml | 4 | ||||
-rw-r--r-- | gfx/wgpu_bindings/src/client.rs | 175 | ||||
-rw-r--r-- | gfx/wgpu_bindings/src/server.rs | 41 |
4 files changed, 205 insertions, 29 deletions
diff --git a/gfx/wgpu_bindings/Cargo.toml b/gfx/wgpu_bindings/Cargo.toml index 21b4b8c7f7..d22253deed 100644 --- a/gfx/wgpu_bindings/Cargo.toml +++ b/gfx/wgpu_bindings/Cargo.toml @@ -17,7 +17,7 @@ default = [] [dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "6040820099bc72b827a6a5f53d66dda3e301f944" +rev = "0c5bebca514eb06d9387f87666c1c658f3f673b4" # TODO: remove the replay feature on the next update containing https://github.com/gfx-rs/wgpu/pull/5182 features = ["serde", "replay", "trace", "strict_asserts", "wgsl", "api_log_info"] @@ -26,37 +26,37 @@ features = ["serde", "replay", "trace", "strict_asserts", "wgsl", "api_log_info" [target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "6040820099bc72b827a6a5f53d66dda3e301f944" +rev = "0c5bebca514eb06d9387f87666c1c658f3f673b4" features = ["metal"] # We want the wgpu-core Direct3D backends on Windows. [target.'cfg(windows)'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "6040820099bc72b827a6a5f53d66dda3e301f944" +rev = "0c5bebca514eb06d9387f87666c1c658f3f673b4" features = ["dx12"] # We want the wgpu-core Vulkan backend on Linux and Windows. [target.'cfg(any(windows, all(unix, not(any(target_os = "macos", target_os = "ios")))))'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "6040820099bc72b827a6a5f53d66dda3e301f944" +rev = "0c5bebca514eb06d9387f87666c1c658f3f673b4" features = ["vulkan"] [dependencies.wgt] package = "wgpu-types" git = "https://github.com/gfx-rs/wgpu" -rev = "6040820099bc72b827a6a5f53d66dda3e301f944" +rev = "0c5bebca514eb06d9387f87666c1c658f3f673b4" [dependencies.wgh] package = "wgpu-hal" git = "https://github.com/gfx-rs/wgpu" -rev = "6040820099bc72b827a6a5f53d66dda3e301f944" +rev = "0c5bebca514eb06d9387f87666c1c658f3f673b4" features = ["windows_rs"] [target.'cfg(windows)'.dependencies.d3d12] git = "https://github.com/gfx-rs/wgpu" -rev = "6040820099bc72b827a6a5f53d66dda3e301f944" +rev = "0c5bebca514eb06d9387f87666c1c658f3f673b4" [target.'cfg(windows)'.dependencies] winapi = "0.3" diff --git a/gfx/wgpu_bindings/moz.yaml b/gfx/wgpu_bindings/moz.yaml index ffa746cb46..2f688461b7 100644 --- a/gfx/wgpu_bindings/moz.yaml +++ b/gfx/wgpu_bindings/moz.yaml @@ -20,11 +20,11 @@ origin: # Human-readable identifier for this version/release # Generally "version NNN", "tag SSS", "bookmark SSS" - release: 6040820099bc72b827a6a5f53d66dda3e301f944 (2024-03-12T14:49:44Z). + release: 0c5bebca514eb06d9387f87666c1c658f3f673b4 (2024-04-02T20:12:28Z). # Revision to pull in # Must be a long or short commit SHA (long preferred) - revision: 6040820099bc72b827a6a5f53d66dda3e301f944 + revision: 0c5bebca514eb06d9387f87666c1c658f3f673b4 license: ['MIT', 'Apache-2.0'] diff --git a/gfx/wgpu_bindings/src/client.rs b/gfx/wgpu_bindings/src/client.rs index c49dbea7a5..ae1a5ef5ea 100644 --- a/gfx/wgpu_bindings/src/client.rs +++ b/gfx/wgpu_bindings/src/client.rs @@ -525,6 +525,20 @@ pub extern "C" fn wgpu_client_make_buffer_id( } #[no_mangle] +pub extern "C" fn wgpu_client_free_buffer_id( + client: &Client, + id: id::BufferId, +) { + let backend = id.backend(); + client + .identities + .lock() + .select(backend) + .buffers + .free(id) +} + +#[no_mangle] pub extern "C" fn wgpu_client_create_texture( client: &Client, device_id: id::DeviceId, @@ -555,6 +569,21 @@ pub extern "C" fn wgpu_client_create_texture( } #[no_mangle] +pub extern "C" fn wgpu_client_free_texture_id( + client: &Client, + id: id::TextureId, +) { + let backend = id.backend(); + client + .identities + .lock() + .select(backend) + .textures + .free(id) +} + + +#[no_mangle] pub extern "C" fn wgpu_client_create_texture_view( client: &Client, device_id: id::DeviceId, @@ -590,6 +619,20 @@ pub extern "C" fn wgpu_client_create_texture_view( } #[no_mangle] +pub extern "C" fn wgpu_client_free_texture_view_id( + client: &Client, + id: id::TextureViewId, +) { + let backend = id.backend(); + client + .identities + .lock() + .select(backend) + .texture_views + .free(id) +} + +#[no_mangle] pub extern "C" fn wgpu_client_create_sampler( client: &Client, device_id: id::DeviceId, @@ -624,6 +667,20 @@ pub extern "C" fn wgpu_client_create_sampler( } #[no_mangle] +pub extern "C" fn wgpu_client_free_sampler_id( + client: &Client, + id: id::SamplerId, +) { + let backend = id.backend(); + client + .identities + .lock() + .select(backend) + .samplers + .free(id) +} + +#[no_mangle] pub extern "C" fn wgpu_client_make_encoder_id( client: &Client, device_id: id::DeviceId, @@ -639,6 +696,21 @@ pub extern "C" fn wgpu_client_make_encoder_id( } #[no_mangle] +pub extern "C" fn wgpu_client_free_command_encoder_id( + client: &Client, + id: id::CommandEncoderId, +) { + let backend = id.backend(); + client + .identities + .lock() + .select(backend) + .command_buffers + .free(id.transmute()) +} + + +#[no_mangle] pub extern "C" fn wgpu_client_create_command_encoder( client: &Client, device_id: id::DeviceId, @@ -700,6 +772,7 @@ pub extern "C" fn wgpu_device_create_render_bundle_encoder( } } + #[no_mangle] pub unsafe extern "C" fn wgpu_render_bundle_encoder_destroy( pass: *mut wgc::command::RenderBundleEncoder, @@ -755,6 +828,20 @@ pub unsafe extern "C" fn wgpu_client_create_render_bundle_error( id } +#[no_mangle] +pub extern "C" fn wgpu_client_free_render_bundle_id( + client: &Client, + id: id::RenderBundleId, +) { + let backend = id.backend(); + client + .identities + .lock() + .select(backend) + .render_bundles + .free(id) +} + #[repr(C)] pub struct ComputePassDescriptor<'a> { pub label: Option<&'a nsACString>, @@ -986,6 +1073,20 @@ pub unsafe extern "C" fn wgpu_client_create_bind_group_layout( } #[no_mangle] +pub extern "C" fn wgpu_client_free_bind_group_layout_id( + client: &Client, + id: id::BindGroupLayoutId, +) { + let backend = id.backend(); + client + .identities + .lock() + .select(backend) + .bind_group_layouts + .free(id) +} + +#[no_mangle] pub unsafe extern "C" fn wgpu_client_render_pipeline_get_bind_group_layout( client: &Client, pipeline_id: id::RenderPipelineId, @@ -1059,6 +1160,20 @@ pub unsafe extern "C" fn wgpu_client_create_pipeline_layout( } #[no_mangle] +pub extern "C" fn wgpu_client_free_pipeline_layout_id( + client: &Client, + id: id::PipelineLayoutId, +) { + let backend = id.backend(); + client + .identities + .lock() + .select(backend) + .pipeline_layouts + .free(id) +} + +#[no_mangle] pub unsafe extern "C" fn wgpu_client_create_bind_group( client: &Client, device_id: id::DeviceId, @@ -1106,6 +1221,20 @@ pub unsafe extern "C" fn wgpu_client_create_bind_group( } #[no_mangle] +pub extern "C" fn wgpu_client_free_bind_group_id( + client: &Client, + id: id::BindGroupId, +) { + let backend = id.backend(); + client + .identities + .lock() + .select(backend) + .bind_groups + .free(id) +} + +#[no_mangle] pub extern "C" fn wgpu_client_make_shader_module_id( client: &Client, device_id: id::DeviceId, @@ -1120,6 +1249,20 @@ pub extern "C" fn wgpu_client_make_shader_module_id( } #[no_mangle] +pub extern "C" fn wgpu_client_free_shader_module_id( + client: &Client, + id: id::ShaderModuleId, +) { + let backend = id.backend(); + client + .identities + .lock() + .select(backend) + .shader_modules + .free(id) +} + +#[no_mangle] pub unsafe extern "C" fn wgpu_client_create_compute_pipeline( client: &Client, device_id: id::DeviceId, @@ -1161,6 +1304,20 @@ pub unsafe extern "C" fn wgpu_client_create_compute_pipeline( } #[no_mangle] +pub extern "C" fn wgpu_client_free_compute_pipeline_id( + client: &Client, + id: id::ComputePipelineId, +) { + let backend = id.backend(); + client + .identities + .lock() + .select(backend) + .compute_pipelines + .free(id) +} + +#[no_mangle] pub unsafe extern "C" fn wgpu_client_create_render_pipeline( client: &Client, device_id: id::DeviceId, @@ -1204,6 +1361,20 @@ pub unsafe extern "C" fn wgpu_client_create_render_pipeline( } #[no_mangle] +pub extern "C" fn wgpu_client_free_render_pipeline_id( + client: &Client, + id: id::RenderPipelineId, +) { + let backend = id.backend(); + client + .identities + .lock() + .select(backend) + .render_pipelines + .free(id) +} + +#[no_mangle] pub unsafe extern "C" fn wgpu_command_encoder_copy_buffer_to_buffer( src: id::BufferId, src_offset: wgt::BufferAddress, @@ -1346,10 +1517,6 @@ pub extern "C" fn wgpu_client_use_external_texture_in_swapChain( return false; } - if !static_prefs::pref!("dom.webgpu.swap-chain.external-texture-dx12") { - return false; - } - let supported = match format { wgt::TextureFormat::Bgra8Unorm => true, _ => false, diff --git a/gfx/wgpu_bindings/src/server.rs b/gfx/wgpu_bindings/src/server.rs index 8417fe84fb..1cedf35ea5 100644 --- a/gfx/wgpu_bindings/src/server.rs +++ b/gfx/wgpu_bindings/src/server.rs @@ -337,29 +337,38 @@ impl ShaderModuleCompilationMessage { fn set_error(&mut self, error: &CreateShaderModuleError, source: &str) { // The WebGPU spec says that if the message doesn't point to a particular position in // the source, the line number, position, offset and lengths should be zero. - self.line_number = 0; - self.line_pos = 0; - self.utf16_offset = 0; - self.utf16_length = 0; + let line_number; + let line_pos; + let utf16_offset; + let utf16_length; if let Some(location) = error.location(source) { - self.line_number = location.line_number as u64; - self.line_pos = location.line_position as u64; - + let len_utf16 = |s: &str| s.chars().map(|c| c.len_utf16() as u64).sum(); let start = location.offset as usize; let end = start + location.length as usize; - self.utf16_offset = source[0..start].chars().map(|c| c.len_utf16() as u64).sum(); - self.utf16_length = source[start..end] - .chars() - .map(|c| c.len_utf16() as u64) - .sum(); + utf16_offset = len_utf16(&source[0..start]); + utf16_length = len_utf16(&source[start..end]); + + line_number = location.line_number as u64; + // Naga reports a `line_pos` using UTF-8 bytes, so we cannot use it. + let line_start = source[0..start].rfind('\n').map(|pos| pos + 1).unwrap_or(0); + line_pos = len_utf16(&source[line_start..start]) + 1; + } else { + line_number = 0; + line_pos = 0; + utf16_offset = 0; + utf16_length = 0; } - let error_string = error.to_string(); + let message = nsString::from(&error.to_string()); - if !error_string.is_empty() { - self.message = nsString::from(&error_string[..]); - } + *self = Self { + line_number, + line_pos, + utf16_offset, + utf16_length, + message, + }; } } |