mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
webgpu: destroy GPUTexture without erroring (#33534)
* destroy GPUTexture without erroring (errors can be safely ignored) Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Update expectations Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
43d92ecbcb
commit
6f797709cf
4 changed files with 8 additions and 2134 deletions
|
@ -2,7 +2,6 @@
|
|||
* 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 std::cell::Cell;
|
||||
use std::string::String;
|
||||
|
||||
use dom_struct::dom_struct;
|
||||
|
@ -40,7 +39,6 @@ pub struct GPUTexture {
|
|||
dimension: GPUTextureDimension,
|
||||
format: GPUTextureFormat,
|
||||
texture_usage: u32,
|
||||
destroyed: Cell<bool>,
|
||||
}
|
||||
|
||||
impl GPUTexture {
|
||||
|
@ -69,7 +67,6 @@ impl GPUTexture {
|
|||
dimension,
|
||||
format,
|
||||
texture_usage,
|
||||
destroyed: Cell::new(false),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,9 +104,6 @@ impl GPUTexture {
|
|||
|
||||
impl Drop for GPUTexture {
|
||||
fn drop(&mut self) {
|
||||
if self.destroyed.get() {
|
||||
return;
|
||||
}
|
||||
if let Err(e) = self
|
||||
.channel
|
||||
.0
|
||||
|
@ -250,19 +244,16 @@ 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.send(WebGPURequest::DestroyTexture {
|
||||
device_id: self.device.id().0,
|
||||
texture_id: self.texture.0,
|
||||
}) {
|
||||
if let Err(e) = self
|
||||
.channel
|
||||
.0
|
||||
.send(WebGPURequest::DestroyTexture(self.texture.0))
|
||||
{
|
||||
warn!(
|
||||
"Failed to send WebGPURequest::DestroyTexture({:?}) ({})",
|
||||
self.texture.0, e
|
||||
);
|
||||
};
|
||||
self.destroyed.set(true);
|
||||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gputexture-width>
|
||||
|
|
|
@ -151,10 +151,7 @@ pub enum WebGPURequest {
|
|||
},
|
||||
DestroyBuffer(id::BufferId),
|
||||
DestroyDevice(id::DeviceId),
|
||||
DestroyTexture {
|
||||
device_id: id::DeviceId,
|
||||
texture_id: id::TextureId,
|
||||
},
|
||||
DestroyTexture(id::TextureId),
|
||||
DestroySwapChain {
|
||||
context_id: WebGPUContextId,
|
||||
image_key: ImageKey,
|
||||
|
|
|
@ -567,13 +567,9 @@ impl WGPU {
|
|||
} => {
|
||||
self.destroy_swapchain(context_id, image_key);
|
||||
},
|
||||
WebGPURequest::DestroyTexture {
|
||||
device_id,
|
||||
texture_id,
|
||||
} => {
|
||||
WebGPURequest::DestroyTexture(texture_id) => {
|
||||
let global = &self.global;
|
||||
let result = global.texture_destroy(texture_id);
|
||||
self.maybe_dispatch_wgpu_error(device_id, result.err());
|
||||
let _ = global.texture_destroy(texture_id);
|
||||
},
|
||||
WebGPURequest::Exit(sender) => {
|
||||
if let Err(e) = sender.send(()) {
|
||||
|
|
2110
tests/wpt/webgpu/meta/webgpu/cts.https.html.ini
vendored
2110
tests/wpt/webgpu/meta/webgpu/cts.https.html.ini
vendored
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue