Remove deprecated RenderPass*Attachment.attachment
Bug: dawn:762
Change-Id: I86144f77ffd647d2e5c01742fb67367c7a5c914e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63382
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn_native/AttachmentState.cpp b/src/dawn_native/AttachmentState.cpp
index 0aed5fa..42198dc 100644
--- a/src/dawn_native/AttachmentState.cpp
+++ b/src/dawn_native/AttachmentState.cpp
@@ -53,9 +53,6 @@
++i) {
TextureViewBase* attachment =
descriptor->colorAttachments[static_cast<uint8_t>(i)].view;
- if (attachment == nullptr) {
- attachment = descriptor->colorAttachments[static_cast<uint8_t>(i)].attachment;
- }
mColorAttachmentsSet.set(i);
mColorFormats[i] = attachment->GetFormat().format;
if (mSampleCount == 0) {
@@ -66,9 +63,6 @@
}
if (descriptor->depthStencilAttachment != nullptr) {
TextureViewBase* attachment = descriptor->depthStencilAttachment->view;
- if (attachment == nullptr) {
- attachment = descriptor->depthStencilAttachment->attachment;
- }
mDepthStencilFormat = attachment->GetFormat().format;
if (mSampleCount == 0) {
mSampleCount = attachment->GetTexture()->GetSampleCount();
diff --git a/src/dawn_native/CommandEncoder.cpp b/src/dawn_native/CommandEncoder.cpp
index 7cd8c7f..eb38cf4 100644
--- a/src/dawn_native/CommandEncoder.cpp
+++ b/src/dawn_native/CommandEncoder.cpp
@@ -170,8 +170,7 @@
}
const TextureViewBase* resolveTarget = colorAttachment.resolveTarget;
- const TextureViewBase* attachment =
- colorAttachment.view != nullptr ? colorAttachment.view : colorAttachment.attachment;
+ const TextureViewBase* attachment = colorAttachment.view;
DAWN_TRY(device->ValidateObject(colorAttachment.resolveTarget));
DAWN_TRY(ValidateCanUseAs(colorAttachment.resolveTarget->GetTexture(),
wgpu::TextureUsage::RenderAttachment));
@@ -220,24 +219,7 @@
uint32_t* width,
uint32_t* height,
uint32_t* sampleCount) {
- TextureViewBase* attachment;
- if (colorAttachment.view != nullptr) {
- if (colorAttachment.attachment != nullptr) {
- return DAWN_VALIDATION_ERROR(
- "Cannot specify both a attachment and view. attachment is deprecated, "
- "favor view instead.");
- }
- attachment = colorAttachment.view;
- } else if (colorAttachment.attachment != nullptr) {
- device->EmitDeprecationWarning(
- "RenderPassColorAttachmentDescriptor.attachment has been deprecated. Use "
- "RenderPassColorAttachmentDescriptor.view instead.");
- attachment = colorAttachment.attachment;
- } else {
- return DAWN_VALIDATION_ERROR(
- "Must specify a view for RenderPassColorAttachmentDescriptor");
- }
-
+ TextureViewBase* attachment = colorAttachment.view;
DAWN_TRY(device->ValidateObject(attachment));
DAWN_TRY(
ValidateCanUseAs(attachment->GetTexture(), wgpu::TextureUsage::RenderAttachment));
@@ -279,24 +261,7 @@
uint32_t* sampleCount) {
DAWN_ASSERT(depthStencilAttachment != nullptr);
- TextureViewBase* attachment;
- if (depthStencilAttachment->view != nullptr) {
- if (depthStencilAttachment->attachment != nullptr) {
- return DAWN_VALIDATION_ERROR(
- "Cannot specify both a attachment and view. attachment is deprecated, "
- "favor view instead.");
- }
- attachment = depthStencilAttachment->view;
- } else if (depthStencilAttachment->attachment != nullptr) {
- device->EmitDeprecationWarning(
- "RenderPassDepthStencilAttachmentDescriptor.attachment has been deprecated. "
- "Use RenderPassDepthStencilAttachmentDescriptor.view instead.");
- attachment = depthStencilAttachment->attachment;
- } else {
- return DAWN_VALIDATION_ERROR(
- "Must specify a view for RenderPassDepthStencilAttachmentDescriptor");
- }
-
+ TextureViewBase* attachment = depthStencilAttachment->view;
DAWN_TRY(device->ValidateObject(attachment));
DAWN_TRY(
ValidateCanUseAs(attachment->GetTexture(), wgpu::TextureUsage::RenderAttachment));
@@ -571,9 +536,6 @@
IterateBitSet(cmd->attachmentState->GetColorAttachmentsMask())) {
uint8_t i = static_cast<uint8_t>(index);
TextureViewBase* view = descriptor->colorAttachments[i].view;
- if (view == nullptr) {
- view = descriptor->colorAttachments[i].attachment;
- }
TextureViewBase* resolveTarget = descriptor->colorAttachments[i].resolveTarget;
cmd->colorAttachments[index].view = view;
@@ -593,9 +555,6 @@
if (cmd->attachmentState->HasDepthStencilAttachment()) {
TextureViewBase* view = descriptor->depthStencilAttachment->view;
- if (view == nullptr) {
- view = descriptor->depthStencilAttachment->attachment;
- }
cmd->depthStencilAttachment.view = view;
cmd->depthStencilAttachment.clearDepth =
diff --git a/src/tests/end2end/DeprecatedAPITests.cpp b/src/tests/end2end/DeprecatedAPITests.cpp
index 9f28ddd..10597ae 100644
--- a/src/tests/end2end/DeprecatedAPITests.cpp
+++ b/src/tests/end2end/DeprecatedAPITests.cpp
@@ -34,44 +34,6 @@
}
};
-// Test that setting attachment rather than view for render pass color and depth/stencil attachments
-// is deprecated.
-TEST_P(DeprecationTests, SetAttachmentDescriptorAttachment) {
- utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::RenderPassEncoder pass;
-
- // Check that using .attachment with color attachments gives the warning.
- wgpu::RenderPassColorAttachment* colorAttachment =
- &renderPass.renderPassInfo.cColorAttachments[0];
- colorAttachment->attachment = colorAttachment->view;
- colorAttachment->view = nullptr;
-
- EXPECT_DEPRECATION_WARNING(pass = encoder.BeginRenderPass(&renderPass.renderPassInfo));
- pass.EndPass();
-
- colorAttachment->view = colorAttachment->attachment;
- colorAttachment->attachment = nullptr;
-
- // Check that using .attachment with depth/stencil attachments gives the 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->attachment = depthStencil.CreateView();
-
- EXPECT_DEPRECATION_WARNING(pass = encoder.BeginRenderPass(&renderPass.renderPassInfo));
- pass.EndPass();
-}
-
// Test that setting computeStage in a ComputePipelineDescriptor is deprecated.
TEST_P(DeprecationTests, ComputeStage) {
wgpu::ComputePipelineDescriptor csDesc;
diff --git a/src/tests/white_box/D3D12DescriptorHeapTests.cpp b/src/tests/white_box/D3D12DescriptorHeapTests.cpp
index 77e6b80..b38eb5f 100644
--- a/src/tests/white_box/D3D12DescriptorHeapTests.cpp
+++ b/src/tests/white_box/D3D12DescriptorHeapTests.cpp
@@ -763,7 +763,7 @@
utils::ComboRenderPassDescriptor renderPassDesc({textureView});
renderPassDesc.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
renderPassDesc.cColorAttachments[0].clearColor = {0.0f, 1.0f, 0.0f, 1.0f};
- renderPass.renderPassInfo.cColorAttachments[0].attachment = textureView;
+ renderPass.renderPassInfo.cColorAttachments[0].view = textureView;
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
auto pass = encoder.BeginRenderPass(&renderPassDesc);