Remove deprecated wgpu::StoreOp::Clear

Bug: dawn:937
Change-Id: I80cdb3b6b3caecc83a6e8cc009bb494179808cd9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63742
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Corentin Wallez 2021-09-14 16:02:00 +00:00 committed by Dawn LUCI CQ
parent e2cc5d624a
commit 77755b9f55
7 changed files with 6 additions and 62 deletions

View File

@ -1094,8 +1094,7 @@
"category": "enum", "category": "enum",
"values": [ "values": [
{"value": 0, "name": "store"}, {"value": 0, "name": "store"},
{"value": 1, "name": "discard"}, {"value": 1, "name": "discard"}
{"value": 2, "name": "clear"}
] ]
}, },
"origin 3D": { "origin 3D": {

View File

@ -127,7 +127,6 @@ namespace dawn_native {
break; break;
case wgpu::StoreOp::Discard: case wgpu::StoreOp::Discard:
case wgpu::StoreOp::Clear:
view->GetTexture()->SetIsSubresourceContentInitialized(false, range); view->GetTexture()->SetIsSubresourceContentInitialized(false, range);
break; break;
} }

View File

@ -41,14 +41,6 @@ namespace dawn_native {
namespace { namespace {
MaybeError ValidateDeprecatedStoreOp(DeviceBase* device, wgpu::StoreOp value) {
if (value == wgpu::StoreOp::Clear) {
device->EmitDeprecationWarning(
"The 'clear' storeOp is deprecated. Use 'discard' instead.");
}
return ValidateStoreOp(value);
}
MaybeError ValidateB2BCopyAlignment(uint64_t dataSize, MaybeError ValidateB2BCopyAlignment(uint64_t dataSize,
uint64_t srcOffset, uint64_t srcOffset,
uint64_t dstOffset) { uint64_t dstOffset) {
@ -232,7 +224,7 @@ namespace dawn_native {
} }
DAWN_TRY(ValidateLoadOp(colorAttachment.loadOp)); DAWN_TRY(ValidateLoadOp(colorAttachment.loadOp));
DAWN_TRY(ValidateDeprecatedStoreOp(device, colorAttachment.storeOp)); DAWN_TRY(ValidateStoreOp(colorAttachment.storeOp));
if (colorAttachment.loadOp == wgpu::LoadOp::Clear) { if (colorAttachment.loadOp == wgpu::LoadOp::Clear) {
if (std::isnan(colorAttachment.clearColor.r) || if (std::isnan(colorAttachment.clearColor.r) ||
@ -286,8 +278,8 @@ namespace dawn_native {
DAWN_TRY(ValidateLoadOp(depthStencilAttachment->depthLoadOp)); DAWN_TRY(ValidateLoadOp(depthStencilAttachment->depthLoadOp));
DAWN_TRY(ValidateLoadOp(depthStencilAttachment->stencilLoadOp)); DAWN_TRY(ValidateLoadOp(depthStencilAttachment->stencilLoadOp));
DAWN_TRY(ValidateDeprecatedStoreOp(device, depthStencilAttachment->depthStoreOp)); DAWN_TRY(ValidateStoreOp(depthStencilAttachment->depthStoreOp));
DAWN_TRY(ValidateDeprecatedStoreOp(device, depthStencilAttachment->stencilStoreOp)); DAWN_TRY(ValidateStoreOp(depthStencilAttachment->stencilStoreOp));
if (attachment->GetAspects() == (Aspect::Depth | Aspect::Stencil) && if (attachment->GetAspects() == (Aspect::Depth | Aspect::Stencil) &&
depthStencilAttachment->depthReadOnly != depthStencilAttachment->stencilReadOnly) { depthStencilAttachment->depthReadOnly != depthStencilAttachment->stencilReadOnly) {

View File

@ -36,7 +36,6 @@ namespace dawn_native { namespace d3d12 {
D3D12_RENDER_PASS_ENDING_ACCESS_TYPE D3D12EndingAccessType(wgpu::StoreOp storeOp) { D3D12_RENDER_PASS_ENDING_ACCESS_TYPE D3D12EndingAccessType(wgpu::StoreOp storeOp) {
switch (storeOp) { switch (storeOp) {
case wgpu::StoreOp::Discard: case wgpu::StoreOp::Discard:
case wgpu::StoreOp::Clear:
return D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_DISCARD; return D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_DISCARD;
case wgpu::StoreOp::Store: case wgpu::StoreOp::Store:
return D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE; return D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE;
@ -56,7 +55,7 @@ namespace dawn_native { namespace d3d12 {
ToBackend(resolveDestination->GetTexture())->GetD3D12Resource(); ToBackend(resolveDestination->GetTexture())->GetD3D12Resource();
// Clear or preserve the resolve source. // Clear or preserve the resolve source.
if (storeOp == wgpu::StoreOp::Discard || storeOp == wgpu::StoreOp::Clear) { if (storeOp == wgpu::StoreOp::Discard) {
resolveParameters.PreserveResolveSource = false; resolveParameters.PreserveResolveSource = false;
} else if (storeOp == wgpu::StoreOp::Store) { } else if (storeOp == wgpu::StoreOp::Store) {
resolveParameters.PreserveResolveSource = true; resolveParameters.PreserveResolveSource = true;

View File

@ -101,7 +101,6 @@ namespace dawn_native { namespace metal {
kMTLStoreActionStoreAndMultisampleResolve; kMTLStoreActionStoreAndMultisampleResolve;
break; break;
case wgpu::StoreOp::Discard: case wgpu::StoreOp::Discard:
case wgpu::StoreOp::Clear:
descriptor.colorAttachments[i].storeAction = descriptor.colorAttachments[i].storeAction =
MTLStoreActionMultisampleResolve; MTLStoreActionMultisampleResolve;
break; break;
@ -112,7 +111,6 @@ namespace dawn_native { namespace metal {
descriptor.colorAttachments[i].storeAction = MTLStoreActionStore; descriptor.colorAttachments[i].storeAction = MTLStoreActionStore;
break; break;
case wgpu::StoreOp::Discard: case wgpu::StoreOp::Discard:
case wgpu::StoreOp::Clear:
descriptor.colorAttachments[i].storeAction = MTLStoreActionDontCare; descriptor.colorAttachments[i].storeAction = MTLStoreActionDontCare;
break; break;
} }
@ -137,7 +135,6 @@ namespace dawn_native { namespace metal {
break; break;
case wgpu::StoreOp::Discard: case wgpu::StoreOp::Discard:
case wgpu::StoreOp::Clear:
descriptor.depthAttachment.storeAction = MTLStoreActionDontCare; descriptor.depthAttachment.storeAction = MTLStoreActionDontCare;
break; break;
} }
@ -165,7 +162,6 @@ namespace dawn_native { namespace metal {
break; break;
case wgpu::StoreOp::Discard: case wgpu::StoreOp::Discard:
case wgpu::StoreOp::Clear:
descriptor.stencilAttachment.storeAction = MTLStoreActionDontCare; descriptor.stencilAttachment.storeAction = MTLStoreActionDontCare;
break; break;
} }

View File

@ -1055,8 +1055,7 @@ namespace dawn_native { namespace opengl {
} }
} }
if (attachmentInfo->storeOp == wgpu::StoreOp::Discard || if (attachmentInfo->storeOp == wgpu::StoreOp::Discard) {
attachmentInfo->storeOp == wgpu::StoreOp::Clear) {
// TODO(natlee@microsoft.com): call glDiscard to do optimization // TODO(natlee@microsoft.com): call glDiscard to do optimization
} }
} }

View File

@ -34,46 +34,6 @@ class DeprecationTests : public DawnTest {
} }
}; };
// Test that StoreOp::Clear is deprecated.
TEST_P(DeprecationTests, StoreOpClear) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass;
// Check that a storeOp of Clear for color attachments raises a validation warning.
renderPass.renderPassInfo.cColorAttachments[0].storeOp = wgpu::StoreOp::Clear;
EXPECT_DEPRECATION_WARNING(pass = encoder.BeginRenderPass(&renderPass.renderPassInfo));
pass.EndPass();
// Check that a storeOp of Clear for depth/stencil attachments raises a validation warning.
wgpu::TextureDescriptor descriptor;
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size = {1, 1, 1};
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
wgpu::Texture depthStencil = device.CreateTexture(&descriptor);
wgpu::RenderPassDepthStencilAttachment* depthAttachment =
&renderPass.renderPassInfo.cDepthStencilAttachmentInfo;
renderPass.renderPassInfo.depthStencilAttachment = depthAttachment;
depthAttachment->view = depthStencil.CreateView();
renderPass.renderPassInfo.cColorAttachments[0].storeOp = wgpu::StoreOp::Discard;
depthAttachment->depthStoreOp = wgpu::StoreOp::Clear;
EXPECT_DEPRECATION_WARNING(pass = encoder.BeginRenderPass(&renderPass.renderPassInfo));
pass.EndPass();
depthAttachment->depthStoreOp = wgpu::StoreOp::Discard;
depthAttachment->stencilStoreOp = wgpu::StoreOp::Clear;
EXPECT_DEPRECATION_WARNING(pass = encoder.BeginRenderPass(&renderPass.renderPassInfo));
pass.EndPass();
}
// Test that readonly storage textures are deprecated // Test that readonly storage textures are deprecated
TEST_P(DeprecationTests, ReadOnlyStorageTextures) { TEST_P(DeprecationTests, ReadOnlyStorageTextures) {
// Control case: WriteOnly storage textures are allowed. // Control case: WriteOnly storage textures are allowed.