Mark separate RODS as a safe API.
Bug: dawn:2146
Change-Id: I14876ac74d3b6070f389d5747ee527193d1ad4d1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/171782
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn/native/CommandEncoder.cpp b/src/dawn/native/CommandEncoder.cpp
index b78c5e7..93baa52 100644
--- a/src/dawn/native/CommandEncoder.cpp
+++ b/src/dawn/native/CommandEncoder.cpp
@@ -516,15 +516,6 @@
"The depth stencil attachment %s format (%s) is not renderable.", attachment,
format.format);
- if (!device->IsToggleEnabled(Toggle::AllowUnsafeAPIs)) {
- DAWN_INVALID_IF(
- attachment->GetAspects() == (Aspect::Depth | Aspect::Stencil) &&
- depthStencilAttachment->depthReadOnly != depthStencilAttachment->stencilReadOnly,
- "depthReadOnly (%u) and stencilReadOnly (%u) must be the same when texture aspect "
- "is 'all'.",
- depthStencilAttachment->depthReadOnly, depthStencilAttachment->stencilReadOnly);
- }
-
// Read only, or depth doesn't exist.
if (depthStencilAttachment->depthReadOnly ||
!IsSubset(Aspect::Depth, attachment->GetAspects())) {
diff --git a/src/dawn/native/RenderBundleEncoder.cpp b/src/dawn/native/RenderBundleEncoder.cpp
index 80b5aa4..01dd3a4 100644
--- a/src/dawn/native/RenderBundleEncoder.cpp
+++ b/src/dawn/native/RenderBundleEncoder.cpp
@@ -61,15 +61,6 @@
DAWN_TRY_ASSIGN(format, device->GetInternalFormat(textureFormat));
DAWN_INVALID_IF(!format->HasDepthOrStencil() || !format->isRenderable,
"Texture format %s is not depth/stencil renderable.", textureFormat);
-
- if (!device->IsToggleEnabled(Toggle::AllowUnsafeAPIs)) {
- DAWN_INVALID_IF(
- format->HasDepth() && format->HasStencil() && depthReadOnly != stencilReadOnly,
- "depthReadOnly (%u) and stencilReadOnly (%u) must be the same when format %s has "
- "both depth and stencil aspects.",
- depthReadOnly, stencilReadOnly, textureFormat);
- }
-
return {};
}
diff --git a/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp b/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp
index 4322f8c..3629d4d 100644
--- a/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp
+++ b/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp
@@ -70,71 +70,6 @@
)"));
}
-// Check that separate depth-stencil readonlyness is validated as unsafe for render passes.
-TEST_F(UnsafeAPIValidationTest, SeparateRenderPassDepthStencilReadOnlyness) {
- wgpu::TextureDescriptor tDesc;
- tDesc.size = {1, 1};
- tDesc.format = wgpu::TextureFormat::Depth24PlusStencil8;
- tDesc.usage = wgpu::TextureUsage::RenderAttachment;
- wgpu::Texture t = device.CreateTexture(&tDesc);
-
- // Control case: both readonly is valid.
- {
- wgpu::RenderPassDepthStencilAttachment ds;
- ds.view = t.CreateView();
- ds.depthReadOnly = true;
- ds.stencilReadOnly = true;
-
- wgpu::RenderPassDescriptor rp;
- rp.colorAttachmentCount = 0;
- rp.depthStencilAttachment = &ds;
-
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&rp);
- pass.End();
- encoder.Finish();
- }
-
- // Error case: only one readonly is invalid.
- {
- wgpu::RenderPassDepthStencilAttachment ds;
- ds.view = t.CreateView();
- ds.depthReadOnly = true;
- ds.stencilReadOnly = false;
- ds.stencilLoadOp = wgpu::LoadOp::Load;
- ds.stencilStoreOp = wgpu::StoreOp::Store;
-
- wgpu::RenderPassDescriptor rp;
- rp.colorAttachmentCount = 0;
- rp.depthStencilAttachment = &ds;
-
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&rp);
- pass.End();
- ASSERT_DEVICE_ERROR(encoder.Finish());
- }
-}
-
-// Check that separate depth-stencil readonlyness is validated as unsafe for render bundles.
-TEST_F(UnsafeAPIValidationTest, SeparateRenderBundleDepthStencilReadOnlyness) {
- utils::ComboRenderBundleEncoderDescriptor desc = {};
- desc.depthStencilFormat = wgpu::TextureFormat::Depth24PlusStencil8;
-
- // Control case: both readonly is valid.
- {
- desc.depthReadOnly = true;
- desc.stencilReadOnly = true;
- device.CreateRenderBundleEncoder(&desc);
- }
-
- // Error case: only one readonly is invalid.
- {
- desc.depthReadOnly = true;
- desc.stencilReadOnly = false;
- ASSERT_DEVICE_ERROR(device.CreateRenderBundleEncoder(&desc));
- }
-}
-
// Check that create 3D texture for the render attachment is validated as unsafe.
TEST_F(UnsafeAPIValidationTest, Create3DTextureForRenderAttachment) {
wgpu::TextureDescriptor descriptor;