Deprecate TextureDescriptor::arrayLayerCount -> size.depth

This updates CL:

 - Adds a deprecation warning to use size.depth instead of
arrayLayerCount.
 - Changes all tests and samples to use size.depth.
 - Adds deprecation tests for the change.

In particular the state tracking in TextureBase isn't changed yet
because it requires non-trivial changes in the backends. It will be done
in a follow-up CL.

Bug:dawn:22

Change-Id: Ic02dfb5baaba8d5b06cd339ce988e9b1d16cb5e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23101
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/examples/CppHelloTriangle.cpp b/examples/CppHelloTriangle.cpp
index bc89a47..44a26ca 100644
--- a/examples/CppHelloTriangle.cpp
+++ b/examples/CppHelloTriangle.cpp
@@ -56,7 +56,6 @@
     descriptor.size.width = 1024;
     descriptor.size.height = 1024;
     descriptor.size.depth = 1;
-    descriptor.arrayLayerCount = 1;
     descriptor.sampleCount = 1;
     descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
     descriptor.mipLevelCount = 1;
diff --git a/examples/SampleUtils.cpp b/examples/SampleUtils.cpp
index 0e38786..17b7c9e 100644
--- a/examples/SampleUtils.cpp
+++ b/examples/SampleUtils.cpp
@@ -189,7 +189,6 @@
     descriptor.size.width = 640;
     descriptor.size.height = 480;
     descriptor.size.depth = 1;
-    descriptor.arrayLayerCount = 1;
     descriptor.sampleCount = 1;
     descriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
     descriptor.mipLevelCount = 1;
diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp
index 211c321..697b741 100644
--- a/src/dawn_native/Device.cpp
+++ b/src/dawn_native/Device.cpp
@@ -1001,6 +1001,13 @@
     ResultOrError<Ref<TextureBase>> DeviceBase::CreateTextureInternal(
         const TextureDescriptor* descriptor) {
         DAWN_TRY(ValidateIsAlive());
+
+        // TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
+        // GPUTextureDescriptor.size.depth is done.
+        TextureDescriptor fixedDescriptor;
+        DAWN_TRY_ASSIGN(fixedDescriptor, FixTextureDescriptor(this, descriptor));
+        descriptor = &fixedDescriptor;
+
         if (IsValidationEnabled()) {
             DAWN_TRY(ValidateTextureDescriptor(this, descriptor));
         }
diff --git a/src/dawn_native/SwapChain.cpp b/src/dawn_native/SwapChain.cpp
index d90c975..3650fc0 100644
--- a/src/dawn_native/SwapChain.cpp
+++ b/src/dawn_native/SwapChain.cpp
@@ -102,7 +102,6 @@
         desc.usage = swapChain->GetUsage();
         desc.dimension = wgpu::TextureDimension::e2D;
         desc.size = {swapChain->GetWidth(), swapChain->GetHeight(), 1};
-        desc.arrayLayerCount = 1;
         desc.format = swapChain->GetFormat();
         desc.mipLevelCount = 1;
         desc.sampleCount = 1;
@@ -181,7 +180,6 @@
         descriptor.size.width = mWidth;
         descriptor.size.height = mHeight;
         descriptor.size.depth = 1;
-        descriptor.arrayLayerCount = 1;
         descriptor.sampleCount = 1;
         descriptor.format = mFormat;
         descriptor.mipLevelCount = 1;
diff --git a/src/dawn_native/Texture.cpp b/src/dawn_native/Texture.cpp
index 3a39ffa..d58fb32 100644
--- a/src/dawn_native/Texture.cpp
+++ b/src/dawn_native/Texture.cpp
@@ -101,8 +101,9 @@
 
                 // Multisampled 2D array texture is not supported because on Metal it requires the
                 // version of macOS be greater than 10.14.
-                if (descriptor->arrayLayerCount > 1) {
-                    return DAWN_VALIDATION_ERROR("Multisampled 2D array texture is not supported.");
+                if (descriptor->size.depth > 1) {
+                    return DAWN_VALIDATION_ERROR(
+                        "Multisampled textures with depth > 1 are not supported.");
                 }
 
                 if (format->isCompressed) {
@@ -163,7 +164,8 @@
                     "The size of the texture is incompatible with the texture format");
             }
 
-            if (descriptor->arrayLayerCount > kMaxTexture2DArrayLayers) {
+            if (descriptor->dimension == wgpu::TextureDimension::e2D &&
+                descriptor->size.depth > kMaxTexture2DArrayLayers) {
                 return DAWN_VALIDATION_ERROR("Texture 2D array layer count exceeded");
             }
             if (descriptor->mipLevelCount > kMaxTexture2DMipLevels) {
@@ -218,8 +220,7 @@
 
         // TODO(jiawei.shao@intel.com): check stuff based on the dimension
         if (descriptor->size.width == 0 || descriptor->size.height == 0 ||
-            descriptor->size.depth == 0 || descriptor->arrayLayerCount == 0 ||
-            descriptor->mipLevelCount == 0) {
+            descriptor->size.depth == 0 || descriptor->mipLevelCount == 0) {
             return DAWN_VALIDATION_ERROR("Cannot create an empty texture");
         }
 
@@ -326,6 +327,25 @@
         return desc;
     }
 
+    ResultOrError<TextureDescriptor> FixTextureDescriptor(DeviceBase* device,
+                                                          const TextureDescriptor* desc) {
+        TextureDescriptor fixedDesc = *desc;
+
+        if (desc->arrayLayerCount != 1) {
+            if (desc->size.depth != 1) {
+                return DAWN_VALIDATION_ERROR("arrayLayerCount and size.depth cannot both be != 1");
+            } else {
+                fixedDesc.size.depth = fixedDesc.arrayLayerCount;
+                fixedDesc.arrayLayerCount = 1;
+                device->EmitDeprecationWarning(
+                    "wgpu::TextureDescriptor::arrayLayerCount is deprecated in favor of "
+                    "::size::depth");
+            }
+        }
+
+        return {std::move(fixedDesc)};
+    }
+
     bool IsValidSampleCount(uint32_t sampleCount) {
         switch (sampleCount) {
             case 1:
@@ -352,11 +372,17 @@
           mDimension(descriptor->dimension),
           mFormat(device->GetValidInternalFormat(descriptor->format)),
           mSize(descriptor->size),
-          mArrayLayerCount(descriptor->arrayLayerCount),
+          mArrayLayerCount(descriptor->size.depth),
           mMipLevelCount(descriptor->mipLevelCount),
           mSampleCount(descriptor->sampleCount),
           mUsage(descriptor->usage),
           mState(state) {
+        // TODO(cwallez@chromium.org): Store the array layers in size.depth instead if extracting it
+        // in mArrayLayerCount.
+        ASSERT(mDimension == wgpu::TextureDimension::e2D);
+        mArrayLayerCount = mSize.depth;
+        mSize.depth = 1;
+
         uint32_t subresourceCount = GetSubresourceCount();
         mIsSubresourceContentInitializedAtIndex = std::vector<bool>(subresourceCount, false);
 
diff --git a/src/dawn_native/Texture.h b/src/dawn_native/Texture.h
index 964a1ac..3beafb6 100644
--- a/src/dawn_native/Texture.h
+++ b/src/dawn_native/Texture.h
@@ -32,6 +32,11 @@
         const TextureBase* texture,
         const TextureViewDescriptor* descriptor);
 
+    // TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
+    // GPUTextureDescriptor.size.depth is done.
+    ResultOrError<TextureDescriptor> FixTextureDescriptor(DeviceBase* device,
+                                                          const TextureDescriptor* desc);
+
     bool IsValidSampleCount(uint32_t sampleCount);
 
     static constexpr wgpu::TextureUsage kReadOnlyTextureUsages =
diff --git a/src/dawn_native/d3d12/TextureD3D12.cpp b/src/dawn_native/d3d12/TextureD3D12.cpp
index 0c3f6ee..d44014b 100644
--- a/src/dawn_native/d3d12/TextureD3D12.cpp
+++ b/src/dawn_native/d3d12/TextureD3D12.cpp
@@ -336,8 +336,8 @@
             return DAWN_VALIDATION_ERROR("Mip level count must be 1");
         }
 
-        if (descriptor->arrayLayerCount != 1) {
-            return DAWN_VALIDATION_ERROR("Array layer count must be 1");
+        if (descriptor->size.depth != 1) {
+            return DAWN_VALIDATION_ERROR("Depth must be 1");
         }
 
         if (descriptor->sampleCount != 1) {
@@ -393,6 +393,12 @@
         const TextureDescriptor* textureDescriptor =
             reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
 
+        // TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
+        // GPUTextureDescriptor.size.depth is done.
+        TextureDescriptor fixedDescriptor;
+        DAWN_TRY_ASSIGN(fixedDescriptor, FixTextureDescriptor(device, textureDescriptor));
+        textureDescriptor = &fixedDescriptor;
+
         Ref<Texture> dawnTexture =
             AcquireRef(new Texture(device, textureDescriptor, TextureState::OwnedExternal));
         DAWN_TRY(dawnTexture->InitializeAsExternalTexture(textureDescriptor, sharedHandle,
diff --git a/src/dawn_native/metal/DeviceMTL.mm b/src/dawn_native/metal/DeviceMTL.mm
index d53e2e1..d8d0feb 100644
--- a/src/dawn_native/metal/DeviceMTL.mm
+++ b/src/dawn_native/metal/DeviceMTL.mm
@@ -269,6 +269,15 @@
                                                         uint32_t plane) {
         const TextureDescriptor* textureDescriptor =
             reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
+
+        // TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
+        // GPUTextureDescriptor.size.depth is done.
+        TextureDescriptor fixedDescriptor;
+        if (ConsumedError(FixTextureDescriptor(this, textureDescriptor), &fixedDescriptor)) {
+            return nullptr;
+        }
+        textureDescriptor = &fixedDescriptor;
+
         if (ConsumedError(ValidateTextureDescriptor(this, textureDescriptor))) {
             return nullptr;
         }
diff --git a/src/dawn_native/metal/TextureMTL.mm b/src/dawn_native/metal/TextureMTL.mm
index 3ed3b48..88184ee 100644
--- a/src/dawn_native/metal/TextureMTL.mm
+++ b/src/dawn_native/metal/TextureMTL.mm
@@ -275,7 +275,7 @@
             return DAWN_VALIDATION_ERROR("IOSurface mip level count must be 1");
         }
 
-        if (descriptor->arrayLayerCount != 1) {
+        if (descriptor->size.depth != 1) {
             return DAWN_VALIDATION_ERROR("IOSurface array layer count must be 1");
         }
 
@@ -301,17 +301,18 @@
 
     MTLTextureDescriptor* CreateMetalTextureDescriptor(const TextureDescriptor* descriptor) {
         MTLTextureDescriptor* mtlDesc = [MTLTextureDescriptor new];
-        mtlDesc.textureType = MetalTextureType(descriptor->dimension, descriptor->arrayLayerCount,
+        mtlDesc.textureType = MetalTextureType(descriptor->dimension, descriptor->size.depth,
                                                descriptor->sampleCount);
         mtlDesc.usage = MetalTextureUsage(descriptor->usage);
         mtlDesc.pixelFormat = MetalPixelFormat(descriptor->format);
 
         mtlDesc.width = descriptor->size.width;
         mtlDesc.height = descriptor->size.height;
-        mtlDesc.depth = descriptor->size.depth;
+        ASSERT(descriptor->dimension == wgpu::TextureDimension::e2D);
+        mtlDesc.depth = 1;
 
         mtlDesc.mipmapLevelCount = descriptor->mipLevelCount;
-        mtlDesc.arrayLength = descriptor->arrayLayerCount;
+        mtlDesc.arrayLength = descriptor->size.depth;
         mtlDesc.storageMode = MTLStorageModePrivate;
 
         mtlDesc.sampleCount = descriptor->sampleCount;
diff --git a/src/dawn_native/opengl/TextureGL.cpp b/src/dawn_native/opengl/TextureGL.cpp
index 7a18130..1236d47 100644
--- a/src/dawn_native/opengl/TextureGL.cpp
+++ b/src/dawn_native/opengl/TextureGL.cpp
@@ -28,7 +28,7 @@
         GLenum TargetForTexture(const TextureDescriptor* descriptor) {
             switch (descriptor->dimension) {
                 case wgpu::TextureDimension::e2D:
-                    if (descriptor->arrayLayerCount > 1) {
+                    if (descriptor->size.depth > 1) {
                         ASSERT(descriptor->sampleCount == 1);
                         return GL_TEXTURE_2D_ARRAY;
                     } else {
diff --git a/src/dawn_native/vulkan/DeviceVk.cpp b/src/dawn_native/vulkan/DeviceVk.cpp
index bb16f84..db9ecb6 100644
--- a/src/dawn_native/vulkan/DeviceVk.cpp
+++ b/src/dawn_native/vulkan/DeviceVk.cpp
@@ -558,6 +558,12 @@
         const TextureDescriptor* textureDescriptor =
             reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
 
+        // TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
+        // GPUTextureDescriptor.size.depth is done.
+        TextureDescriptor fixedDescriptor;
+        DAWN_TRY_ASSIGN(fixedDescriptor, FixTextureDescriptor(this, textureDescriptor));
+        textureDescriptor = &fixedDescriptor;
+
         // Check services support this combination of handle type / image info
         if (!mExternalSemaphoreService->Supported()) {
             return DAWN_VALIDATION_ERROR("External semaphore usage not supported");
diff --git a/src/dawn_native/vulkan/TextureVk.cpp b/src/dawn_native/vulkan/TextureVk.cpp
index 6698ac0..3894d5a 100644
--- a/src/dawn_native/vulkan/TextureVk.cpp
+++ b/src/dawn_native/vulkan/TextureVk.cpp
@@ -430,7 +430,7 @@
             return DAWN_VALIDATION_ERROR("Mip level count must be 1");
         }
 
-        if (descriptor->arrayLayerCount != 1) {
+        if (descriptor->size.depth != 1) {
             return DAWN_VALIDATION_ERROR("Array layer count must be 1");
         }
 
diff --git a/src/tests/end2end/BindGroupTests.cpp b/src/tests/end2end/BindGroupTests.cpp
index 99d5c0c..0f48c8d 100644
--- a/src/tests/end2end/BindGroupTests.cpp
+++ b/src/tests/end2end/BindGroupTests.cpp
@@ -279,7 +279,6 @@
     descriptor.size.width = kRTSize;
     descriptor.size.height = kRTSize;
     descriptor.size.depth = 1;
-    descriptor.arrayLayerCount = 1;
     descriptor.sampleCount = 1;
     descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
     descriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/ClipSpaceTests.cpp b/src/tests/end2end/ClipSpaceTests.cpp
index 80ed9ef..be97ced 100644
--- a/src/tests/end2end/ClipSpaceTests.cpp
+++ b/src/tests/end2end/ClipSpaceTests.cpp
@@ -60,7 +60,6 @@
         textureDescriptor.format = format;
         textureDescriptor.usage =
             wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
-        textureDescriptor.arrayLayerCount = 1;
         textureDescriptor.mipLevelCount = 1;
         textureDescriptor.sampleCount = 1;
         textureDescriptor.size = {kSize, kSize, 1};
diff --git a/src/tests/end2end/ColorStateTests.cpp b/src/tests/end2end/ColorStateTests.cpp
index 769ccd8..f0fa1e5 100644
--- a/src/tests/end2end/ColorStateTests.cpp
+++ b/src/tests/end2end/ColorStateTests.cpp
@@ -748,7 +748,6 @@
     descriptor.size.width = kRTSize;
     descriptor.size.height = kRTSize;
     descriptor.size.depth = 1;
-    descriptor.arrayLayerCount = 1;
     descriptor.sampleCount = 1;
     descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
     descriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/CompressedTextureFormatTests.cpp b/src/tests/end2end/CompressedTextureFormatTests.cpp
index 0845ad8..857ecd2 100644
--- a/src/tests/end2end/CompressedTextureFormatTests.cpp
+++ b/src/tests/end2end/CompressedTextureFormatTests.cpp
@@ -481,7 +481,7 @@
     config.copyExtent3D = config.textureDescriptor.size;
 
     constexpr uint32_t kArrayLayerCount = 3;
-    config.textureDescriptor.arrayLayerCount = kArrayLayerCount;
+    config.textureDescriptor.size.depth = kArrayLayerCount;
     config.viewArrayLayer = kArrayLayerCount - 1;
 
     for (wgpu::TextureFormat format : kBCFormats) {
diff --git a/src/tests/end2end/CopyTests.cpp b/src/tests/end2end/CopyTests.cpp
index 498157d..95a8aac 100644
--- a/src/tests/end2end/CopyTests.cpp
+++ b/src/tests/end2end/CopyTests.cpp
@@ -80,8 +80,7 @@
             descriptor.dimension = wgpu::TextureDimension::e2D;
             descriptor.size.width = textureSpec.width;
             descriptor.size.height = textureSpec.height;
-            descriptor.size.depth = 1;
-            descriptor.arrayLayerCount = textureSpec.arraySize;
+            descriptor.size.depth = textureSpec.arraySize;
             descriptor.sampleCount = 1;
             descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
             descriptor.mipLevelCount = textureSpec.level + 1;
@@ -204,7 +203,6 @@
         descriptor.size.width = textureSpec.width;
         descriptor.size.height = textureSpec.height;
         descriptor.size.depth = 1;
-        descriptor.arrayLayerCount = 1;
         descriptor.sampleCount = 1;
         descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
         descriptor.mipLevelCount = textureSpec.level + 1;
@@ -299,8 +297,7 @@
         srcDescriptor.dimension = wgpu::TextureDimension::e2D;
         srcDescriptor.size.width = srcSpec.width;
         srcDescriptor.size.height = srcSpec.height;
-        srcDescriptor.size.depth = 1;
-        srcDescriptor.arrayLayerCount = srcSpec.arraySize;
+        srcDescriptor.size.depth = srcSpec.arraySize;
         srcDescriptor.sampleCount = 1;
         srcDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
         srcDescriptor.mipLevelCount = srcSpec.level + 1;
@@ -315,8 +312,7 @@
             dstDescriptor.dimension = wgpu::TextureDimension::e2D;
             dstDescriptor.size.width = dstSpec.width;
             dstDescriptor.size.height = dstSpec.height;
-            dstDescriptor.size.depth = 1;
-            dstDescriptor.arrayLayerCount = dstSpec.arraySize;
+            dstDescriptor.size.depth = dstSpec.arraySize;
             dstDescriptor.sampleCount = 1;
             dstDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
             dstDescriptor.mipLevelCount = dstSpec.level + 1;
diff --git a/src/tests/end2end/CullingTests.cpp b/src/tests/end2end/CullingTests.cpp
index 060c491..79a2303 100644
--- a/src/tests/end2end/CullingTests.cpp
+++ b/src/tests/end2end/CullingTests.cpp
@@ -64,7 +64,6 @@
         textureDescriptor.format = format;
         textureDescriptor.usage =
             wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
-        textureDescriptor.arrayLayerCount = 1;
         textureDescriptor.mipLevelCount = 1;
         textureDescriptor.sampleCount = 1;
         textureDescriptor.size = {kSize, kSize, 1};
diff --git a/src/tests/end2end/D3D12ResourceWrappingTests.cpp b/src/tests/end2end/D3D12ResourceWrappingTests.cpp
index 9466f76..2907a87 100644
--- a/src/tests/end2end/D3D12ResourceWrappingTests.cpp
+++ b/src/tests/end2end/D3D12ResourceWrappingTests.cpp
@@ -63,7 +63,6 @@
             baseDawnDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
             baseDawnDescriptor.size = {kTestWidth, kTestHeight, 1};
             baseDawnDescriptor.sampleCount = 1;
-            baseDawnDescriptor.arrayLayerCount = 1;
             baseDawnDescriptor.mipLevelCount = 1;
             baseDawnDescriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc |
                                        wgpu::TextureUsage::OutputAttachment |
@@ -173,10 +172,10 @@
     ASSERT_EQ(texture.Get(), nullptr);
 }
 
-// Test an error occurs if the descriptor array layer count isn't 1
-TEST_P(D3D12SharedHandleValidation, InvalidArrayLayerCount) {
+// Test an error occurs if the descriptor depth isn't 1
+TEST_P(D3D12SharedHandleValidation, InvalidDepth) {
     DAWN_SKIP_TEST_IF(UsesWire());
-    baseDawnDescriptor.arrayLayerCount = 2;
+    baseDawnDescriptor.size.depth = 2;
 
     wgpu::Texture texture;
     ComPtr<ID3D11Texture2D> d3d11Texture;
diff --git a/src/tests/end2end/DeprecatedAPITests.cpp b/src/tests/end2end/DeprecatedAPITests.cpp
index 087d182..693e0c7 100644
--- a/src/tests/end2end/DeprecatedAPITests.cpp
+++ b/src/tests/end2end/DeprecatedAPITests.cpp
@@ -82,6 +82,56 @@
     EXPECT_BUFFER_U32_EQ(data, buffer, 0);
 }
 
+// Test that using TextureDescriptor::arrayLayerCount emits a warning.
+TEST_P(DeprecationTests, TextureDescriptorArrayLayerCountDeprecated) {
+    wgpu::TextureDescriptor desc;
+    desc.usage = wgpu::TextureUsage::Sampled;
+    desc.dimension = wgpu::TextureDimension::e2D;
+    desc.size = {1, 1, 1};
+    desc.arrayLayerCount = 2;
+    desc.format = wgpu::TextureFormat::RGBA8Unorm;
+    desc.mipLevelCount = 1;
+    desc.sampleCount = 1;
+
+    EXPECT_DEPRECATION_WARNING(device.CreateTexture(&desc));
+}
+
+// Test that using both TextureDescriptor::arrayLayerCount and size.depth triggers an error.
+TEST_P(DeprecationTests, TextureDescriptorArrayLayerCountAndDepthSizeIsError) {
+    wgpu::TextureDescriptor desc;
+    desc.usage = wgpu::TextureUsage::Sampled;
+    desc.dimension = wgpu::TextureDimension::e2D;
+    desc.size = {1, 1, 2};
+    desc.arrayLayerCount = 2;
+    desc.format = wgpu::TextureFormat::RGBA8Unorm;
+    desc.mipLevelCount = 1;
+    desc.sampleCount = 1;
+
+    ASSERT_DEVICE_ERROR(device.CreateTexture(&desc));
+}
+
+// Test that TextureDescriptor::arrayLayerCount does correct state tracking.
+TEST_P(DeprecationTests, TextureDescriptorArrayLayerCountStateTracking) {
+    wgpu::TextureDescriptor desc;
+    desc.usage = wgpu::TextureUsage::Sampled;
+    desc.dimension = wgpu::TextureDimension::e2D;
+    desc.size = {1, 1, 1};
+    desc.arrayLayerCount = 2;
+    desc.format = wgpu::TextureFormat::RGBA8Unorm;
+    desc.mipLevelCount = 1;
+    desc.sampleCount = 1;
+
+    wgpu::Texture texture;
+    EXPECT_DEPRECATION_WARNING(texture = device.CreateTexture(&desc));
+
+    wgpu::TextureViewDescriptor viewDesc;
+    viewDesc.dimension = wgpu::TextureViewDimension::e2DArray;
+    viewDesc.arrayLayerCount = 2;
+    texture.CreateView(&viewDesc);
+    viewDesc.arrayLayerCount = 3;
+    ASSERT_DEVICE_ERROR(texture.CreateView(&viewDesc));
+}
+
 DAWN_INSTANTIATE_TEST(DeprecationTests,
                       D3D12Backend(),
                       MetalBackend(),
diff --git a/src/tests/end2end/DepthStencilStateTests.cpp b/src/tests/end2end/DepthStencilStateTests.cpp
index 80040ec..4881437 100644
--- a/src/tests/end2end/DepthStencilStateTests.cpp
+++ b/src/tests/end2end/DepthStencilStateTests.cpp
@@ -30,7 +30,6 @@
             renderTargetDescriptor.size.width = kRTSize;
             renderTargetDescriptor.size.height = kRTSize;
             renderTargetDescriptor.size.depth = 1;
-            renderTargetDescriptor.arrayLayerCount = 1;
             renderTargetDescriptor.sampleCount = 1;
             renderTargetDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
             renderTargetDescriptor.mipLevelCount = 1;
@@ -45,7 +44,6 @@
             depthDescriptor.size.width = kRTSize;
             depthDescriptor.size.height = kRTSize;
             depthDescriptor.size.depth = 1;
-            depthDescriptor.arrayLayerCount = 1;
             depthDescriptor.sampleCount = 1;
             depthDescriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
             depthDescriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/DeviceLostTests.cpp b/src/tests/end2end/DeviceLostTests.cpp
index e473533..fbae566 100644
--- a/src/tests/end2end/DeviceLostTests.cpp
+++ b/src/tests/end2end/DeviceLostTests.cpp
@@ -229,7 +229,6 @@
     descriptor.size.width = 4;
     descriptor.size.height = 4;
     descriptor.size.depth = 1;
-    descriptor.arrayLayerCount = 1;
     descriptor.mipLevelCount = 1;
     descriptor.dimension = wgpu::TextureDimension::e2D;
     descriptor.usage = wgpu::TextureUsage::OutputAttachment;
diff --git a/src/tests/end2end/IOSurfaceWrappingTests.cpp b/src/tests/end2end/IOSurfaceWrappingTests.cpp
index 70b2b79..af40c1b 100644
--- a/src/tests/end2end/IOSurfaceWrappingTests.cpp
+++ b/src/tests/end2end/IOSurfaceWrappingTests.cpp
@@ -122,7 +122,6 @@
         descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
         descriptor.size = {10, 10, 1};
         descriptor.sampleCount = 1;
-        descriptor.arrayLayerCount = 1;
         descriptor.mipLevelCount = 1;
         descriptor.usage = wgpu::TextureUsage::OutputAttachment;
     }
@@ -180,10 +179,10 @@
     ASSERT_EQ(texture.Get(), nullptr);
 }
 
-// Test an error occurs if the descriptor array layer count isn't 1
-TEST_P(IOSurfaceValidationTests, InvalidArrayLayerCount) {
+// Test an error occurs if the descriptor depth isn't 1
+TEST_P(IOSurfaceValidationTests, InvalidDepth) {
     DAWN_SKIP_TEST_IF(UsesWire());
-    descriptor.arrayLayerCount = 2;
+    descriptor.size.depth = 2;
 
     ASSERT_DEVICE_ERROR(wgpu::Texture texture =
                             WrapIOSurface(&descriptor, defaultIOSurface.get(), 0));
@@ -298,7 +297,6 @@
             textureDescriptor.format = format;
             textureDescriptor.size = {1, 1, 1};
             textureDescriptor.sampleCount = 1;
-            textureDescriptor.arrayLayerCount = 1;
             textureDescriptor.mipLevelCount = 1;
             textureDescriptor.usage = wgpu::TextureUsage::Sampled;
             wgpu::Texture wrappingTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
@@ -340,7 +338,6 @@
         textureDescriptor.format = format;
         textureDescriptor.size = {1, 1, 1};
         textureDescriptor.sampleCount = 1;
-        textureDescriptor.arrayLayerCount = 1;
         textureDescriptor.mipLevelCount = 1;
         textureDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
         wgpu::Texture ioSurfaceTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
@@ -461,7 +458,6 @@
     textureDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
     textureDescriptor.size = {1, 1, 1};
     textureDescriptor.sampleCount = 1;
-    textureDescriptor.arrayLayerCount = 1;
     textureDescriptor.mipLevelCount = 1;
     textureDescriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
 
diff --git a/src/tests/end2end/MultisampledRenderingTests.cpp b/src/tests/end2end/MultisampledRenderingTests.cpp
index cc3b3c3..5fd35a9 100644
--- a/src/tests/end2end/MultisampledRenderingTests.cpp
+++ b/src/tests/end2end/MultisampledRenderingTests.cpp
@@ -90,8 +90,7 @@
         descriptor.dimension = wgpu::TextureDimension::e2D;
         descriptor.size.width = kWidth << (mipLevelCount - 1);
         descriptor.size.height = kHeight << (mipLevelCount - 1);
-        descriptor.size.depth = 1;
-        descriptor.arrayLayerCount = arrayLayerCount;
+        descriptor.size.depth = arrayLayerCount;
         descriptor.sampleCount = sampleCount;
         descriptor.format = format;
         descriptor.mipLevelCount = mipLevelCount;
diff --git a/src/tests/end2end/NonzeroTextureCreationTests.cpp b/src/tests/end2end/NonzeroTextureCreationTests.cpp
index 0026322..cce7f5f 100644
--- a/src/tests/end2end/NonzeroTextureCreationTests.cpp
+++ b/src/tests/end2end/NonzeroTextureCreationTests.cpp
@@ -34,7 +34,6 @@
     descriptor.size.width = kSize;
     descriptor.size.height = kSize;
     descriptor.size.depth = 1;
-    descriptor.arrayLayerCount = 1;
     descriptor.sampleCount = 1;
     descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
     descriptor.mipLevelCount = 1;
@@ -58,7 +57,6 @@
     descriptor.size.width = kSize;
     descriptor.size.height = kSize;
     descriptor.size.depth = 1;
-    descriptor.arrayLayerCount = 1;
     descriptor.sampleCount = 1;
     descriptor.mipLevelCount = 1;
     descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
@@ -80,7 +78,6 @@
     descriptor.size.width = kSize;
     descriptor.size.height = kSize;
     descriptor.size.depth = 1;
-    descriptor.arrayLayerCount = 1;
     descriptor.sampleCount = 1;
     descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
     descriptor.mipLevelCount = mipLevels;
@@ -104,8 +101,7 @@
     descriptor.dimension = wgpu::TextureDimension::e2D;
     descriptor.size.width = kSize;
     descriptor.size.height = kSize;
-    descriptor.size.depth = 1;
-    descriptor.arrayLayerCount = arrayLayers;
+    descriptor.size.depth = arrayLayers;
     descriptor.sampleCount = 1;
     descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
     descriptor.mipLevelCount = 1;
@@ -128,7 +124,6 @@
     descriptor.size.width = kSize;
     descriptor.size.height = kSize;
     descriptor.size.depth = 1;
-    descriptor.arrayLayerCount = 1;
     descriptor.sampleCount = 1;
     descriptor.format = wgpu::TextureFormat::RGBA8Snorm;
     descriptor.mipLevelCount = 1;
@@ -161,8 +156,7 @@
     descriptor.dimension = wgpu::TextureDimension::e2D;
     descriptor.size.width = kSize;
     descriptor.size.height = kSize;
-    descriptor.size.depth = 1;
-    descriptor.arrayLayerCount = 2;
+    descriptor.size.depth = 2;
     descriptor.sampleCount = 1;
     descriptor.format = wgpu::TextureFormat::RGBA8Snorm;
     descriptor.mipLevelCount = 1;
@@ -198,7 +192,6 @@
     baseDescriptor.sampleCount = 1;
     baseDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
     baseDescriptor.mipLevelCount = 1;
-    baseDescriptor.arrayLayerCount = 1;
     baseDescriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
 
     RGBA8 filled(255, 255, 255, 255);
@@ -207,10 +200,10 @@
         wgpu::TextureDescriptor descriptor = baseDescriptor;
         // Some textures may be cleared with render pass load/store ops.
         // Test above the max attachment count.
-        descriptor.arrayLayerCount = kMaxColorAttachments + 1;
+        descriptor.size.depth = kMaxColorAttachments + 1;
         wgpu::Texture texture = device.CreateTexture(&descriptor);
 
-        for (uint32_t i = 0; i < descriptor.arrayLayerCount; ++i) {
+        for (uint32_t i = 0; i < descriptor.size.depth; ++i) {
             EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, 0, i);
         }
     }
@@ -229,11 +222,11 @@
         wgpu::TextureDescriptor descriptor = baseDescriptor;
         // Some textures may be cleared with render pass load/store ops.
         // Test above the max attachment count.
-        descriptor.arrayLayerCount = kMaxColorAttachments + 1;
+        descriptor.size.depth = kMaxColorAttachments + 1;
         descriptor.mipLevelCount = 3;
         wgpu::Texture texture = device.CreateTexture(&descriptor);
 
-        for (uint32_t i = 0; i < descriptor.arrayLayerCount; ++i) {
+        for (uint32_t i = 0; i < descriptor.size.depth; ++i) {
             for (uint32_t j = 0; j < descriptor.mipLevelCount; ++j) {
                 EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, j, i);
             }
@@ -251,7 +244,6 @@
     baseDescriptor.sampleCount = 1;
     baseDescriptor.format = wgpu::TextureFormat::RGBA8Snorm;
     baseDescriptor.mipLevelCount = 1;
-    baseDescriptor.arrayLayerCount = 1;
     baseDescriptor.usage = wgpu::TextureUsage::CopySrc;
 
     RGBA8 filled(1, 1, 1, 1);
@@ -260,10 +252,10 @@
         wgpu::TextureDescriptor descriptor = baseDescriptor;
         // Some textures may be cleared with render pass load/store ops.
         // Test above the max attachment count.
-        descriptor.arrayLayerCount = kMaxColorAttachments + 1;
+        descriptor.size.depth = kMaxColorAttachments + 1;
         wgpu::Texture texture = device.CreateTexture(&descriptor);
 
-        for (uint32_t i = 0; i < descriptor.arrayLayerCount; ++i) {
+        for (uint32_t i = 0; i < descriptor.size.depth; ++i) {
             EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, 0, i);
         }
     }
@@ -282,11 +274,11 @@
         wgpu::TextureDescriptor descriptor = baseDescriptor;
         // Some textures may be cleared with render pass load/store ops.
         // Test above the max attachment count.
-        descriptor.arrayLayerCount = kMaxColorAttachments + 1;
+        descriptor.size.depth = kMaxColorAttachments + 1;
         descriptor.mipLevelCount = 3;
         wgpu::Texture texture = device.CreateTexture(&descriptor);
 
-        for (uint32_t i = 0; i < descriptor.arrayLayerCount; ++i) {
+        for (uint32_t i = 0; i < descriptor.size.depth; ++i) {
             for (uint32_t j = 0; j < descriptor.mipLevelCount; ++j) {
                 EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, j, i);
             }
diff --git a/src/tests/end2end/RenderPassLoadOpTests.cpp b/src/tests/end2end/RenderPassLoadOpTests.cpp
index 618f9c0..db7b6a9 100644
--- a/src/tests/end2end/RenderPassLoadOpTests.cpp
+++ b/src/tests/end2end/RenderPassLoadOpTests.cpp
@@ -62,7 +62,6 @@
             descriptor.size.width = kRTSize;
             descriptor.size.height = kRTSize;
             descriptor.size.depth = 1;
-            descriptor.arrayLayerCount = 1;
             descriptor.sampleCount = 1;
             descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
             descriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/RenderPassTests.cpp b/src/tests/end2end/RenderPassTests.cpp
index c157a92..ead9bee 100644
--- a/src/tests/end2end/RenderPassTests.cpp
+++ b/src/tests/end2end/RenderPassTests.cpp
@@ -57,7 +57,6 @@
         descriptor.size.width = kRTSize;
         descriptor.size.height = kRTSize;
         descriptor.size.depth = 1;
-        descriptor.arrayLayerCount = 1;
         descriptor.sampleCount = 1;
         descriptor.format = kFormat;
         descriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp
index 1c38a4c..a6385c2 100644
--- a/src/tests/end2end/SamplerTests.cpp
+++ b/src/tests/end2end/SamplerTests.cpp
@@ -90,7 +90,6 @@
         descriptor.size.width = 2;
         descriptor.size.height = 2;
         descriptor.size.depth = 1;
-        descriptor.arrayLayerCount = 1;
         descriptor.sampleCount = 1;
         descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
         descriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/StorageTextureTests.cpp b/src/tests/end2end/StorageTextureTests.cpp
index 7b74b52..f90f5ee 100644
--- a/src/tests/end2end/StorageTextureTests.cpp
+++ b/src/tests/end2end/StorageTextureTests.cpp
@@ -411,10 +411,9 @@
                                 uint32_t height = kHeight,
                                 uint32_t arrayLayerCount = 1) {
         wgpu::TextureDescriptor descriptor;
-        descriptor.size = {width, height, 1};
+        descriptor.size = {width, height, arrayLayerCount};
         descriptor.format = format;
         descriptor.usage = usage;
-        descriptor.arrayLayerCount = arrayLayerCount;
         return device.CreateTexture(&descriptor);
     }
 
diff --git a/src/tests/end2end/SubresourceOutputAttachmentTests.cpp b/src/tests/end2end/SubresourceOutputAttachmentTests.cpp
index 7b402a5..ff45abc 100644
--- a/src/tests/end2end/SubresourceOutputAttachmentTests.cpp
+++ b/src/tests/end2end/SubresourceOutputAttachmentTests.cpp
@@ -121,8 +121,7 @@
         renderTargetDesc.dimension = wgpu::TextureDimension::e2D;
         renderTargetDesc.size.width = kTextureSize;
         renderTargetDesc.size.height = kTextureSize;
-        renderTargetDesc.size.depth = 1;
-        renderTargetDesc.arrayLayerCount = kArrayLayerCount;
+        renderTargetDesc.size.depth = kArrayLayerCount;
         renderTargetDesc.sampleCount = 1;
         renderTargetDesc.format = format;
         renderTargetDesc.mipLevelCount = kMipLevelCount;
diff --git a/src/tests/end2end/TextureSubresourceTests.cpp b/src/tests/end2end/TextureSubresourceTests.cpp
index 29411de..741e77af 100644
--- a/src/tests/end2end/TextureSubresourceTests.cpp
+++ b/src/tests/end2end/TextureSubresourceTests.cpp
@@ -27,8 +27,7 @@
                                 wgpu::TextureUsage usage) {
         wgpu::TextureDescriptor texDesc;
         texDesc.dimension = wgpu::TextureDimension::e2D;
-        texDesc.size = {kSize, kSize, 1};
-        texDesc.arrayLayerCount = arrayLayerCount;
+        texDesc.size = {kSize, kSize, arrayLayerCount};
         texDesc.sampleCount = 1;
         texDesc.mipLevelCount = mipLevelCount;
         texDesc.usage = usage;
diff --git a/src/tests/end2end/TextureViewTests.cpp b/src/tests/end2end/TextureViewTests.cpp
index 0deb112..c20d0af 100644
--- a/src/tests/end2end/TextureViewTests.cpp
+++ b/src/tests/end2end/TextureViewTests.cpp
@@ -37,8 +37,7 @@
         descriptor.dimension = wgpu::TextureDimension::e2D;
         descriptor.size.width = width;
         descriptor.size.height = height;
-        descriptor.size.depth = 1;
-        descriptor.arrayLayerCount = arrayLayerCount;
+        descriptor.size.depth = arrayLayerCount;
         descriptor.sampleCount = 1;
         descriptor.format = kDefaultFormat;
         descriptor.mipLevelCount = mipLevelCount;
diff --git a/src/tests/end2end/TextureZeroInitTests.cpp b/src/tests/end2end/TextureZeroInitTests.cpp
index 82155cf..4588e36 100644
--- a/src/tests/end2end/TextureZeroInitTests.cpp
+++ b/src/tests/end2end/TextureZeroInitTests.cpp
@@ -44,8 +44,7 @@
         descriptor.dimension = wgpu::TextureDimension::e2D;
         descriptor.size.width = kSize;
         descriptor.size.height = kSize;
-        descriptor.size.depth = 1;
-        descriptor.arrayLayerCount = arrayLayerCount;
+        descriptor.size.depth = arrayLayerCount;
         descriptor.sampleCount = 1;
         descriptor.format = format;
         descriptor.mipLevelCount = mipLevelCount;
diff --git a/src/tests/end2end/ViewportTests.cpp b/src/tests/end2end/ViewportTests.cpp
index d001368..56dac87 100644
--- a/src/tests/end2end/ViewportTests.cpp
+++ b/src/tests/end2end/ViewportTests.cpp
@@ -69,7 +69,6 @@
         textureDescriptor.format = format;
         textureDescriptor.usage =
             wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
-        textureDescriptor.arrayLayerCount = 1;
         textureDescriptor.mipLevelCount = 1;
         textureDescriptor.sampleCount = 1;
         textureDescriptor.size = {kSize, kSize, 1};
diff --git a/src/tests/unittests/validation/BindGroupValidationTests.cpp b/src/tests/unittests/validation/BindGroupValidationTests.cpp
index 571c8ee..42213ca 100644
--- a/src/tests/unittests/validation/BindGroupValidationTests.cpp
+++ b/src/tests/unittests/validation/BindGroupValidationTests.cpp
@@ -26,12 +26,11 @@
                                 uint32_t layerCount) {
         wgpu::TextureDescriptor descriptor;
         descriptor.dimension = wgpu::TextureDimension::e2D;
-        descriptor.size = {16, 16, 1};
+        descriptor.size = {16, 16, layerCount};
         descriptor.sampleCount = 1;
         descriptor.mipLevelCount = 1;
         descriptor.usage = usage;
         descriptor.format = format;
-        descriptor.arrayLayerCount = layerCount;
 
         return device.CreateTexture(&descriptor);
     }
diff --git a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
index a4e3bf0..cbaee72 100644
--- a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
+++ b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
@@ -39,8 +39,7 @@
         descriptor.dimension = wgpu::TextureDimension::e2D;
         descriptor.size.width = width;
         descriptor.size.height = height;
-        descriptor.size.depth = 1;
-        descriptor.arrayLayerCount = arrayLayerCount;
+        descriptor.size.depth = arrayLayerCount;
         descriptor.sampleCount = sampleCount;
         descriptor.format = format;
         descriptor.mipLevelCount = mipLevelCount;
@@ -548,7 +547,7 @@
     ASSERT_DEVICE_ERROR(wgpu::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
 
     wgpu::TextureDescriptor errorTextureDescriptor;
-    errorTextureDescriptor.arrayLayerCount = 0;
+    errorTextureDescriptor.size.depth = 0;
     ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor));
 
     wgpu::BufferCopyView errorBufferCopyView = utils::CreateBufferCopyView(errorBuffer, 0, 0, 0);
@@ -879,7 +878,7 @@
     ASSERT_DEVICE_ERROR(wgpu::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
 
     wgpu::TextureDescriptor errorTextureDescriptor;
-    errorTextureDescriptor.arrayLayerCount = 0;
+    errorTextureDescriptor.size.depth = 0;
     ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor));
 
     wgpu::BufferCopyView errorBufferCopyView = utils::CreateBufferCopyView(errorBuffer, 0, 0, 0);
diff --git a/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp b/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
index d25b246..7c9b11b 100644
--- a/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
+++ b/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
@@ -55,8 +55,7 @@
     descriptor.dimension = dimension;
     descriptor.size.width = width;
     descriptor.size.height = height;
-    descriptor.size.depth = 1;
-    descriptor.arrayLayerCount = arrayLayerCount;
+    descriptor.size.depth = arrayLayerCount;
     descriptor.sampleCount = sampleCount;
     descriptor.format = format;
     descriptor.mipLevelCount = mipLevelCount;
diff --git a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
index 7d20b15..5f1dfd5 100644
--- a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
+++ b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
@@ -227,7 +227,6 @@
     baseTextureDescriptor.size.width = 4;
     baseTextureDescriptor.size.height = 4;
     baseTextureDescriptor.size.depth = 1;
-    baseTextureDescriptor.arrayLayerCount = 1;
     baseTextureDescriptor.mipLevelCount = 1;
     baseTextureDescriptor.dimension = wgpu::TextureDimension::e2D;
     baseTextureDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
diff --git a/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp b/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp
index 9fddf89..2590240 100644
--- a/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp
+++ b/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp
@@ -33,7 +33,6 @@
             wgpu::TextureDescriptor descriptor;
             descriptor.dimension = wgpu::TextureDimension::e2D;
             descriptor.size = {1, 1, 1};
-            descriptor.arrayLayerCount = 1;
             descriptor.sampleCount = 1;
             descriptor.mipLevelCount = 1;
             descriptor.usage = usage;
diff --git a/src/tests/unittests/validation/StorageTextureValidationTests.cpp b/src/tests/unittests/validation/StorageTextureValidationTests.cpp
index 52f0f85..f3e8aca 100644
--- a/src/tests/unittests/validation/StorageTextureValidationTests.cpp
+++ b/src/tests/unittests/validation/StorageTextureValidationTests.cpp
@@ -89,8 +89,7 @@
                                 uint32_t arrayLayerCount = 1) {
         wgpu::TextureDescriptor descriptor;
         descriptor.dimension = wgpu::TextureDimension::e2D;
-        descriptor.size = {16, 16, 1};
-        descriptor.arrayLayerCount = arrayLayerCount;
+        descriptor.size = {16, 16, arrayLayerCount};
         descriptor.sampleCount = sampleCount;
         descriptor.format = format;
         descriptor.mipLevelCount = 1;
diff --git a/src/tests/unittests/validation/TextureSubresourceTests.cpp b/src/tests/unittests/validation/TextureSubresourceTests.cpp
index 1325446..cbed639 100644
--- a/src/tests/unittests/validation/TextureSubresourceTests.cpp
+++ b/src/tests/unittests/validation/TextureSubresourceTests.cpp
@@ -28,8 +28,7 @@
                                     wgpu::TextureUsage usage) {
             wgpu::TextureDescriptor texDesc;
             texDesc.dimension = wgpu::TextureDimension::e2D;
-            texDesc.size = {kSize, kSize, 1};
-            texDesc.arrayLayerCount = arrayLayerCount;
+            texDesc.size = {kSize, kSize, arrayLayerCount};
             texDesc.sampleCount = 1;
             texDesc.mipLevelCount = mipLevelCount;
             texDesc.usage = usage;
diff --git a/src/tests/unittests/validation/TextureValidationTests.cpp b/src/tests/unittests/validation/TextureValidationTests.cpp
index 5976832..c3d9612 100644
--- a/src/tests/unittests/validation/TextureValidationTests.cpp
+++ b/src/tests/unittests/validation/TextureValidationTests.cpp
@@ -31,8 +31,7 @@
         wgpu::TextureDescriptor descriptor;
         descriptor.size.width = kWidth;
         descriptor.size.height = kHeight;
-        descriptor.size.depth = 1;
-        descriptor.arrayLayerCount = kDefaultArraySize;
+        descriptor.size.depth = kDefaultDepth;
         descriptor.mipLevelCount = kDefaultMipLevels;
         descriptor.sampleCount = kDefaultSampleCount;
         descriptor.dimension = wgpu::TextureDimension::e2D;
@@ -46,7 +45,7 @@
   private:
     static constexpr uint32_t kWidth = 32;
     static constexpr uint32_t kHeight = 32;
-    static constexpr uint32_t kDefaultArraySize = 1;
+    static constexpr uint32_t kDefaultDepth = 1;
     static constexpr uint32_t kDefaultMipLevels = 1;
     static constexpr uint32_t kDefaultSampleCount = 1;
 
@@ -94,7 +93,7 @@
     {
         wgpu::TextureDescriptor descriptor = defaultDescriptor;
         descriptor.sampleCount = 4;
-        descriptor.arrayLayerCount = 2;
+        descriptor.size.depth = 2;
 
         ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
     }
@@ -204,7 +203,7 @@
     // Array layer count exceeding kMaxTexture2DArrayLayers is not allowed
     {
         wgpu::TextureDescriptor descriptor = defaultDescriptor;
-        descriptor.arrayLayerCount = kMaxTexture2DArrayLayers + 1u;
+        descriptor.size.depth = kMaxTexture2DArrayLayers + 1u;
 
         ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
     }
@@ -212,7 +211,7 @@
     // Array layer count less than kMaxTexture2DArrayLayers is allowed;
     {
         wgpu::TextureDescriptor descriptor = defaultDescriptor;
-        descriptor.arrayLayerCount = kMaxTexture2DArrayLayers >> 1;
+        descriptor.size.depth = kMaxTexture2DArrayLayers >> 1;
 
         device.CreateTexture(&descriptor);
     }
@@ -220,7 +219,7 @@
     // Array layer count equal to kMaxTexture2DArrayLayers is allowed;
     {
         wgpu::TextureDescriptor descriptor = defaultDescriptor;
-        descriptor.arrayLayerCount = kMaxTexture2DArrayLayers;
+        descriptor.size.depth = kMaxTexture2DArrayLayers;
 
         device.CreateTexture(&descriptor);
     }
@@ -487,7 +486,7 @@
     for (wgpu::TextureFormat format : kBCFormats) {
         wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
         descriptor.format = format;
-        descriptor.arrayLayerCount = 6;
+        descriptor.size.depth = 6;
         device.CreateTexture(&descriptor);
     }
 }
diff --git a/src/tests/unittests/validation/TextureViewValidationTests.cpp b/src/tests/unittests/validation/TextureViewValidationTests.cpp
index f607184..32bf7a3 100644
--- a/src/tests/unittests/validation/TextureViewValidationTests.cpp
+++ b/src/tests/unittests/validation/TextureViewValidationTests.cpp
@@ -35,8 +35,7 @@
     descriptor.dimension = wgpu::TextureDimension::e2D;
     descriptor.size.width = width;
     descriptor.size.height = height;
-    descriptor.size.depth = 1;
-    descriptor.arrayLayerCount = arrayLayerCount;
+    descriptor.size.depth = arrayLayerCount;
     descriptor.sampleCount = sampleCount;
     descriptor.format = kDefaultTextureFormat;
     descriptor.mipLevelCount = mipLevelCount;
diff --git a/src/tests/unittests/validation/ValidationTest.cpp b/src/tests/unittests/validation/ValidationTest.cpp
index 3d3aeee..7db863d 100644
--- a/src/tests/unittests/validation/ValidationTest.cpp
+++ b/src/tests/unittests/validation/ValidationTest.cpp
@@ -105,7 +105,6 @@
     descriptor.size.width = width;
     descriptor.size.height = height;
     descriptor.size.depth = 1;
-    descriptor.arrayLayerCount = 1;
     descriptor.sampleCount = 1;
     descriptor.format = attachmentFormat;
     descriptor.mipLevelCount = 1;
diff --git a/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp b/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp
index 0e3324c..3fc0660 100644
--- a/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp
+++ b/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp
@@ -49,7 +49,6 @@
                 defaultDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
                 defaultDescriptor.size = {1, 1, 1};
                 defaultDescriptor.sampleCount = 1;
-                defaultDescriptor.arrayLayerCount = 1;
                 defaultDescriptor.mipLevelCount = 1;
                 defaultDescriptor.usage = wgpu::TextureUsage::OutputAttachment |
                                           wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
@@ -204,9 +203,9 @@
         close(defaultFd);
     }
 
-    // Test an error occurs if the descriptor array layer count isn't 1
-    TEST_P(VulkanImageWrappingValidationTests, InvalidArrayLayerCount) {
-        defaultDescriptor.arrayLayerCount = 2;
+    // Test an error occurs if the descriptor depth isn't 1
+    TEST_P(VulkanImageWrappingValidationTests, InvalidDepth) {
+        defaultDescriptor.size.depth = 2;
 
         ASSERT_DEVICE_ERROR(wgpu::Texture texture =
                                 WrapVulkanImage(device, &defaultDescriptor, defaultFd,
@@ -761,7 +760,6 @@
         descriptor.size.width = 640;
         descriptor.size.height = 480;
         descriptor.size.depth = 1;
-        descriptor.arrayLayerCount = 1;
         descriptor.sampleCount = 1;
         descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
         descriptor.mipLevelCount = 1;
diff --git a/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp b/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp
index 3fc37cf..b96fbcf 100644
--- a/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp
+++ b/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp
@@ -212,7 +212,6 @@
             defaultDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
             defaultDescriptor.size = {1, 1, 1};
             defaultDescriptor.sampleCount = 1;
-            defaultDescriptor.arrayLayerCount = 1;
             defaultDescriptor.mipLevelCount = 1;
             defaultDescriptor.usage = wgpu::TextureUsage::OutputAttachment |
                                       wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
@@ -291,10 +290,10 @@
         EXPECT_EQ(texture.Get(), nullptr);
     }
 
-    // Test an error occurs if the descriptor array layer count isn't 1
-    TEST_P(VulkanImageWrappingValidationTests, InvalidArrayLayerCount) {
+    // Test an error occurs if the descriptor depth isn't 1
+    TEST_P(VulkanImageWrappingValidationTests, InvalidDepth) {
         DAWN_SKIP_TEST_IF(UsesWire());
-        defaultDescriptor.arrayLayerCount = 2;
+        defaultDescriptor.size.depth = 2;
 
         ASSERT_DEVICE_ERROR(wgpu::Texture texture = WrapVulkanImage(
                                 device, &defaultDescriptor, defaultFd, defaultAllocationSize,
diff --git a/src/utils/WGPUHelpers.cpp b/src/utils/WGPUHelpers.cpp
index f0d1242..5b703ea 100644
--- a/src/utils/WGPUHelpers.cpp
+++ b/src/utils/WGPUHelpers.cpp
@@ -252,7 +252,6 @@
         descriptor.size.width = width;
         descriptor.size.height = height;
         descriptor.size.depth = 1;
-        descriptor.arrayLayerCount = 1;
         descriptor.sampleCount = 1;
         descriptor.format = BasicRenderPass::kDefaultColorFormat;
         descriptor.mipLevelCount = 1;