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>
This commit is contained in:
parent
96ac969a33
commit
1ac4565115
10
dawn.json
10
dawn.json
|
@ -1370,19 +1370,18 @@
|
|||
"render pass color attachment": {
|
||||
"category": "structure",
|
||||
"members": [
|
||||
{"name": "view", "type": "texture view", "optional": true},
|
||||
{"name": "view", "type": "texture view"},
|
||||
{"name": "resolve target", "type": "texture view", "optional": true},
|
||||
{"name": "load op", "type": "load op"},
|
||||
{"name": "store op", "type": "store op"},
|
||||
{"name": "clear color", "type": "color"},
|
||||
{"name": "attachment", "type": "texture view", "optional": true}
|
||||
{"name": "clear color", "type": "color"}
|
||||
]
|
||||
},
|
||||
|
||||
"render pass depth stencil attachment": {
|
||||
"category": "structure",
|
||||
"members": [
|
||||
{"name": "view", "type": "texture view", "optional": true},
|
||||
{"name": "view", "type": "texture view"},
|
||||
{"name": "depth load op", "type": "load op"},
|
||||
{"name": "depth store op", "type": "store op"},
|
||||
{"name": "clear depth", "type": "float"},
|
||||
|
@ -1390,8 +1389,7 @@
|
|||
{"name": "stencil load op", "type": "load op"},
|
||||
{"name": "stencil store op", "type": "store op"},
|
||||
{"name": "clear stencil", "type": "uint32_t", "default": "0"},
|
||||
{"name": "stencil read only", "type": "bool", "default": "false"},
|
||||
{"name": "attachment", "type": "texture view", "optional": true}
|
||||
{"name": "stencil read only", "type": "bool", "default": "false"}
|
||||
]
|
||||
},
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ void frame() {
|
|||
WGPURenderPassDescriptor renderpassInfo = {};
|
||||
WGPURenderPassColorAttachment colorAttachment = {};
|
||||
{
|
||||
colorAttachment.attachment = backbufferView;
|
||||
colorAttachment.view = backbufferView;
|
||||
colorAttachment.resolveTarget = nullptr;
|
||||
colorAttachment.clearColor = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
colorAttachment.loadOp = WGPULoadOp_Clear;
|
||||
|
|
|
@ -53,9 +53,6 @@ namespace dawn_native {
|
|||
++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 @@ namespace dawn_native {
|
|||
}
|
||||
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();
|
||||
|
|
|
@ -170,8 +170,7 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
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 @@ namespace dawn_native {
|
|||
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 @@ namespace dawn_native {
|
|||
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 @@ namespace dawn_native {
|
|||
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 @@ namespace dawn_native {
|
|||
|
||||
if (cmd->attachmentState->HasDepthStencilAttachment()) {
|
||||
TextureViewBase* view = descriptor->depthStencilAttachment->view;
|
||||
if (view == nullptr) {
|
||||
view = descriptor->depthStencilAttachment->attachment;
|
||||
}
|
||||
|
||||
cmd->depthStencilAttachment.view = view;
|
||||
cmd->depthStencilAttachment.clearDepth =
|
||||
|
|
|
@ -34,44 +34,6 @@ class DeprecationTests : public DawnTest {
|
|||
}
|
||||
};
|
||||
|
||||
// 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;
|
||||
|
|
|
@ -763,7 +763,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue