mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update GPUObjectBase webidl and cleanup valid flags
This commit is contained in:
parent
3216209506
commit
cdc0a75fe4
20 changed files with 229 additions and 251 deletions
|
@ -6,47 +6,36 @@ use crate::dom::bindings::cell::DomRefCell;
|
|||
use crate::dom::bindings::codegen::Bindings::GPUBindGroupLayoutBinding::GPUBindGroupLayoutMethods;
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::bindings::str::USVString;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use std::cell::Cell;
|
||||
use webgpu::WebGPUBindGroupLayout;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUBindGroupLayout {
|
||||
reflector_: Reflector,
|
||||
label: DomRefCell<Option<DOMString>>,
|
||||
label: DomRefCell<Option<USVString>>,
|
||||
bind_group_layout: WebGPUBindGroupLayout,
|
||||
valid: Cell<bool>,
|
||||
}
|
||||
|
||||
impl GPUBindGroupLayout {
|
||||
fn new_inherited(bind_group_layout: WebGPUBindGroupLayout, valid: bool) -> Self {
|
||||
fn new_inherited(bind_group_layout: WebGPUBindGroupLayout) -> Self {
|
||||
Self {
|
||||
reflector_: Reflector::new(),
|
||||
label: DomRefCell::new(None),
|
||||
bind_group_layout,
|
||||
valid: Cell::new(valid),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
global: &GlobalScope,
|
||||
bind_group_layout: WebGPUBindGroupLayout,
|
||||
valid: bool,
|
||||
) -> DomRoot<Self> {
|
||||
pub fn new(global: &GlobalScope, bind_group_layout: WebGPUBindGroupLayout) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUBindGroupLayout::new_inherited(bind_group_layout, valid)),
|
||||
Box::new(GPUBindGroupLayout::new_inherited(bind_group_layout)),
|
||||
global,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl GPUBindGroupLayout {
|
||||
pub fn is_valid(&self) -> bool {
|
||||
self.valid.get()
|
||||
}
|
||||
|
||||
pub fn id(&self) -> WebGPUBindGroupLayout {
|
||||
self.bind_group_layout
|
||||
}
|
||||
|
@ -54,12 +43,12 @@ impl GPUBindGroupLayout {
|
|||
|
||||
impl GPUBindGroupLayoutMethods for GPUBindGroupLayout {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
fn GetLabel(&self) -> Option<DOMString> {
|
||||
fn GetLabel(&self) -> Option<USVString> {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
fn SetLabel(&self, value: Option<DOMString>) {
|
||||
fn SetLabel(&self, value: Option<USVString>) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue