aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/identityhub.rs
diff options
context:
space:
mode:
authorIstvan Miklos <istvan.miklos@h-lab.eu>2020-01-29 11:15:18 +0100
committerIstvan Miklos <istvan.miklos@h-lab.eu>2020-02-11 10:12:20 +0100
commita8621c4ed9d87f6d168fd9b70e0cf501a4033632 (patch)
treee27a0671c3b3c9c068c163fa95caaa3fc49d45e5 /components/script/dom/identityhub.rs
parent5f55cd5d71df9c555fbc24777168396ddd539f28 (diff)
downloadservo-a8621c4ed9d87f6d168fd9b70e0cf501a4033632.tar.gz
servo-a8621c4ed9d87f6d168fd9b70e0cf501a4033632.zip
Initial implementation of GPUShaderModule
Added WebIDL bindings for `GPUShaderModule`. Implemented the `createShaderModule` function of `GPUDevice`.
Diffstat (limited to 'components/script/dom/identityhub.rs')
-rw-r--r--components/script/dom/identityhub.rs27
1 files changed, 15 insertions, 12 deletions
diff --git a/components/script/dom/identityhub.rs b/components/script/dom/identityhub.rs
index 311428893c0..c260cfc5b2e 100644
--- a/components/script/dom/identityhub.rs
+++ b/components/script/dom/identityhub.rs
@@ -5,7 +5,10 @@
use smallvec::SmallVec;
use webgpu::wgpu::{
hub::IdentityManager,
- id::{AdapterId, BindGroupId, BindGroupLayoutId, BufferId, DeviceId, PipelineLayoutId},
+ id::{
+ AdapterId, BindGroupId, BindGroupLayoutId, BufferId, DeviceId, PipelineLayoutId,
+ ShaderModuleId,
+ },
Backend,
};
@@ -17,6 +20,7 @@ pub struct IdentityHub {
bind_groups: IdentityManager,
bind_group_layouts: IdentityManager,
pipeline_layouts: IdentityManager,
+ shader_modules: IdentityManager,
backend: Backend,
}
@@ -29,6 +33,7 @@ impl IdentityHub {
bind_groups: IdentityManager::default(),
bind_group_layouts: IdentityManager::default(),
pipeline_layouts: IdentityManager::default(),
+ shader_modules: IdentityManager::default(),
backend,
}
}
@@ -56,6 +61,10 @@ impl IdentityHub {
fn create_pipeline_layout_id(&mut self) -> PipelineLayoutId {
self.pipeline_layouts.alloc(self.backend)
}
+
+ fn create_shader_module_id(&mut self) -> ShaderModuleId {
+ self.shader_modules.alloc(self.backend)
+ }
}
#[derive(Debug)]
@@ -133,17 +142,7 @@ impl Identities {
}
pub fn create_bind_group_id(&mut self, backend: Backend) -> BindGroupId {
- match backend {
- #[cfg(any(target_os = "linux", target_os = "windows"))]
- Backend::Vulkan => self.vk_hub.create_bind_group_id(),
- #[cfg(target_os = "windows")]
- Backend::Dx12 => self.dx12_hub.create_bind_group_id(),
- #[cfg(target_os = "windows")]
- Backend::Dx11 => self.dx11_hub.create_bind_group_id(),
- #[cfg(any(target_os = "ios", target_os = "macos"))]
- Backend::Metal => self.metal_hub.create_bind_group_id(),
- _ => self.dummy_hub.create_bind_group_id(),
- }
+ self.select(backend).create_bind_group_id()
}
pub fn create_bind_group_layout_id(&mut self, backend: Backend) -> BindGroupLayoutId {
@@ -153,4 +152,8 @@ impl Identities {
pub fn create_pipeline_layout_id(&mut self, backend: Backend) -> PipelineLayoutId {
self.select(backend).create_pipeline_layout_id()
}
+
+ pub fn create_shader_module_id(&mut self, backend: Backend) -> ShaderModuleId {
+ self.select(backend).create_shader_module_id()
+ }
}