From b326f8c172f8a0331c4a675000b89b28dd2f07d6 Mon Sep 17 00:00:00 2001 From: Yunchao He Date: Mon, 12 Jul 2021 19:01:51 +0000 Subject: [PATCH] Remove UnsafeAPI toggle for 3D texture 3D texture implementation has already been done. It's time to remove the UnsafeAPI toggle for it. Bug: dawn:547 Change-Id: Ic9e0930d7906ee5274b9e412ebacb2574744b2b3 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/56480 Reviewed-by: Corentin Wallez Reviewed-by: Austin Eng Commit-Queue: Yunchao He --- src/dawn_native/CommandValidation.cpp | 7 ------- src/dawn_native/Texture.cpp | 14 -------------- .../validation/UnsafeAPIValidationTests.cpp | 16 ---------------- 3 files changed, 37 deletions(-) diff --git a/src/dawn_native/CommandValidation.cpp b/src/dawn_native/CommandValidation.cpp index e46d43804e..9654b2a5ea 100644 --- a/src/dawn_native/CommandValidation.cpp +++ b/src/dawn_native/CommandValidation.cpp @@ -268,13 +268,6 @@ namespace dawn_native { ASSERT(texture->GetDimension() != wgpu::TextureDimension::e1D); - // Disallow copy to/from a 3D texture as unsafe until it is fully implemented. - if (texture->GetDimension() == wgpu::TextureDimension::e3D && - device->IsToggleEnabled(Toggle::DisallowUnsafeAPIs)) { - return DAWN_VALIDATION_ERROR( - "Copy to/from a 3D texture is disallowed because it is not fully implemented"); - } - // Validation for the copy being in-bounds: Extent3D mipSize = texture->GetMipLevelPhysicalSize(textureCopy.mipLevel); // For 1D/2D textures, include the array layer as depth so it can be checked with other diff --git a/src/dawn_native/Texture.cpp b/src/dawn_native/Texture.cpp index 293e0a8b89..d9567d59f1 100644 --- a/src/dawn_native/Texture.cpp +++ b/src/dawn_native/Texture.cpp @@ -270,13 +270,6 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR("Cannot create an empty texture"); } - // Disallow 1D and 3D textures as unsafe until they are fully implemented. - if (descriptor->dimension != wgpu::TextureDimension::e2D && - device->IsToggleEnabled(Toggle::DisallowUnsafeAPIs)) { - return DAWN_VALIDATION_ERROR( - "1D and 3D textures are disallowed because they are not fully implemented"); - } - if (descriptor->dimension != wgpu::TextureDimension::e2D && format->isCompressed) { return DAWN_VALIDATION_ERROR("Compressed texture must be 2D"); } @@ -323,13 +316,6 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR("1D texture views aren't supported (yet)."); } - // Disallow 3D views as unsafe until they are fully implemented. - if (descriptor->dimension == wgpu::TextureViewDimension::e3D && - device->IsToggleEnabled(Toggle::DisallowUnsafeAPIs)) { - return DAWN_VALIDATION_ERROR( - "3D views are disallowed because they are not fully implemented"); - } - DAWN_TRY(ValidateTextureFormat(descriptor->format)); DAWN_TRY(ValidateTextureAspect(descriptor->aspect)); diff --git a/src/tests/unittests/validation/UnsafeAPIValidationTests.cpp b/src/tests/unittests/validation/UnsafeAPIValidationTests.cpp index 61b327154a..c5cab0fb41 100644 --- a/src/tests/unittests/validation/UnsafeAPIValidationTests.cpp +++ b/src/tests/unittests/validation/UnsafeAPIValidationTests.cpp @@ -28,22 +28,6 @@ class UnsafeAPIValidationTest : public ValidationTest { } }; -// Check that 3D Texture creation is disallowed as part of unsafe APIs. -TEST_F(UnsafeAPIValidationTest, 3DTextureCreationDisallowed) { - wgpu::TextureDescriptor baseDesc; - baseDesc.size = {32, 32, 6}; - baseDesc.format = wgpu::TextureFormat::RGBA8Unorm; - baseDesc.usage = wgpu::TextureUsage::Sampled; - - // Control case: 2D (array) texture creation is allowed. - device.CreateTexture(&baseDesc); - - // 3D texture creation is disallowed. - wgpu::TextureDescriptor texture3DDesc = baseDesc; - texture3DDesc.dimension = wgpu::TextureDimension::e3D; - ASSERT_DEVICE_ERROR(device.CreateTexture(&texture3DDesc)); -} - // Check that DrawIndexedIndirect is disallowed as part of unsafe APIs. TEST_F(UnsafeAPIValidationTest, DrawIndexedIndirectDisallowed) { // Create the index and indirect buffers.