mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 09:25:25 +00:00
Validate that DS attachment must cover all aspects of the texture.
It isn't clear if this should be a limitation of the WebGPU specification. Until further investigation is done, disallow it in Dawn to avoid undefiend behavior. Bug: dawn:812 Change-Id: Iab8208f1ea479263b08ede41374ce1a680ce191e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53387 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
6133e5cf3d
commit
5a53eb3113
@@ -880,6 +880,62 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
// Check that the depth stencil attachment must use all aspects.
|
||||
TEST_F(RenderPassDescriptorValidationTest, ValidateDepthStencilAllAspects) {
|
||||
wgpu::TextureDescriptor texDesc;
|
||||
texDesc.usage = wgpu::TextureUsage::RenderAttachment;
|
||||
texDesc.size = {1, 1, 1};
|
||||
|
||||
wgpu::TextureViewDescriptor viewDesc;
|
||||
viewDesc.baseMipLevel = 0;
|
||||
viewDesc.mipLevelCount = 1;
|
||||
viewDesc.baseArrayLayer = 0;
|
||||
viewDesc.arrayLayerCount = 1;
|
||||
|
||||
// Using all aspects of a depth+stencil texture is allowed.
|
||||
{
|
||||
texDesc.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
viewDesc.aspect = wgpu::TextureAspect::All;
|
||||
|
||||
wgpu::TextureView view = device.CreateTexture(&texDesc).CreateView(&viewDesc);
|
||||
utils::ComboRenderPassDescriptor renderPass({}, view);
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
||||
// Using only depth of a depth+stencil texture is an error.
|
||||
{
|
||||
texDesc.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
viewDesc.aspect = wgpu::TextureAspect::DepthOnly;
|
||||
|
||||
wgpu::TextureView view = device.CreateTexture(&texDesc).CreateView(&viewDesc);
|
||||
utils::ComboRenderPassDescriptor renderPass({}, view);
|
||||
AssertBeginRenderPassError(&renderPass);
|
||||
}
|
||||
|
||||
// Using only stencil of a depth+stencil texture is an error.
|
||||
{
|
||||
texDesc.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
viewDesc.aspect = wgpu::TextureAspect::StencilOnly;
|
||||
|
||||
wgpu::TextureView view = device.CreateTexture(&texDesc).CreateView(&viewDesc);
|
||||
utils::ComboRenderPassDescriptor renderPass({}, view);
|
||||
AssertBeginRenderPassError(&renderPass);
|
||||
}
|
||||
|
||||
// Using DepthOnly of a depth only texture us allowed.
|
||||
{
|
||||
texDesc.format = wgpu::TextureFormat::Depth24Plus;
|
||||
viewDesc.aspect = wgpu::TextureAspect::DepthOnly;
|
||||
|
||||
wgpu::TextureView view = device.CreateTexture(&texDesc).CreateView(&viewDesc);
|
||||
utils::ComboRenderPassDescriptor renderPass({}, view);
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
||||
// TODO(https://crbug.com/dawn/666): Add a test case for stencil-only on stencil8 once this
|
||||
// format is supported.
|
||||
}
|
||||
|
||||
// TODO(cwallez@chromium.org): Constraints on attachment aliasing?
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
Reference in New Issue
Block a user