From b4d2bbb24fd3f9765330cce5b40d61ac1f674662 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Wed, 22 Feb 2023 18:12:57 +0000 Subject: [PATCH] Make Texture/QuerySet destroy always valid. This follows the recent semantic from the WebGPU spec and fixes a couple failing CTS tests. Bug: None Change-Id: I9197ea3fda6c15bd9302f8d60e70ee00f1d37708 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120980 Reviewed-by: Austin Eng Commit-Queue: Corentin Wallez Kokoro: Kokoro --- src/dawn/native/QuerySet.cpp | 8 -------- src/dawn/native/QuerySet.h | 2 -- src/dawn/native/Texture.cpp | 9 --------- src/dawn/native/Texture.h | 1 - webgpu-cts/expectations.txt | 2 -- 5 files changed, 22 deletions(-) diff --git a/src/dawn/native/QuerySet.cpp b/src/dawn/native/QuerySet.cpp index 0682495e64..585e1854c7 100644 --- a/src/dawn/native/QuerySet.cpp +++ b/src/dawn/native/QuerySet.cpp @@ -165,9 +165,6 @@ MaybeError QuerySetBase::ValidateCanUseInSubmitNow() const { } void QuerySetBase::APIDestroy() { - if (GetDevice()->ConsumedError(ValidateDestroy())) { - return; - } Destroy(); } @@ -179,9 +176,4 @@ uint32_t QuerySetBase::APIGetCount() const { return mQueryCount; } -MaybeError QuerySetBase::ValidateDestroy() const { - DAWN_TRY(GetDevice()->ValidateObject(this)); - return {}; -} - } // namespace dawn::native diff --git a/src/dawn/native/QuerySet.h b/src/dawn/native/QuerySet.h index fa288a0248..d0cfd892e7 100644 --- a/src/dawn/native/QuerySet.h +++ b/src/dawn/native/QuerySet.h @@ -59,8 +59,6 @@ class QuerySetBase : public ApiObjectBase { ~QuerySetBase() override; private: - MaybeError ValidateDestroy() const; - wgpu::QueryType mQueryType; uint32_t mQueryCount; std::vector mPipelineStatistics; diff --git a/src/dawn/native/Texture.cpp b/src/dawn/native/Texture.cpp index 2467533806..3fe9e58df2 100644 --- a/src/dawn/native/Texture.cpp +++ b/src/dawn/native/Texture.cpp @@ -807,10 +807,6 @@ TextureViewBase* TextureBase::APICreateView(const TextureViewDescriptor* descrip } void TextureBase::APIDestroy() { - if (GetDevice()->ConsumedError(ValidateDestroy(), "calling %s.Destroy().", this)) { - return; - } - ASSERT(!IsError()); Destroy(); } @@ -845,11 +841,6 @@ wgpu::TextureUsage TextureBase::APIGetUsage() const { return mUsage; } -MaybeError TextureBase::ValidateDestroy() const { - DAWN_TRY(GetDevice()->ValidateObject(this)); - return {}; -} - // TextureViewBase TextureViewBase::TextureViewBase(TextureBase* texture, const TextureViewDescriptor* descriptor) diff --git a/src/dawn/native/Texture.h b/src/dawn/native/Texture.h index 8513ad0004..91372af2ff 100644 --- a/src/dawn/native/Texture.h +++ b/src/dawn/native/Texture.h @@ -118,7 +118,6 @@ class TextureBase : public ApiObjectBase { private: TextureBase(DeviceBase* device, const TextureDescriptor* descriptor, ObjectBase::ErrorTag tag); - MaybeError ValidateDestroy() const; wgpu::TextureDimension mDimension; const Format& mFormat; FormatSet mViewFormats; diff --git a/webgpu-cts/expectations.txt b/webgpu-cts/expectations.txt index 9961181289..c1eb28973e 100644 --- a/webgpu-cts/expectations.txt +++ b/webgpu-cts/expectations.txt @@ -380,7 +380,6 @@ crbug.com/dawn/0000 webgpu:api,validation,encoding,createRenderBundleEncoder:att crbug.com/dawn/0000 webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state,limits,maxColorAttachmentBytesPerSample,aligned:format="rgba8unorm" [ Failure ] crbug.com/dawn/0000 webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state,limits,maxColorAttachmentBytesPerSample,aligned:format="rgba8unorm-srgb" [ Failure ] crbug.com/dawn/0000 webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state,limits,maxColorAttachmentBytesPerSample,unaligned:formats=["r32float","rgba8unorm","rgba32float","r8unorm","r8unorm"] [ Failure ] -crbug.com/dawn/0000 webgpu:api,validation,query_set,destroy:invalid_queryset: [ Failure ] crbug.com/dawn/0000 webgpu:api,validation,render_pass,render_pass_descriptor:color_attachments,limits,maxColorAttachmentBytesPerSample,aligned:format="bgra8unorm" [ Failure ] crbug.com/dawn/0000 webgpu:api,validation,render_pass,render_pass_descriptor:color_attachments,limits,maxColorAttachmentBytesPerSample,aligned:format="bgra8unorm-srgb" [ Failure ] crbug.com/dawn/0000 webgpu:api,validation,render_pass,render_pass_descriptor:color_attachments,limits,maxColorAttachmentBytesPerSample,aligned:format="rg32float" [ Failure ] @@ -415,7 +414,6 @@ crbug.com/dawn/0000 webgpu:api,validation,render_pipeline,overrides:identifier,f crbug.com/dawn/0000 webgpu:api,validation,render_pipeline,overrides:identifier,fragment:isAsync=true;fragmentConstants={"s%C3%A9quen%C3%A7age":0} [ Failure ] crbug.com/dawn/0000 webgpu:api,validation,render_pipeline,overrides:identifier,vertex:isAsync=false;vertexConstants={"s%C3%A9quen%C3%A7age":0} [ Failure ] crbug.com/dawn/0000 webgpu:api,validation,render_pipeline,overrides:identifier,vertex:isAsync=true;vertexConstants={"s%C3%A9quen%C3%A7age":0} [ Failure ] -crbug.com/dawn/0000 webgpu:api,validation,texture,destroy:invalid_texture: [ Failure ] crbug.com/dawn/0000 [ monterey ] webgpu:web_platform,canvas,configure:alpha_mode:* [ Failure ] crbug.com/dawn/0000 [ monterey ] webgpu:web_platform,canvas,configure:defaults:* [ Failure ] crbug.com/dawn/0000 [ monterey ] webgpu:web_platform,canvas,configure:device:* [ Failure ]