diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2020-01-30 12:34:26 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-30 12:34:26 -0500 |
commit | 1352e7188a007624badaca5e55b301c9f260b5f9 (patch) | |
tree | 7d60bccdf0325114b85797c906de92f144cfc9e7 /components/webgpu/lib.rs | |
parent | 9933d2fac7ec63ded9b32354c22d421b42e94850 (diff) | |
parent | 3cefc5f3a196a05226596293cac696c97e650c9b (diff) | |
download | servo-1352e7188a007624badaca5e55b301c9f260b5f9.tar.gz servo-1352e7188a007624badaca5e55b301c9f260b5f9.zip |
Auto merge of #25637 - szeged:wgpu_crete_bind_group, r=jdm
Initial implementation of GPUBindGroup for WebGPU
Added WebIDL bindings for `GPUBindGroup`.
Implemented the `createBindGroup` function of `GPUDevice`
Renamed `GPUBindGroupBinding` to `GPUBindGroupBindings` and `GPUBufferBinding` to `GPUBufferBindings` in the WebIDL, because these names are already occupied.
<!-- 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/webgpu/lib.rs')
-rw-r--r-- | components/webgpu/lib.rs | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/components/webgpu/lib.rs b/components/webgpu/lib.rs index 8d223a12366..e3548a158ca 100644 --- a/components/webgpu/lib.rs +++ b/components/webgpu/lib.rs @@ -5,8 +5,6 @@ #[macro_use] extern crate log; #[macro_use] -extern crate serde; -#[macro_use] pub extern crate wgpu_core as wgpu; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; @@ -48,6 +46,13 @@ pub enum WebGPURequest { wgpu::id::BufferId, wgpu::resource::BufferDescriptor, ), + CreateBindGroup( + IpcSender<WebGPUBindGroup>, + WebGPUDevice, + wgpu::id::BindGroupId, + WebGPUBindGroupLayout, + Vec<wgpu::binding_model::BindGroupBinding>, + ), CreateBindGroupLayout( IpcSender<WebGPUBindGroupLayout>, WebGPUDevice, @@ -232,6 +237,23 @@ impl WGPU { let global = &self.global; gfx_select!(buffer.0 => global.buffer_destroy(buffer.0)); }, + WebGPURequest::CreateBindGroup(sender, device, id, layout_id, bindings) => { + let global = &self.global; + let descriptor = wgpu_core::binding_model::BindGroupDescriptor { + layout: layout_id.0, + bindings: bindings.as_ptr(), + bindings_length: bindings.len(), + }; + let bg_id = gfx_select!(id => global.device_create_bind_group(device.0, &descriptor, id)); + let bind_group = WebGPUBindGroup(bg_id); + + if let Err(e) = sender.send(bind_group) { + warn!( + "Failed to send response to WebGPURequest::CreateBindGroup ({})", + e + ) + } + }, WebGPURequest::CreateBindGroupLayout(sender, device, id, bindings) => { let global = &self.global; let descriptor = wgpu_core::binding_model::BindGroupLayoutDescriptor { @@ -294,5 +316,6 @@ macro_rules! webgpu_resource { webgpu_resource!(WebGPUAdapter, wgpu::id::AdapterId); webgpu_resource!(WebGPUDevice, wgpu::id::DeviceId); webgpu_resource!(WebGPUBuffer, wgpu::id::BufferId); +webgpu_resource!(WebGPUBindGroup, wgpu::id::BindGroupId); webgpu_resource!(WebGPUBindGroupLayout, wgpu::id::BindGroupLayoutId); webgpu_resource!(WebGPUPipelineLayout, wgpu::id::PipelineLayoutId); |