diff options
author | Istvan Miklos <istvan.miklos@h-lab.eu> | 2020-01-15 12:16:32 +0100 |
---|---|---|
committer | Istvan Miklos <istvan.miklos@h-lab.eu> | 2020-01-21 14:47:38 +0100 |
commit | d33a4d29a0d8467531a3beb722dfdb3e15df12ae (patch) | |
tree | 43d722bb7cf730337ef875ee55b36757fca6a3ae /components/script/dom/identityhub.rs | |
parent | 0dccfd148a62807d1d962aaef5321f4ce6d9dbc9 (diff) | |
download | servo-d33a4d29a0d8467531a3beb722dfdb3e15df12ae.tar.gz servo-d33a4d29a0d8467531a3beb722dfdb3e15df12ae.zip |
Initial implementation of GPUPipelineLayout for WebGPU
Added WebIDL bindings for `GPUPipelineLayout`.
Implemented the createPipelineLayout function of `GPUDevice`.
Diffstat (limited to 'components/script/dom/identityhub.rs')
-rw-r--r-- | components/script/dom/identityhub.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/components/script/dom/identityhub.rs b/components/script/dom/identityhub.rs index 91543d2ea3f..91ead1acf0a 100644 --- a/components/script/dom/identityhub.rs +++ b/components/script/dom/identityhub.rs @@ -5,7 +5,7 @@ use smallvec::SmallVec; use webgpu::wgpu::{ hub::IdentityManager, - id::{AdapterId, BindGroupLayoutId, BufferId, DeviceId}, + id::{AdapterId, BindGroupLayoutId, BufferId, DeviceId, PipelineLayoutId}, Backend, }; @@ -15,6 +15,7 @@ pub struct IdentityHub { devices: IdentityManager, buffers: IdentityManager, bind_group_layouts: IdentityManager, + pipeline_layouts: IdentityManager, backend: Backend, } @@ -25,6 +26,7 @@ impl IdentityHub { devices: IdentityManager::default(), buffers: IdentityManager::default(), bind_group_layouts: IdentityManager::default(), + pipeline_layouts: IdentityManager::default(), backend, } } @@ -44,6 +46,10 @@ impl IdentityHub { fn create_bind_group_layout_id(&mut self) -> BindGroupLayoutId { self.bind_group_layouts.alloc(self.backend) } + + fn create_pipeline_layout_id(&mut self) -> PipelineLayoutId { + self.pipeline_layouts.alloc(self.backend) + } } #[derive(Debug)] @@ -139,4 +145,18 @@ impl Identities { _ => self.dummy_hub.create_bind_group_layout_id(), } } + + pub fn create_pipeline_layout_id(&mut self, backend: Backend) -> PipelineLayoutId { + match backend { + #[cfg(any(target_os = "linux", target_os = "windows"))] + Backend::Vulkan => self.vk_hub.create_pipeline_layout_id(), + #[cfg(target_os = "windows")] + Backend::Dx12 => self.dx12_hub.create_pipeline_layout_id(), + #[cfg(target_os = "windows")] + Backend::Dx11 => self.dx11_hub.create_pipeline_layout_id(), + #[cfg(any(target_os = "ios", target_os = "macos"))] + Backend::Metal => self.metal_hub.create_pipeline_layout_id(), + _ => self.dummy_hub.create_pipeline_layout_id(), + } + } } |