aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/identityhub.rs
diff options
context:
space:
mode:
authorKunal Mohan <kunalmohan99@gmail.com>2020-05-22 17:49:35 +0530
committerKunal Mohan <kunalmohan99@gmail.com>2020-05-22 21:22:19 +0530
commit39f336b5278fc2c4ab25da508245e8eb86aa9b33 (patch)
treed8939d2b5ae9a3d918148fe1e4dc4afda3f94a54 /components/script/dom/identityhub.rs
parent94063d67a8fb1f4a9f776771aba9eb8a2b3bd3bd (diff)
downloadservo-39f336b5278fc2c4ab25da508245e8eb86aa9b33.tar.gz
servo-39f336b5278fc2c4ab25da508245e8eb86aa9b33.zip
Implement client-side logic for WebGPU id recycling
Diffstat (limited to 'components/script/dom/identityhub.rs')
-rw-r--r--components/script/dom/identityhub.rs38
1 files changed, 37 insertions, 1 deletions
diff --git a/components/script/dom/identityhub.rs b/components/script/dom/identityhub.rs
index 809a68e37ea..880d8e0b5f4 100644
--- a/components/script/dom/identityhub.rs
+++ b/components/script/dom/identityhub.rs
@@ -74,7 +74,7 @@ impl IdentityHub {
self.shader_modules.alloc(self.backend)
}
- pub fn create_command_encoder_id(&mut self) -> CommandEncoderId {
+ fn create_command_encoder_id(&mut self) -> CommandEncoderId {
self.command_encoders.alloc(self.backend)
}
}
@@ -141,6 +141,10 @@ impl Identities {
self.select(backend).create_device_id()
}
+ pub fn kill_device_id(&mut self, id: DeviceId) {
+ self.select(id.backend()).devices.free(id);
+ }
+
pub fn create_adapter_ids(&mut self) -> SmallVec<[AdapterId; 4]> {
let mut ids = SmallVec::new();
for hub in self.hubs() {
@@ -149,31 +153,63 @@ impl Identities {
ids
}
+ pub fn kill_adapter_id(&mut self, id: AdapterId) {
+ self.select(id.backend()).adapters.free(id);
+ }
+
pub fn create_buffer_id(&mut self, backend: Backend) -> BufferId {
self.select(backend).create_buffer_id()
}
+ pub fn kill_buffer_id(&mut self, id: BufferId) {
+ self.select(id.backend()).buffers.free(id);
+ }
+
pub fn create_bind_group_id(&mut self, backend: Backend) -> BindGroupId {
self.select(backend).create_bind_group_id()
}
+ pub fn kill_bind_group_id(&mut self, id: BindGroupId) {
+ self.select(id.backend()).bind_groups.free(id);
+ }
+
pub fn create_bind_group_layout_id(&mut self, backend: Backend) -> BindGroupLayoutId {
self.select(backend).create_bind_group_layout_id()
}
+ pub fn kill_bind_group_layout_id(&mut self, id: BindGroupLayoutId) {
+ self.select(id.backend()).bind_group_layouts.free(id);
+ }
+
pub fn create_compute_pipeline_id(&mut self, backend: Backend) -> ComputePipelineId {
self.select(backend).create_compute_pipeline_id()
}
+ pub fn kill_compute_pipeline_id(&mut self, id: ComputePipelineId) {
+ self.select(id.backend()).compute_pipelines.free(id);
+ }
+
pub fn create_pipeline_layout_id(&mut self, backend: Backend) -> PipelineLayoutId {
self.select(backend).create_pipeline_layout_id()
}
+ pub fn kill_pipeline_layout_id(&mut self, id: PipelineLayoutId) {
+ self.select(id.backend()).pipeline_layouts.free(id);
+ }
+
pub fn create_shader_module_id(&mut self, backend: Backend) -> ShaderModuleId {
self.select(backend).create_shader_module_id()
}
+ pub fn kill_shader_module_id(&mut self, id: ShaderModuleId) {
+ self.select(id.backend()).shader_modules.free(id);
+ }
+
pub fn create_command_encoder_id(&mut self, backend: Backend) -> CommandEncoderId {
self.select(backend).create_command_encoder_id()
}
+
+ pub fn kill_command_buffer_id(&mut self, id: CommandEncoderId) {
+ self.select(id.backend()).command_encoders.free(id);
+ }
}