Initial implementation of GPUCommandEncoder

Added WebIDL bindings for `GPUCommandEncoder`, `GPUCommandBuffer`, `GPUComputePassEncoder`, `GPUProgrammablePassEncoder`.
Implemented the `beginComputePass`, `copyBufferToBuffer` and `finish` functions of `GPUCommandEncoder`.
Implemented the `createCommandEncoder` function of `GPUDevice`.
This commit is contained in:
Zakor Gyula 2020-01-14 08:54:08 +01:00 committed by Istvan Miklos
parent 9031369c19
commit 4facd3d4d2
14 changed files with 443 additions and 13 deletions

View file

@ -6,8 +6,8 @@ use smallvec::SmallVec;
use webgpu::wgpu::{
hub::IdentityManager,
id::{
AdapterId, BindGroupId, BindGroupLayoutId, BufferId, ComputePipelineId, DeviceId,
PipelineLayoutId, ShaderModuleId,
AdapterId, BindGroupId, BindGroupLayoutId, BufferId, CommandEncoderId, ComputePipelineId,
DeviceId, PipelineLayoutId, ShaderModuleId,
},
Backend,
};
@ -22,6 +22,7 @@ pub struct IdentityHub {
compute_pipelines: IdentityManager,
pipeline_layouts: IdentityManager,
shader_modules: IdentityManager,
command_encoders: IdentityManager,
backend: Backend,
}
@ -36,6 +37,7 @@ impl IdentityHub {
compute_pipelines: IdentityManager::default(),
pipeline_layouts: IdentityManager::default(),
shader_modules: IdentityManager::default(),
command_encoders: IdentityManager::default(),
backend,
}
}
@ -71,6 +73,10 @@ impl IdentityHub {
fn create_shader_module_id(&mut self) -> ShaderModuleId {
self.shader_modules.alloc(self.backend)
}
pub fn create_command_encoder_id(&mut self) -> CommandEncoderId {
self.command_encoders.alloc(self.backend)
}
}
#[derive(Debug)]
@ -166,4 +172,8 @@ impl Identities {
pub fn create_shader_module_id(&mut self, backend: Backend) -> ShaderModuleId {
self.select(backend).create_shader_module_id()
}
pub fn create_command_encoder_id(&mut self, backend: Backend) -> CommandEncoderId {
self.select(backend).create_command_encoder_id()
}
}