summaryrefslogtreecommitdiffstats
path: root/gfx/wgpu_bindings/src/client.rs
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/wgpu_bindings/src/client.rs')
-rw-r--r--gfx/wgpu_bindings/src/client.rs175
1 files changed, 171 insertions, 4 deletions
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,