diff options
author | Kunal Mohan <kunalmohan99@gmail.com> | 2020-08-07 22:36:05 +0530 |
---|---|---|
committer | Kunal Mohan <kunalmohan99@gmail.com> | 2020-08-07 22:36:05 +0530 |
commit | 1d80f57aab0a11e6138b360391900666303244f3 (patch) | |
tree | 1a38c380c6995a44d673d97b906b06e3e3b3dcc0 /components/script/dom/gpucomputepassencoder.rs | |
parent | 78c9466fdb98435dc4829b3c2e0a0a3a85b79b5f (diff) | |
download | servo-1d80f57aab0a11e6138b360391900666303244f3.tar.gz servo-1d80f57aab0a11e6138b360391900666303244f3.zip |
Record errors in GPUCommandEncoder.BeginPass() and EncoderPass.endPass()
Diffstat (limited to 'components/script/dom/gpucomputepassencoder.rs')
-rw-r--r-- | components/script/dom/gpucomputepassencoder.rs | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/components/script/dom/gpucomputepassencoder.rs b/components/script/dom/gpucomputepassencoder.rs index c55eaf86fe2..a73ee8bde34 100644 --- a/components/script/dom/gpucomputepassencoder.rs +++ b/components/script/dom/gpucomputepassencoder.rs @@ -33,13 +33,14 @@ impl GPUComputePassEncoder { fn new_inherited( channel: WebGPU, parent: &GPUCommandEncoder, + compute_pass: Option<ComputePass>, label: Option<USVString>, ) -> Self { Self { channel, reflector_: Reflector::new(), label: DomRefCell::new(label), - compute_pass: DomRefCell::new(Some(ComputePass::new(parent.id().0))), + compute_pass: DomRefCell::new(compute_pass), command_encoder: Dom::from_ref(parent), } } @@ -48,10 +49,16 @@ impl GPUComputePassEncoder { global: &GlobalScope, channel: WebGPU, parent: &GPUCommandEncoder, + compute_pass: Option<ComputePass>, label: Option<USVString>, ) -> DomRoot<Self> { reflect_dom_object( - Box::new(GPUComputePassEncoder::new_inherited(channel, parent, label)), + Box::new(GPUComputePassEncoder::new_inherited( + channel, + parent, + compute_pass, + label, + )), global, ) } @@ -88,24 +95,23 @@ impl GPUComputePassEncoderMethods for GPUComputePassEncoder { /// https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-endpass fn EndPass(&self) { - if let Some(compute_pass) = self.compute_pass.borrow_mut().take() { - self.channel - .0 - .send(( - self.command_encoder.device().use_current_scope(), - WebGPURequest::RunComputePass { - command_encoder_id: self.command_encoder.id().0, - device_id: self.command_encoder.device().id().0, - compute_pass, - }, - )) - .expect("Failed to send RunComputePass"); + let compute_pass = self.compute_pass.borrow_mut().take(); + self.channel + .0 + .send(( + self.command_encoder.device().use_current_scope(), + WebGPURequest::RunComputePass { + command_encoder_id: self.command_encoder.id().0, + device_id: self.command_encoder.device().id().0, + compute_pass, + }, + )) + .expect("Failed to send RunComputePass"); - self.command_encoder.set_state( - GPUCommandEncoderState::Open, - GPUCommandEncoderState::EncodingComputePass, - ); - } + self.command_encoder.set_state( + GPUCommandEncoderState::Open, + GPUCommandEncoderState::EncodingComputePass, + ); } /// https://gpuweb.github.io/gpuweb/#dom-gpuprogrammablepassencoder-setbindgroup |