Revise readonly depth/stencil compability between pass and bundle
Bug: dawn:485
Change-Id: I4082d2c255ce24440f0d6a34b5cb6fe6cb2e9c63
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68462
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
diff --git a/src/dawn_native/RenderPassEncoder.cpp b/src/dawn_native/RenderPassEncoder.cpp
index 277e2d7..d03e64f 100644
--- a/src/dawn_native/RenderPassEncoder.cpp
+++ b/src/dawn_native/RenderPassEncoder.cpp
@@ -248,13 +248,13 @@
bool depthReadOnlyInBundle = renderBundles[i]->IsDepthReadOnly();
DAWN_INVALID_IF(
- depthReadOnlyInPass != depthReadOnlyInBundle,
+ depthReadOnlyInPass && !depthReadOnlyInBundle,
"DepthReadOnly (%u) of renderBundle[%i] (%s) is not compatible "
"with DepthReadOnly (%u) of %s.",
depthReadOnlyInBundle, i, renderBundles[i], depthReadOnlyInPass, this);
bool stencilReadOnlyInBundle = renderBundles[i]->IsStencilReadOnly();
- DAWN_INVALID_IF(stencilReadOnlyInPass != stencilReadOnlyInBundle,
+ DAWN_INVALID_IF(stencilReadOnlyInPass && !stencilReadOnlyInBundle,
"StencilReadOnly (%u) of renderBundle[%i] (%s) is not "
"compatible with StencilReadOnly (%u) of %s.",
stencilReadOnlyInBundle, i, renderBundles[i],
diff --git a/src/tests/unittests/validation/PipelineAndPassCompatibilityTests.cpp b/src/tests/unittests/validation/PipelineAndPassCompatibilityTests.cpp
index e6838fe..f3de6bf 100644
--- a/src/tests/unittests/validation/PipelineAndPassCompatibilityTests.cpp
+++ b/src/tests/unittests/validation/PipelineAndPassCompatibilityTests.cpp
@@ -163,10 +163,10 @@
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&passDescriptor);
pass.ExecuteBundles(1, &bundle);
pass.EndPass();
- if (depthStencilReadOnlyInPass != depthStencilReadOnlyInBundle) {
- ASSERT_DEVICE_ERROR(encoder.Finish());
- } else {
+ if (!depthStencilReadOnlyInPass || depthStencilReadOnlyInBundle) {
encoder.Finish();
+ } else {
+ ASSERT_DEVICE_ERROR(encoder.Finish());
}
}
}