From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- gfx/wgpu_bindings/src/client.rs | 175 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 171 insertions(+), 4 deletions(-) (limited to 'gfx/wgpu_bindings/src/client.rs') 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 @@ -524,6 +524,20 @@ pub extern "C" fn wgpu_client_make_buffer_id( .process(backend) } +#[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, @@ -554,6 +568,21 @@ pub extern "C" fn wgpu_client_create_texture( id } +#[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, @@ -589,6 +618,20 @@ pub extern "C" fn wgpu_client_create_texture_view( id } +#[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, @@ -623,6 +666,20 @@ pub extern "C" fn wgpu_client_create_sampler( id } +#[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, @@ -638,6 +695,21 @@ pub extern "C" fn wgpu_client_make_encoder_id( .transmute() } +#[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, @@ -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>, @@ -985,6 +1072,20 @@ pub unsafe extern "C" fn wgpu_client_create_bind_group_layout( id } +#[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, @@ -1058,6 +1159,20 @@ pub unsafe extern "C" fn wgpu_client_create_pipeline_layout( id } +#[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, @@ -1105,6 +1220,20 @@ pub unsafe extern "C" fn wgpu_client_create_bind_group( id } +#[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, @@ -1119,6 +1248,20 @@ pub extern "C" fn wgpu_client_make_shader_module_id( .process(backend) } +#[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, @@ -1160,6 +1303,20 @@ pub unsafe extern "C" fn wgpu_client_create_compute_pipeline( id } +#[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, @@ -1203,6 +1360,20 @@ pub unsafe extern "C" fn wgpu_client_create_render_pipeline( id } +#[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, @@ -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, -- cgit v1.2.3