diff options
author | Samson <16504129+sagudev@users.noreply.github.com> | 2024-08-08 09:53:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-08 07:53:17 +0000 |
commit | f989d3776eca7c4a21f03a406a11c1b1228b285e (patch) | |
tree | a5beb95a358c52c9fbfb0e43518fdcb6e6e599fd /components/script/dom/identityhub.rs | |
parent | a5df51ea56dd7116b5fb95acd9c88f123bdebbfc (diff) | |
download | servo-f989d3776eca7c4a21f03a406a11c1b1228b285e.tar.gz servo-f989d3776eca7c4a21f03a406a11c1b1228b285e.zip |
separate Queue&Device Id (#32966)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Diffstat (limited to 'components/script/dom/identityhub.rs')
-rw-r--r-- | components/script/dom/identityhub.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/components/script/dom/identityhub.rs b/components/script/dom/identityhub.rs index 1ab8d84bb3d..63aca9935c9 100644 --- a/components/script/dom/identityhub.rs +++ b/components/script/dom/identityhub.rs @@ -6,12 +6,13 @@ use smallvec::SmallVec; use webgpu::identity::{ComputePass, ComputePassId, RenderPass, RenderPassId}; use webgpu::wgc::id::markers::{ Adapter, BindGroup, BindGroupLayout, Buffer, CommandEncoder, ComputePipeline, Device, - PipelineLayout, RenderBundle, RenderPipeline, Sampler, ShaderModule, Texture, TextureView, + PipelineLayout, Queue, RenderBundle, RenderPipeline, Sampler, ShaderModule, Texture, + TextureView, }; use webgpu::wgc::id::{ AdapterId, BindGroupId, BindGroupLayoutId, BufferId, CommandEncoderId, ComputePipelineId, - DeviceId, PipelineLayoutId, RenderBundleId, RenderPipelineId, SamplerId, ShaderModuleId, - TextureId, TextureViewId, + DeviceId, PipelineLayoutId, QueueId, RenderBundleId, RenderPipelineId, SamplerId, + ShaderModuleId, TextureId, TextureViewId, }; use webgpu::wgc::identity::IdentityManager; use webgpu::wgt::Backend; @@ -20,6 +21,7 @@ use webgpu::wgt::Backend; pub struct IdentityHub { adapters: IdentityManager<Adapter>, devices: IdentityManager<Device>, + queues: IdentityManager<Queue>, buffers: IdentityManager<Buffer>, bind_groups: IdentityManager<BindGroup>, bind_group_layouts: IdentityManager<BindGroupLayout>, @@ -41,6 +43,7 @@ impl IdentityHub { IdentityHub { adapters: IdentityManager::new(), devices: IdentityManager::new(), + queues: IdentityManager::new(), buffers: IdentityManager::new(), bind_groups: IdentityManager::new(), bind_group_layouts: IdentityManager::new(), @@ -123,6 +126,14 @@ impl Identities { self.select(id.backend()).devices.free(id); } + pub fn create_queue_id(&self, backend: Backend) -> QueueId { + self.select(backend).queues.process(backend) + } + + pub fn free_queue_id(&self, id: QueueId) { + self.select(id.backend()).queues.free(id); + } + pub fn create_adapter_ids(&self) -> SmallVec<[AdapterId; 4]> { let mut ids = SmallVec::new(); for hubs in self.hubs() { |