mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-15 08:06:19 +00:00
Add depth/stencilReadOnly and validations in RenderBundleEncoderDescriptor
This change adds two arguments depthReadOnly and stencilReadOnly into RenderBundleEncoderDescriptor in order to follow WebGPU spec. It also adds one more validation rule: depthReadOnly must be equal to stencilReadOnly if depthStencilFormat has both depth and stencil aspects in RenderBundleEncoderDescriptor. We have already had a similar validation rule in RenderPassDepthStencilAttachment in RenderPassDescriptor. Bug: dawn:485 Change-Id: I32c45b2bd90c7041aa881d8589720a9146d6ac7e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66501 Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
@@ -626,6 +626,27 @@ TEST_F(RenderBundleValidationTest, DepthStencilFormatUndefined) {
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderBundleEncoder(&desc));
|
||||
}
|
||||
|
||||
// Test that depthReadOnly must be equal to stencilReadOnly if depth stencil format contain
|
||||
// both depth and stencil formats.
|
||||
TEST_F(RenderBundleValidationTest, DepthStencilReadOnly) {
|
||||
for (wgpu::TextureFormat format :
|
||||
{wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureFormat::Depth32Float}) {
|
||||
for (bool depthReadOnly : {true, false}) {
|
||||
for (bool stencilReadOnly : {true, false}) {
|
||||
utils::ComboRenderBundleEncoderDescriptor desc = {};
|
||||
desc.depthStencilFormat = format;
|
||||
desc.depthReadOnly = depthReadOnly;
|
||||
desc.stencilReadOnly = stencilReadOnly;
|
||||
if (format == wgpu::TextureFormat::Depth24PlusStencil8 &&
|
||||
depthReadOnly != stencilReadOnly) {
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderBundleEncoder(&desc));
|
||||
} else {
|
||||
device.CreateRenderBundleEncoder(&desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Test that resource usages are validated inside render bundles.
|
||||
TEST_F(RenderBundleValidationTest, UsageTracking) {
|
||||
DummyRenderPass renderPass(device);
|
||||
|
||||
Reference in New Issue
Block a user