Skip to content

Commit

Permalink
Update wgpu-core and wgpu-types
Browse files Browse the repository at this point in the history
  • Loading branch information
kunalmohan committed Jun 19, 2020
1 parent 00b3f78 commit 48ef306
Show file tree
Hide file tree
Showing 13 changed files with 243 additions and 365 deletions.
23 changes: 11 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions components/script/dom/bindings/trace.rs
Expand Up @@ -164,10 +164,10 @@ use tendril::{StrTendril, TendrilSink};
use time::{Duration, Timespec, Tm};
use uuid::Uuid;
use webgpu::{
wgpu::command::RawPass, WebGPU, WebGPUAdapter, WebGPUBindGroup, WebGPUBindGroupLayout,
WebGPUBuffer, WebGPUCommandBuffer, WebGPUCommandEncoder, WebGPUComputePipeline, WebGPUDevice,
WebGPUPipelineLayout, WebGPUQueue, WebGPURenderPipeline, WebGPUSampler, WebGPUShaderModule,
WebGPUTexture, WebGPUTextureView,
wgpu::command::RawPass, wgpu::id, WebGPU, WebGPUAdapter, WebGPUBindGroup,
WebGPUBindGroupLayout, WebGPUBuffer, WebGPUCommandBuffer, WebGPUCommandEncoder,
WebGPUComputePipeline, WebGPUDevice, WebGPUPipelineLayout, WebGPUQueue, WebGPURenderPipeline,
WebGPUSampler, WebGPUShaderModule, WebGPUTexture, WebGPUTextureView,
};
use webrender_api::{DocumentId, ExternalImageId, ImageKey};
use webxr_api::SwapChainId as WebXRSwapChainId;
Expand Down Expand Up @@ -578,7 +578,7 @@ unsafe_no_jsmanaged_fields!(WebGPUContextId);
unsafe_no_jsmanaged_fields!(WebGPUCommandBuffer);
unsafe_no_jsmanaged_fields!(WebGPUCommandEncoder);
unsafe_no_jsmanaged_fields!(WebGPUDevice);
unsafe_no_jsmanaged_fields!(Option<RawPass>);
unsafe_no_jsmanaged_fields!(Option<RawPass<id::CommandEncoderId>>);
unsafe_no_jsmanaged_fields!(GPUBufferState);
unsafe_no_jsmanaged_fields!(GPUCommandEncoderState);
unsafe_no_jsmanaged_fields!(WebXRSwapChainId);
Expand Down
2 changes: 2 additions & 0 deletions components/script/dom/gpuadapter.rs
Expand Up @@ -84,7 +84,9 @@ impl GPUAdapterMethods for GPUAdapter {
extensions: wgt::Extensions::empty(),
limits: wgt::Limits {
max_bind_groups: descriptor.limits.maxBindGroups,
..Default::default()
},
shader_validation: true,
};
let id = self
.global()
Expand Down
31 changes: 2 additions & 29 deletions components/script/dom/gpubindgroup.rs
Expand Up @@ -3,19 +3,14 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUBindGroupBinding::{
GPUBindGroupEntry, GPUBindGroupMethods,
};
use crate::dom::bindings::codegen::Bindings::GPUBindGroupBinding::GPUBindGroupMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::gpubindgrouplayout::GPUBindGroupLayout;
use crate::dom::gpubuffer::GPUBuffer;
use crate::dom::gputextureview::TextureSubresource;
use dom_struct::dom_struct;
use std::cell::Cell;
use std::collections::HashMap;
use webgpu::{WebGPUBindGroup, WebGPUDevice};

#[dom_struct]
Expand All @@ -25,10 +20,6 @@ pub struct GPUBindGroup {
bind_group: WebGPUBindGroup,
device: WebGPUDevice,
layout: Dom<GPUBindGroupLayout>,
#[ignore_malloc_size_of = "defined in webgpu"]
entries: Vec<GPUBindGroupEntry>,
used_buffers: HashMap<Dom<GPUBuffer>, u32>,
used_textures: HashMap<TextureSubresource, u32>,
valid: Cell<bool>,
}

Expand All @@ -37,10 +28,7 @@ impl GPUBindGroup {
bind_group: WebGPUBindGroup,
device: WebGPUDevice,
valid: bool,
entries: Vec<GPUBindGroupEntry>,
layout: &GPUBindGroupLayout,
used_buffers: HashMap<DomRoot<GPUBuffer>, u32>,
used_textures: HashMap<TextureSubresource, u32>,
) -> Self {
Self {
reflector_: Reflector::new(),
Expand All @@ -49,12 +37,6 @@ impl GPUBindGroup {
device,
valid: Cell::new(valid),
layout: Dom::from_ref(layout),
entries,
used_buffers: used_buffers
.into_iter()
.map(|(key, value)| (Dom::from_ref(&*key), value))
.collect(),
used_textures,
}
}

Expand All @@ -63,20 +45,11 @@ impl GPUBindGroup {
bind_group: WebGPUBindGroup,
device: WebGPUDevice,
valid: bool,
entries: Vec<GPUBindGroupEntry>,
layout: &GPUBindGroupLayout,
used_buffers: HashMap<DomRoot<GPUBuffer>, u32>,
used_textures: HashMap<TextureSubresource, u32>,
) -> DomRoot<Self> {
reflect_dom_object(
Box::new(GPUBindGroup::new_inherited(
bind_group,
device,
valid,
entries,
layout,
used_buffers,
used_textures,
bind_group, device, valid, layout,
)),
global,
)
Expand Down
3 changes: 2 additions & 1 deletion components/script/dom/gpucomputepassencoder.rs
Expand Up @@ -22,6 +22,7 @@ use webgpu::{
},
RawPass,
},
wgpu::id,
WebGPU, WebGPURequest,
};

Expand All @@ -32,7 +33,7 @@ pub struct GPUComputePassEncoder {
channel: WebGPU,
label: DomRefCell<Option<DOMString>>,
#[ignore_malloc_size_of = "defined in wgpu-core"]
raw_pass: DomRefCell<Option<RawPass>>,
raw_pass: DomRefCell<Option<RawPass<id::CommandEncoderId>>>,
command_encoder: Dom<GPUCommandEncoder>,
}

Expand Down

0 comments on commit 48ef306

Please sign in to comment.