mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
Deprecate renderpass color/depth .attachment
As of https://github.com/gpuweb/gpuweb/pull/1352 the spec indicates that GPURenderPassColorAttachmentDescriptor and GPURenderPassDepthStencilAttachmentDescriptor should use .view rather than .attachment to indicate the TextureView associated with the render pass attachment. Bug: dawn:762 Change-Id: I70d615e19d8e7aae5b26aa5965c7109289ab868b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47902 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Brandon Jones <bajones@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
12953caa42
commit
5e6a092703
@@ -63,6 +63,44 @@ TEST_P(DeprecationTests, SetSetBlendColor) {
|
||||
pass.EndPass();
|
||||
}
|
||||
|
||||
// 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::RenderPassColorAttachmentDescriptor* 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::RenderPassDepthStencilAttachmentDescriptor* depthAttachment =
|
||||
&renderPass.renderPassInfo.cDepthStencilAttachmentInfo;
|
||||
renderPass.renderPassInfo.depthStencilAttachment = depthAttachment;
|
||||
depthAttachment->attachment = depthStencil.CreateView();
|
||||
|
||||
EXPECT_DEPRECATION_WARNING(pass = encoder.BeginRenderPass(&renderPass.renderPassInfo));
|
||||
pass.EndPass();
|
||||
}
|
||||
|
||||
// Test that BindGroupLayoutEntry cannot have a type if buffer, sampler, texture, or storageTexture
|
||||
// are defined.
|
||||
TEST_P(DeprecationTests, BindGroupLayoutEntryTypeConflict) {
|
||||
|
||||
@@ -172,7 +172,7 @@ class MultisampledRenderingTest : public DawnTest {
|
||||
renderPass.cDepthStencilAttachmentInfo.depthLoadOp = depthStencilLoadOp;
|
||||
|
||||
if (hasDepthStencilAttachment) {
|
||||
renderPass.cDepthStencilAttachmentInfo.attachment = mDepthStencilView;
|
||||
renderPass.cDepthStencilAttachmentInfo.view = mDepthStencilView;
|
||||
renderPass.depthStencilAttachment = &renderPass.cDepthStencilAttachmentInfo;
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ TEST_P(TextureZeroInitTest, RenderingMipMapClearsToZero) {
|
||||
renderPass.renderPassInfo.cColorAttachments[0].loadOp = wgpu::LoadOp::Load;
|
||||
// Specify non-zero clear color. It should still be cleared to zero.
|
||||
renderPass.renderPassInfo.cColorAttachments[0].clearColor = {0.5f, 0.5f, 0.5f, 0.5f};
|
||||
renderPass.renderPassInfo.cColorAttachments[0].attachment = view;
|
||||
renderPass.renderPassInfo.cColorAttachments[0].view = view;
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
@@ -248,7 +248,7 @@ TEST_P(TextureZeroInitTest, RenderingArrayLayerClearsToZero) {
|
||||
renderPass.renderPassInfo.cColorAttachments[0].loadOp = wgpu::LoadOp::Load;
|
||||
// Specify non-zero clear color. It should still be cleared to zero.
|
||||
renderPass.renderPassInfo.cColorAttachments[0].clearColor = {0.5f, 0.5f, 0.5f, 0.5f};
|
||||
renderPass.renderPassInfo.cColorAttachments[0].attachment = view;
|
||||
renderPass.renderPassInfo.cColorAttachments[0].view = view;
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
|
||||
@@ -119,23 +119,23 @@ namespace {
|
||||
// We cannot use utils::ComboRenderPassDescriptor here because it only supports at most
|
||||
// kMaxColorAttachments(4) color attachments.
|
||||
std::array<wgpu::RenderPassColorAttachmentDescriptor, 5> colorAttachments;
|
||||
colorAttachments[0].attachment = color0;
|
||||
colorAttachments[0].view = color0;
|
||||
colorAttachments[0].resolveTarget = nullptr;
|
||||
colorAttachments[0].clearColor = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
colorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
colorAttachments[0].storeOp = wgpu::StoreOp::Store;
|
||||
|
||||
colorAttachments[1] = colorAttachments[0];
|
||||
colorAttachments[1].attachment = color1;
|
||||
colorAttachments[1].view = color1;
|
||||
|
||||
colorAttachments[2] = colorAttachments[0];
|
||||
colorAttachments[2].attachment = color2;
|
||||
colorAttachments[2].view = color2;
|
||||
|
||||
colorAttachments[3] = colorAttachments[0];
|
||||
colorAttachments[3].attachment = color3;
|
||||
colorAttachments[3].view = color3;
|
||||
|
||||
colorAttachments[4] = colorAttachments[0];
|
||||
colorAttachments[4].attachment =
|
||||
colorAttachments[4].view =
|
||||
Create2DAttachment(device, 1, 1, wgpu::TextureFormat::RGBA8Unorm);
|
||||
|
||||
wgpu::RenderPassDescriptor renderPass;
|
||||
|
||||
@@ -220,7 +220,7 @@ ValidationTest::DummyRenderPass::DummyRenderPass(const wgpu::Device& device)
|
||||
attachment = device.CreateTexture(&descriptor);
|
||||
|
||||
wgpu::TextureView view = attachment.CreateView();
|
||||
mColorAttachment.attachment = view;
|
||||
mColorAttachment.view = view;
|
||||
mColorAttachment.resolveTarget = nullptr;
|
||||
mColorAttachment.clearColor = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
mColorAttachment.loadOp = wgpu::LoadOp::Clear;
|
||||
|
||||
Reference in New Issue
Block a user