aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/gpubindgrouplayout.rs
diff options
context:
space:
mode:
authorKunal Mohan <kunalmohan99@gmail.com>2020-06-02 15:36:08 +0530
committerKunal Mohan <kunalmohan99@gmail.com>2020-06-17 12:45:40 +0530
commit00b3f785c4d4bb4da9d883128d9dc18e0406ad71 (patch)
treeca3b3c0a162eb17863fa802f50d090c4f45ea3ad /components/script/dom/gpubindgrouplayout.rs
parentabc3ed40c9daf8c7a68d82a2d5fb40ad632eb27f (diff)
downloadservo-00b3f785c4d4bb4da9d883128d9dc18e0406ad71.tar.gz
servo-00b3f785c4d4bb4da9d883128d9dc18e0406ad71.zip
Add GPUSampler and GPUTextureView to BindingResource
Add validation for BindGroups
Diffstat (limited to 'components/script/dom/gpubindgrouplayout.rs')
-rw-r--r--components/script/dom/gpubindgrouplayout.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/components/script/dom/gpubindgrouplayout.rs b/components/script/dom/gpubindgrouplayout.rs
index 8c141256261..aadc75557b2 100644
--- a/components/script/dom/gpubindgrouplayout.rs
+++ b/components/script/dom/gpubindgrouplayout.rs
@@ -12,6 +12,7 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use dom_struct::dom_struct;
use std::cell::Cell;
+use std::collections::HashMap;
use webgpu::{WebGPU, WebGPUBindGroupLayout};
#[dom_struct]
@@ -20,7 +21,7 @@ pub struct GPUBindGroupLayout {
label: DomRefCell<Option<DOMString>>,
bind_group_layout: WebGPUBindGroupLayout,
#[ignore_malloc_size_of = "defined in webgpu"]
- bindings: Vec<GPUBindGroupLayoutEntry>,
+ entry_map: HashMap<u32, GPUBindGroupLayoutEntry>,
#[ignore_malloc_size_of = "defined in webgpu"]
channel: WebGPU,
valid: Cell<bool>,
@@ -30,7 +31,7 @@ impl GPUBindGroupLayout {
fn new_inherited(
channel: WebGPU,
bind_group_layout: WebGPUBindGroupLayout,
- bindings: Vec<GPUBindGroupLayoutEntry>,
+ entry_map: HashMap<u32, GPUBindGroupLayoutEntry>,
valid: bool,
) -> Self {
Self {
@@ -38,7 +39,7 @@ impl GPUBindGroupLayout {
channel,
label: DomRefCell::new(None),
bind_group_layout,
- bindings,
+ entry_map,
valid: Cell::new(valid),
}
}
@@ -47,14 +48,14 @@ impl GPUBindGroupLayout {
global: &GlobalScope,
channel: WebGPU,
bind_group_layout: WebGPUBindGroupLayout,
- bindings: Vec<GPUBindGroupLayoutEntry>,
+ entry_map: HashMap<u32, GPUBindGroupLayoutEntry>,
valid: bool,
) -> DomRoot<Self> {
reflect_dom_object(
Box::new(GPUBindGroupLayout::new_inherited(
channel,
bind_group_layout,
- bindings,
+ entry_map,
valid,
)),
global,
@@ -71,8 +72,8 @@ impl GPUBindGroupLayout {
self.bind_group_layout
}
- pub fn bindings(&self) -> &[GPUBindGroupLayoutEntry] {
- &self.bindings
+ pub fn entries(&self) -> &HashMap<u32, GPUBindGroupLayoutEntry> {
+ &self.entry_map
}
}