Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of GPUPipelineLayout for WebGPU
Added WebIDL bindings for `GPUPipelineLayout`. Implemented the createPipelineLayout function of `GPUDevice`.
- Loading branch information
Istvan Miklos
committed
Jan 21, 2020
1 parent
0dccfd1
commit d33a4d2
Showing
10 changed files
with
223 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
use crate::dom::bindings::cell::DomRefCell; | ||
use crate::dom::bindings::codegen::Bindings::GPUPipelineLayoutBinding::{ | ||
self, GPUPipelineLayoutMethods, | ||
}; | ||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; | ||
use crate::dom::bindings::root::DomRoot; | ||
use crate::dom::bindings::str::DOMString; | ||
use crate::dom::globalscope::GlobalScope; | ||
use dom_struct::dom_struct; | ||
use std::cell::Cell; | ||
use webgpu::{WebGPUBindGroupLayout, WebGPUPipelineLayout}; | ||
|
||
#[dom_struct] | ||
pub struct GPUPipelineLayout { | ||
reflector_: Reflector, | ||
bind_group_layouts: Vec<WebGPUBindGroupLayout>, | ||
label: DomRefCell<Option<DOMString>>, | ||
pipeline_layout: WebGPUPipelineLayout, | ||
valid: Cell<bool>, | ||
} | ||
|
||
impl GPUPipelineLayout { | ||
fn new_inherited( | ||
bind_group_layouts: Vec<WebGPUBindGroupLayout>, | ||
pipeline_layout: WebGPUPipelineLayout, | ||
valid: bool, | ||
) -> GPUPipelineLayout { | ||
Self { | ||
reflector_: Reflector::new(), | ||
bind_group_layouts, | ||
label: DomRefCell::new(None), | ||
pipeline_layout, | ||
valid: Cell::new(valid), | ||
} | ||
} | ||
|
||
pub fn new( | ||
global: &GlobalScope, | ||
bind_group_layouts: Vec<WebGPUBindGroupLayout>, | ||
pipeline_layout: WebGPUPipelineLayout, | ||
valid: bool, | ||
) -> DomRoot<GPUPipelineLayout> { | ||
reflect_dom_object( | ||
Box::new(GPUPipelineLayout::new_inherited( | ||
bind_group_layouts, | ||
pipeline_layout, | ||
valid, | ||
)), | ||
global, | ||
GPUPipelineLayoutBinding::Wrap, | ||
) | ||
} | ||
} | ||
|
||
impl GPUPipelineLayoutMethods for GPUPipelineLayout { | ||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label | ||
fn GetLabel(&self) -> Option<DOMString> { | ||
self.label.borrow().clone() | ||
} | ||
|
||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label | ||
fn SetLabel(&self, value: Option<DOMString>) { | ||
*self.label.borrow_mut() = value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
// https://gpuweb.github.io/gpuweb/#pipeline-layout | ||
[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom.webgpu.enabled"] | ||
interface GPUPipelineLayout { | ||
}; | ||
GPUPipelineLayout includes GPUObjectBase; | ||
|
||
dictionary GPUPipelineLayoutDescriptor : GPUObjectDescriptorBase { | ||
required sequence<GPUBindGroupLayout> bindGroupLayouts; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters