diff options
author | bors-servo <servo-ops@mozilla.com> | 2020-08-27 13:12:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-27 13:12:27 -0400 |
commit | 9e6da58d7793a4576fef38446457e1073a19cd5e (patch) | |
tree | 9413f55965530db94a2c82d68bbb33a4f3d765a9 /components/script | |
parent | 84185eb1daf1420597f38a77e40ed3baedb5d521 (diff) | |
parent | 85b6bbb33ace8b433ed279d2cb73ed8d96bb9690 (diff) | |
download | servo-9e6da58d7793a4576fef38446457e1073a19cd5e.tar.gz servo-9e6da58d7793a4576fef38446457e1073a19cd5e.zip |
Auto merge of #27614 - kunalmohan:webgpu-cts, r=kvark
Minor fixes and update cts
<!-- Please describe your changes on the following line: -->
- Prevent redundant buffer and texture destroy calls.
- More subtests for B2B copy pass now.
- All tests under `setViewport()` and `setScissorRect()` pass now.
- Tests for `createTexture()` do not crash. More than 50% of them pass now.
r?@kvark
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)
<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because ___
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/gpubuffer.rs | 1 | ||||
-rw-r--r-- | components/script/dom/gputexture.rs | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/components/script/dom/gpubuffer.rs b/components/script/dom/gpubuffer.rs index 2d721465e68..60a6075cb7f 100644 --- a/components/script/dom/gpubuffer.rs +++ b/components/script/dom/gpubuffer.rs @@ -184,6 +184,7 @@ impl GPUBufferMethods for GPUBuffer { GPUBufferState::Mapped | GPUBufferState::MappedAtCreation => { self.Unmap(); }, + GPUBufferState::Destroyed => return, _ => {}, }; if let Err(e) = self diff --git a/components/script/dom/gputexture.rs b/components/script/dom/gputexture.rs index 175ec7c90cc..b473e52eaae 100644 --- a/components/script/dom/gputexture.rs +++ b/components/script/dom/gputexture.rs @@ -18,6 +18,7 @@ use crate::dom::gpudevice::{ }; use crate::dom::gputextureview::GPUTextureView; use dom_struct::dom_struct; +use std::cell::Cell; use std::num::NonZeroU32; use std::string::String; use webgpu::{ @@ -40,6 +41,7 @@ pub struct GPUTexture { dimension: GPUTextureDimension, format: GPUTextureFormat, texture_usage: u32, + destroyed: Cell<bool>, } impl GPUTexture { @@ -67,6 +69,7 @@ impl GPUTexture { dimension, format, texture_usage, + destroyed: Cell::new(false), } } @@ -197,6 +200,9 @@ impl GPUTextureMethods for GPUTexture { /// https://gpuweb.github.io/gpuweb/#dom-gputexture-destroy fn Destroy(&self) { + if self.destroyed.get() { + return; + } if let Err(e) = self .channel .0 @@ -207,5 +213,6 @@ impl GPUTextureMethods for GPUTexture { self.texture.0, e ); }; + self.destroyed.set(true); } } |