aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/identityhub.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2020-01-16 13:36:10 -0500
committerGitHub <noreply@github.com>2020-01-16 13:36:10 -0500
commit90b0a7fcc5f8c94e176c817cad75d40a82b4388a (patch)
tree9836c660230484d483b5254ee8d85412b6402568 /components/script/dom/identityhub.rs
parent5c202ed392210ab824e16dc466e695dc0f5f7253 (diff)
parent9cf007472b364ea60445e6aaa5e91f67ef3d1894 (diff)
downloadservo-90b0a7fcc5f8c94e176c817cad75d40a82b4388a.tar.gz
servo-90b0a7fcc5f8c94e176c817cad75d40a82b4388a.zip
Auto merge of #25526 - szeged:bind_group_wgpu, r=jdm
Initial implementation of GPUBindGroupLayout for WebGPU Added WebIDL bindings for `GPUBindGroupLayout`, `GPUBindGroupLayoutDescriptor`, `GPUBindingType`, `GPUShaderStage` and `GPUBindGroupLayoutBinding` (Note: The servo's codegen doesn't like the name, because its already occupied). Implemented the `createBindGroupLayout` function of `GPUDevice`. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes addresses a part of #24706 cc @kvark @jdm @zakorgy <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script/dom/identityhub.rs')
-rw-r--r--components/script/dom/identityhub.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/components/script/dom/identityhub.rs b/components/script/dom/identityhub.rs
index 64e4cad3867..91543d2ea3f 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, BufferId, DeviceId},
+ id::{AdapterId, BindGroupLayoutId, BufferId, DeviceId},
Backend,
};
@@ -14,6 +14,7 @@ pub struct IdentityHub {
adapters: IdentityManager,
devices: IdentityManager,
buffers: IdentityManager,
+ bind_group_layouts: IdentityManager,
backend: Backend,
}
@@ -23,6 +24,7 @@ impl IdentityHub {
adapters: IdentityManager::default(),
devices: IdentityManager::default(),
buffers: IdentityManager::default(),
+ bind_group_layouts: IdentityManager::default(),
backend,
}
}
@@ -35,9 +37,13 @@ impl IdentityHub {
self.devices.alloc(self.backend)
}
- pub fn create_buffer_id(&mut self) -> BufferId {
+ fn create_buffer_id(&mut self) -> BufferId {
self.buffers.alloc(self.backend)
}
+
+ fn create_bind_group_layout_id(&mut self) -> BindGroupLayoutId {
+ self.bind_group_layouts.alloc(self.backend)
+ }
}
#[derive(Debug)]
@@ -119,4 +125,18 @@ impl Identities {
_ => self.dummy_hub.create_buffer_id(),
}
}
+
+ pub fn create_bind_group_layout_id(&mut self, backend: Backend) -> BindGroupLayoutId {
+ match backend {
+ #[cfg(any(target_os = "linux", target_os = "windows"))]
+ Backend::Vulkan => self.vk_hub.create_bind_group_layout_id(),
+ #[cfg(target_os = "windows")]
+ Backend::Dx12 => self.dx12_hub.create_bind_group_layout_id(),
+ #[cfg(target_os = "windows")]
+ Backend::Dx11 => self.dx11_hub.create_bind_group_layout_id(),
+ #[cfg(any(target_os = "ios", target_os = "macos"))]
+ Backend::Metal => self.metal_hub.create_bind_group_layout_id(),
+ _ => self.dummy_hub.create_bind_group_layout_id(),
+ }
+ }
}