Initial implementation of GPUComputePipeline

Added WebIDL bindings for `GPUComputePipeline`.
Implemented the `createComputePipeline` function of `GPUDevice`.
This commit is contained in:
Istvan Miklos 2020-02-03 15:42:13 +01:00
parent a8621c4ed9
commit 9031369c19
11 changed files with 180 additions and 8 deletions

View file

@ -6,8 +6,8 @@ use smallvec::SmallVec;
use webgpu::wgpu::{
hub::IdentityManager,
id::{
AdapterId, BindGroupId, BindGroupLayoutId, BufferId, DeviceId, PipelineLayoutId,
ShaderModuleId,
AdapterId, BindGroupId, BindGroupLayoutId, BufferId, ComputePipelineId, DeviceId,
PipelineLayoutId, ShaderModuleId,
},
Backend,
};
@ -19,6 +19,7 @@ pub struct IdentityHub {
buffers: IdentityManager,
bind_groups: IdentityManager,
bind_group_layouts: IdentityManager,
compute_pipelines: IdentityManager,
pipeline_layouts: IdentityManager,
shader_modules: IdentityManager,
backend: Backend,
@ -32,6 +33,7 @@ impl IdentityHub {
buffers: IdentityManager::default(),
bind_groups: IdentityManager::default(),
bind_group_layouts: IdentityManager::default(),
compute_pipelines: IdentityManager::default(),
pipeline_layouts: IdentityManager::default(),
shader_modules: IdentityManager::default(),
backend,
@ -58,6 +60,10 @@ impl IdentityHub {
self.bind_group_layouts.alloc(self.backend)
}
fn create_compute_pipeline_id(&mut self) -> ComputePipelineId {
self.compute_pipelines.alloc(self.backend)
}
fn create_pipeline_layout_id(&mut self) -> PipelineLayoutId {
self.pipeline_layouts.alloc(self.backend)
}
@ -149,6 +155,10 @@ impl Identities {
self.select(backend).create_bind_group_layout_id()
}
pub fn create_compute_pipeline_id(&mut self, backend: Backend) -> ComputePipelineId {
self.select(backend).create_compute_pipeline_id()
}
pub fn create_pipeline_layout_id(&mut self, backend: Backend) -> PipelineLayoutId {
self.select(backend).create_pipeline_layout_id()
}