Update wgpu-core and wgpu-types

This commit is contained in:
Kunal Mohan 2020-06-19 00:52:16 +05:30
parent 00b3f785c4
commit 48ef306bd3
13 changed files with 244 additions and 366 deletions

View file

@ -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]
@ -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>,
}
@ -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(),
@ -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,
}
}
@ -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,
)