aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/gpucomputepassencoder.rs
diff options
context:
space:
mode:
authorKunal Mohan <kunalmohan99@gmail.com>2020-05-15 20:30:02 +0530
committerKunal Mohan <kunalmohan99@gmail.com>2020-05-15 22:55:08 +0530
commit1aeae47299ea7115681e6a79eb0ab08b0b688f17 (patch)
treedb087b7d810f6b5d717e9cdcee9cde050b91499b /components/script/dom/gpucomputepassencoder.rs
parente1cc38bea8a701108b6f2fa809f341769613b55f (diff)
downloadservo-1aeae47299ea7115681e6a79eb0ab08b0b688f17.tar.gz
servo-1aeae47299ea7115681e6a79eb0ab08b0b688f17.zip
Validate copybuffertobuffer() + some spec update
The spec update includes renaming bindings to entries and adding CommandEncoderState.
Diffstat (limited to 'components/script/dom/gpucomputepassencoder.rs')
-rw-r--r--components/script/dom/gpucomputepassencoder.rs18
1 files changed, 13 insertions, 5 deletions
diff --git a/components/script/dom/gpucomputepassencoder.rs b/components/script/dom/gpucomputepassencoder.rs
index c7e742cae84..eb4c20c0075 100644
--- a/components/script/dom/gpucomputepassencoder.rs
+++ b/components/script/dom/gpucomputepassencoder.rs
@@ -5,10 +5,11 @@
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::GPUComputePassEncoderBinding::GPUComputePassEncoderMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
-use crate::dom::bindings::root::DomRoot;
+use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::gpubindgroup::GPUBindGroup;
+use crate::dom::gpucommandencoder::{GPUCommandEncoder, GPUCommandEncoderState};
use crate::dom::gpucomputepipeline::GPUComputePipeline;
use dom_struct::dom_struct;
use std::cell::RefCell;
@@ -20,7 +21,7 @@ use webgpu::{
},
RawPass,
},
- WebGPU, WebGPUCommandEncoder, WebGPURequest,
+ WebGPU, WebGPURequest,
};
#[dom_struct]
@@ -31,22 +32,24 @@ pub struct GPUComputePassEncoder {
label: DomRefCell<Option<DOMString>>,
#[ignore_malloc_size_of = "defined in wgpu-core"]
raw_pass: RefCell<Option<RawPass>>,
+ command_encoder: Dom<GPUCommandEncoder>,
}
impl GPUComputePassEncoder {
- fn new_inherited(channel: WebGPU, parent: WebGPUCommandEncoder) -> GPUComputePassEncoder {
+ fn new_inherited(channel: WebGPU, parent: &GPUCommandEncoder) -> GPUComputePassEncoder {
GPUComputePassEncoder {
channel,
reflector_: Reflector::new(),
label: DomRefCell::new(None),
- raw_pass: RefCell::new(Some(RawPass::new_compute(parent.0))),
+ raw_pass: RefCell::new(Some(RawPass::new_compute(parent.id().0))),
+ command_encoder: Dom::from_ref(parent),
}
}
pub fn new(
global: &GlobalScope,
channel: WebGPU,
- parent: WebGPUCommandEncoder,
+ parent: &GPUCommandEncoder,
) -> DomRoot<GPUComputePassEncoder> {
reflect_dom_object(
Box::new(GPUComputePassEncoder::new_inherited(channel, parent)),
@@ -87,6 +90,11 @@ impl GPUComputePassEncoderMethods for GPUComputePassEncoder {
pass_data,
})
.unwrap();
+
+ self.command_encoder.set_state(
+ GPUCommandEncoderState::Open,
+ GPUCommandEncoderState::EncodingComputePass,
+ );
}
}