API evolution GPUExtent3D.depth -> depthOrArrayLayers (Step 2)
Still leave deprecated `depth` functional as there are some references in
other clients. Using `depth` and `depthOrArrayLayers` at the same time is
invalid. Add DeprecatedAPITests.
Bug: chromium:1176969
Change-Id: Ia06645e4f3c17588323dd36b11f9f3988b2e3aba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44640
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/tests/end2end/BindGroupTests.cpp b/src/tests/end2end/BindGroupTests.cpp
index a518e89..e44aeb2 100644
--- a/src/tests/end2end/BindGroupTests.cpp
+++ b/src/tests/end2end/BindGroupTests.cpp
@@ -298,7 +298,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kRTSize;
descriptor.size.height = kRTSize;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/BufferZeroInitTests.cpp b/src/tests/end2end/BufferZeroInitTests.cpp
index 327723e..67226ef 100644
--- a/src/tests/end2end/BufferZeroInitTests.cpp
+++ b/src/tests/end2end/BufferZeroInitTests.cpp
@@ -96,7 +96,7 @@
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- for (uint32_t arrayLayer = 0; arrayLayer < size.depth; ++arrayLayer) {
+ for (uint32_t arrayLayer = 0; arrayLayer < size.depthOrArrayLayers; ++arrayLayer) {
wgpu::TextureViewDescriptor viewDescriptor;
viewDescriptor.format = format;
viewDescriptor.dimension = wgpu::TextureViewDimension::e2D;
@@ -145,7 +145,7 @@
const uint64_t expectedValueCount = bufferSize / sizeof(float);
std::vector<float> expectedValues(expectedValueCount, 0.f);
- for (uint32_t slice = 0; slice < spec.textureSize.depth; ++slice) {
+ for (uint32_t slice = 0; slice < spec.textureSize.depthOrArrayLayers; ++slice) {
const uint64_t baseOffsetBytesPerSlice =
spec.bufferOffset + spec.bytesPerRow * spec.rowsPerImage * slice;
for (uint32_t y = 0; y < spec.textureSize.height; ++y) {
@@ -963,7 +963,8 @@
constexpr wgpu::Extent3D kTextureSize = {64u, 4u, 3u};
// bytesPerRow == texelBlockSizeInBytes * copySize.width && rowsPerImage == copySize.height &&
- // bytesPerRow * (rowsPerImage * (copySize.depth - 1) + copySize.height) == buffer.size
+ // bytesPerRow * (rowsPerImage * (copySize.depthOrArrayLayers - 1) + copySize.height) ==
+ // buffer.size
{
TestBufferZeroInitInCopyTextureToBuffer(
{kTextureSize, 0u, 0u, kTextureBytesPerRowAlignment, kTextureSize.height, 0u});
@@ -976,7 +977,7 @@
{kTextureSize, 0u, 0u, kTextureBytesPerRowAlignment, kRowsPerImage, 1u});
}
- // bytesPerRow * rowsPerImage * copySize.depth < buffer.size
+ // bytesPerRow * rowsPerImage * copySize.depthOrArrayLayers < buffer.size
{
constexpr uint64_t kExtraBufferSize = 16u;
TestBufferZeroInitInCopyTextureToBuffer({kTextureSize, 0u, kExtraBufferSize,
diff --git a/src/tests/end2end/ColorStateTests.cpp b/src/tests/end2end/ColorStateTests.cpp
index b9b6d6c..91db43a 100644
--- a/src/tests/end2end/ColorStateTests.cpp
+++ b/src/tests/end2end/ColorStateTests.cpp
@@ -771,7 +771,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kRTSize;
descriptor.size.height = kRTSize;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 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 a95f834a..06b8afa 100644
--- a/src/tests/end2end/CompressedTextureFormatTests.cpp
+++ b/src/tests/end2end/CompressedTextureFormatTests.cpp
@@ -64,14 +64,14 @@
copyRowsPerImage = copyHeightInBlock;
}
uint32_t copyBytesPerImage = copyBytesPerRow * copyRowsPerImage;
- uint32_t uploadBufferSize =
- copyConfig.bufferOffset + copyBytesPerImage * copyConfig.copyExtent3D.depth;
+ uint32_t uploadBufferSize = copyConfig.bufferOffset +
+ copyBytesPerImage * copyConfig.copyExtent3D.depthOrArrayLayers;
// Fill data with the pre-prepared one-block compressed texture data.
std::vector<uint8_t> data(uploadBufferSize, 0);
std::vector<uint8_t> oneBlockCompressedTextureData =
GetOneBlockBCFormatTextureData(copyConfig.textureDescriptor.format);
- for (uint32_t layer = 0; layer < copyConfig.copyExtent3D.depth; ++layer) {
+ for (uint32_t layer = 0; layer < copyConfig.copyExtent3D.depthOrArrayLayers; ++layer) {
for (uint32_t h = 0; h < copyHeightInBlock; ++h) {
for (uint32_t w = 0; w < copyWidthInBlock; ++w) {
uint32_t uploadBufferOffset = copyConfig.bufferOffset +
@@ -227,14 +227,14 @@
if (config.copyOrigin3D.y + config.copyExtent3D.height > virtualSizeAtLevel.height) {
noPaddingExtent3D.height = virtualSizeAtLevel.height - config.copyOrigin3D.y;
}
- noPaddingExtent3D.depth = 1u;
+ noPaddingExtent3D.depthOrArrayLayers = 1u;
std::vector<RGBA8> expectedData =
GetExpectedData(config.textureDescriptor.format, noPaddingExtent3D);
wgpu::Origin3D firstLayerCopyOrigin = {config.copyOrigin3D.x, config.copyOrigin3D.y, 0};
for (uint32_t layer = config.copyOrigin3D.z;
- layer < config.copyOrigin3D.z + config.copyExtent3D.depth; ++layer) {
+ layer < config.copyOrigin3D.z + config.copyExtent3D.depthOrArrayLayers; ++layer) {
wgpu::BindGroup bindGroup = CreateBindGroupForTest(
renderPipeline.GetBindGroupLayout(0), bcTexture, config.textureDescriptor.format,
layer, config.viewMipmapLevel);
@@ -391,7 +391,7 @@
static std::vector<RGBA8> FillExpectedData(const wgpu::Extent3D& testRegion,
RGBA8 leftColorInBlock,
RGBA8 rightColorInBlock) {
- ASSERT(testRegion.depth == 1);
+ ASSERT(testRegion.depthOrArrayLayers == 1);
std::vector<RGBA8> expectedData(testRegion.width * testRegion.height, leftColorInBlock);
for (uint32_t y = 0; y < testRegion.height; ++y) {
@@ -409,7 +409,7 @@
static wgpu::Extent3D GetVirtualSizeAtLevel(const CopyConfig& config) {
return {config.textureDescriptor.size.width >> config.viewMipmapLevel,
config.textureDescriptor.size.height >> config.viewMipmapLevel,
- config.textureDescriptor.size.depth};
+ config.textureDescriptor.size.depthOrArrayLayers};
}
static wgpu::Extent3D GetPhysicalSizeAtLevel(const CopyConfig& config) {
@@ -484,7 +484,7 @@
config.copyExtent3D = config.textureDescriptor.size;
constexpr uint32_t kArrayLayerCount = 3;
- config.textureDescriptor.size.depth = kArrayLayerCount;
+ config.textureDescriptor.size.depthOrArrayLayers = kArrayLayerCount;
config.copyOrigin3D.z = kArrayLayerCount - 1;
for (wgpu::TextureFormat format : utils::kBCFormats) {
@@ -973,8 +973,8 @@
}
// Test the workaround in the B2T copies when (bufferSize - bufferOffset < bytesPerImage *
-// copyExtent.depth) on Metal backends. As copyExtent.depth can only be 1 for BC formats, on Metal
-// backend we will use two copies to implement such copy.
+// copyExtent.depthOrArrayLayers) on Metal backends. As copyExtent.depthOrArrayLayers can only be 1
+// for BC formats, on Metal backend we will use two copies to implement such copy.
TEST_P(CompressedTextureBCFormatTest, LargeImageHeight) {
// TODO(jiawei.shao@intel.com): find out why this test fails on Windows Intel OpenGL drivers.
DAWN_SKIP_TEST_IF(IsIntel() && IsOpenGL() && IsWindows());
@@ -995,7 +995,7 @@
}
// Test the workaround in the B2T copies when (bufferSize - bufferOffset < bytesPerImage *
-// copyExtent.depth) and copyExtent needs to be clamped.
+// copyExtent.depthOrArrayLayers) and copyExtent needs to be clamped.
TEST_P(CompressedTextureBCFormatTest, LargeImageHeightAndClampedCopyExtent) {
// TODO(jiawei.shao@intel.com): find out why this test fails on Windows Intel OpenGL drivers.
DAWN_SKIP_TEST_IF(IsIntel() && IsOpenGL() && IsWindows());
@@ -1055,7 +1055,7 @@
config.rowsPerImage = 8;
config.copyExtent3D = config.textureDescriptor.size;
- config.copyExtent3D.depth = kArrayLayerCount;
+ config.copyExtent3D.depthOrArrayLayers = kArrayLayerCount;
for (wgpu::TextureFormat format : utils::kBCFormats) {
config.textureDescriptor.format = format;
@@ -1084,7 +1084,7 @@
constexpr uint32_t kCopyLayerCount = 2;
config.copyOrigin3D = {0, 0, kCopyBaseArrayLayer};
config.copyExtent3D = config.textureDescriptor.size;
- config.copyExtent3D.depth = kCopyLayerCount;
+ config.copyExtent3D.depthOrArrayLayers = kCopyLayerCount;
for (wgpu::TextureFormat format : utils::kBCFormats) {
config.textureDescriptor.format = format;
diff --git a/src/tests/end2end/CopyTests.cpp b/src/tests/end2end/CopyTests.cpp
index f6d6a3d..0c457cb 100644
--- a/src/tests/end2end/CopyTests.cpp
+++ b/src/tests/end2end/CopyTests.cpp
@@ -46,7 +46,7 @@
static std::vector<uint8_t> GetExpectedTextureData(const utils::TextureDataCopyLayout& layout) {
uint32_t bytesPerTexelBlock = layout.bytesPerRow / layout.texelBlocksPerRow;
std::vector<uint8_t> textureData(layout.byteLength);
- for (uint32_t layer = 0; layer < layout.mipSize.depth; ++layer) {
+ for (uint32_t layer = 0; layer < layout.mipSize.depthOrArrayLayers; ++layer) {
const uint32_t byteOffsetPerSlice = layout.bytesPerImage * layer;
for (uint32_t y = 0; y < layout.mipSize.height; ++y) {
for (uint32_t x = 0; x < layout.mipSize.width * bytesPerTexelBlock; ++x) {
@@ -64,7 +64,7 @@
static std::vector<RGBA8> GetExpectedTextureDataRGBA8(
const utils::TextureDataCopyLayout& layout) {
std::vector<RGBA8> textureData(layout.texelBlockCount);
- for (uint32_t layer = 0; layer < layout.mipSize.depth; ++layer) {
+ for (uint32_t layer = 0; layer < layout.mipSize.depthOrArrayLayers; ++layer) {
const uint32_t texelIndexOffsetPerSlice = layout.texelBlocksPerImage * layer;
for (uint32_t y = 0; y < layout.mipSize.height; ++y) {
for (uint32_t x = 0; x < layout.mipSize.width; ++x) {
@@ -185,7 +185,7 @@
// Texels in single slice.
const uint32_t texelCountInCopyRegion = utils::GetTexelCountInCopyRegion(
bufferSpec.bytesPerRow, bufferSpec.rowsPerImage, copySizePerSlice, textureSpec.format);
- const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copySize.depth;
+ const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copySize.depthOrArrayLayers;
std::vector<RGBA8> expected(texelCountInCopyRegion);
for (uint32_t slice = textureSpec.copyOrigin.z; slice < maxArrayLayer; ++slice) {
// Pack the data used to create the upload buffer in the specified copy region to have
@@ -207,7 +207,7 @@
<< ", " << textureSpec.copyOrigin.y << ", " << textureSpec.copyOrigin.z << "), ("
<< textureSpec.copyOrigin.x + copySize.width << ", "
<< textureSpec.copyOrigin.y + copySize.height << ", "
- << textureSpec.copyOrigin.z + copySize.depth << ")) from "
+ << textureSpec.copyOrigin.z + copySize.depthOrArrayLayers << ")) from "
<< textureSpec.textureSize.width << " x " << textureSpec.textureSize.height
<< " texture at mip level " << textureSpec.copyLevel << " layer " << slice << " to "
<< bufferSpec.size << "-byte buffer with offset " << bufferOffset
@@ -258,7 +258,7 @@
textureSpec.format, textureSpec.textureSize, textureSpec.copyLevel,
bufferSpec.rowsPerImage);
- const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copySize.depth;
+ const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copySize.depthOrArrayLayers;
wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(
buffer, bufferSpec.offset, bufferSpec.bytesPerRow, bufferSpec.rowsPerImage);
@@ -333,7 +333,9 @@
// `level` mip level
const utils::TextureDataCopyLayout srcDataCopyLayout =
utils::GetTextureDataCopyLayoutForTexture2DAtLevel(
- format, {srcSpec.textureSize.width, srcSpec.textureSize.height, copySize.depth},
+ format,
+ {srcSpec.textureSize.width, srcSpec.textureSize.height,
+ copySize.depthOrArrayLayers},
srcSpec.copyLevel);
// Initialize the source texture
@@ -358,10 +360,12 @@
encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, ©Size);
// Copy the data from the srcSpec.copyOrigin.z-th layer to (srcSpec.copyOrigin.z +
- // copySize.depth)-th layer of dstTexture to outputBuffer
+ // copySize.depthOrArrayLayers)-th layer of dstTexture to outputBuffer
const utils::TextureDataCopyLayout dstDataCopyLayout =
utils::GetTextureDataCopyLayoutForTexture2DAtLevel(
- format, {dstSpec.textureSize.width, dstSpec.textureSize.height, copySize.depth},
+ format,
+ {dstSpec.textureSize.width, dstSpec.textureSize.height,
+ copySize.depthOrArrayLayers},
dstSpec.copyLevel);
wgpu::BufferDescriptor outputBufferDescriptor;
outputBufferDescriptor.size = dstDataCopyLayout.byteLength;
@@ -384,7 +388,7 @@
bytesPerTexel);
std::vector<uint8_t> expectedDstDataPerSlice(validDataSizePerDstTextureLayer);
- for (uint32_t slice = 0; slice < copySize.depth; ++slice) {
+ for (uint32_t slice = 0; slice < copySize.depthOrArrayLayers; ++slice) {
// For each source texture array slice involved in the copy, emulate the T2T copy
// on the CPU side by "copying" the copy data from the "source texture"
// (srcTextureCopyData) to the "destination texture" (expectedDstDataPerSlice).
diff --git a/src/tests/end2end/CopyTextureForBrowserTests.cpp b/src/tests/end2end/CopyTextureForBrowserTests.cpp
index deb3a70..17c3fd6 100644
--- a/src/tests/end2end/CopyTextureForBrowserTests.cpp
+++ b/src/tests/end2end/CopyTextureForBrowserTests.cpp
@@ -36,7 +36,7 @@
static std::vector<RGBA8> GetSourceTextureData(const utils::TextureDataCopyLayout& layout) {
std::vector<RGBA8> textureData(layout.texelBlockCount);
- for (uint32_t layer = 0; layer < layout.mipSize.depth; ++layer) {
+ for (uint32_t layer = 0; layer < layout.mipSize.depthOrArrayLayers; ++layer) {
const uint32_t sliceOffset = layout.texelBlocksPerImage * layer;
for (uint32_t y = 0; y < layout.mipSize.height; ++y) {
const uint32_t rowOffset = layout.texelBlocksPerRow * y;
@@ -141,7 +141,8 @@
const utils::TextureDataCopyLayout copyLayout =
utils::GetTextureDataCopyLayoutForTexture2DAtLevel(
kTextureFormat,
- {srcSpec.textureSize.width, srcSpec.textureSize.height, copySize.depth},
+ {srcSpec.textureSize.width, srcSpec.textureSize.height,
+ copySize.depthOrArrayLayers},
srcSpec.level);
const std::vector<RGBA8> textureArrayCopyData = GetSourceTextureData(copyLayout);
diff --git a/src/tests/end2end/D3D12ResourceWrappingTests.cpp b/src/tests/end2end/D3D12ResourceWrappingTests.cpp
index 47f311b..0a703c7 100644
--- a/src/tests/end2end/D3D12ResourceWrappingTests.cpp
+++ b/src/tests/end2end/D3D12ResourceWrappingTests.cpp
@@ -191,7 +191,7 @@
// Test an error occurs if the descriptor depth isn't 1
TEST_P(D3D12SharedHandleValidation, InvalidDepth) {
DAWN_SKIP_TEST_IF(UsesWire());
- baseDawnDescriptor.size.depth = 2;
+ baseDawnDescriptor.size.depthOrArrayLayers = 2;
wgpu::Texture texture;
ComPtr<ID3D11Texture2D> d3d11Texture;
diff --git a/src/tests/end2end/DeprecatedAPITests.cpp b/src/tests/end2end/DeprecatedAPITests.cpp
index 9d69f89..e1b8491 100644
--- a/src/tests/end2end/DeprecatedAPITests.cpp
+++ b/src/tests/end2end/DeprecatedAPITests.cpp
@@ -172,6 +172,291 @@
EXPECT_DEPRECATION_WARNING(queue.CreateFence());
}
+// Test GPUExtent3D.depth deprecation in TextureDescriptor.size
+TEST_P(DeprecationTests, GPUExtent3DDepthDeprecationTextureDescriptor) {
+ wgpu::TextureDescriptor kBaseDesc;
+ kBaseDesc.usage = wgpu::TextureUsage::Sampled;
+ kBaseDesc.size.width = 1;
+ kBaseDesc.size.height = 1;
+ kBaseDesc.format = wgpu::TextureFormat::RGBA8Unorm;
+ kBaseDesc.dimension = wgpu::TextureDimension::e2D;
+
+ {
+ // Valid: default
+ wgpu::TextureDescriptor desc = kBaseDesc;
+ wgpu::Texture texture;
+ texture = device.CreateTexture(&desc);
+ }
+ {
+ // Warning: use deprecated depth but still valid
+ wgpu::TextureDescriptor desc = kBaseDesc;
+ desc.mipLevelCount = 2;
+ desc.size.width = 2;
+ desc.size.height = 2;
+ desc.size.depth = 2;
+ wgpu::Texture texture;
+ EXPECT_DEPRECATION_WARNING(texture = device.CreateTexture(&desc));
+ }
+ {
+ // Warning: use deprecated depth
+ // Error: use deprecated depth and the descriptor is invalid
+ // because 2D texture with depth == 0 is not allowed
+ // This is to verify the deprecated depth is picked up by the implementation.
+ wgpu::TextureDescriptor desc = kBaseDesc;
+ desc.size.depth = 0;
+ wgpu::Texture texture;
+ ASSERT_DEVICE_ERROR(EXPECT_DEPRECATION_WARNING(texture = device.CreateTexture(&desc)));
+ }
+ {
+ // Error: use both deprecated depth and depthOrArrayLayers
+ wgpu::TextureDescriptor desc = kBaseDesc;
+ desc.size.depth = 2;
+ desc.size.depthOrArrayLayers = 2;
+ wgpu::Texture texture;
+ ASSERT_DEVICE_ERROR(texture = device.CreateTexture(&desc));
+ }
+ {
+ // Valid: use updated depthOrArrayLayers
+ wgpu::TextureDescriptor desc = kBaseDesc;
+ desc.mipLevelCount = 2;
+ desc.size.width = 2;
+ desc.size.height = 2;
+ desc.size.depthOrArrayLayers = 2;
+ wgpu::Texture texture;
+ texture = device.CreateTexture(&desc);
+ }
+ {
+ // Error: use updated depthOrArrayLayers and the descriptor is invalid
+ // because 2D texture with depthOrArrayLayers == 0 is not allowed
+ wgpu::TextureDescriptor desc = kBaseDesc;
+ desc.size.depthOrArrayLayers = 0;
+ wgpu::Texture texture;
+ ASSERT_DEVICE_ERROR(texture = device.CreateTexture(&desc));
+ }
+}
+
+// Test GPUExtent3D.depth deprecation in CopyBufferToTexture, CopyTextureToBuffer, and
+// CopyTextureToTexture
+TEST_P(DeprecationTests, GPUExtent3DDepthDeprecationCopy) {
+ wgpu::BufferDescriptor bufferDesc;
+ bufferDesc.size = 4 * 256;
+ bufferDesc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
+ wgpu::Buffer srcBuffer = device.CreateBuffer(&bufferDesc);
+
+ wgpu::TextureDescriptor dstTextureDesc;
+ dstTextureDesc.usage = wgpu::TextureUsage::CopyDst;
+ dstTextureDesc.size.width = 4;
+ dstTextureDesc.size.height = 4;
+ dstTextureDesc.size.depthOrArrayLayers = 1;
+ dstTextureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
+ dstTextureDesc.dimension = wgpu::TextureDimension::e2D;
+ wgpu::Texture dstTexture = device.CreateTexture(&dstTextureDesc);
+
+ wgpu::TextureDescriptor srcTextureDesc = dstTextureDesc;
+ srcTextureDesc.usage = wgpu::TextureUsage::CopySrc;
+ wgpu::Texture srcTexture = device.CreateTexture(&srcTextureDesc);
+
+ wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(srcBuffer, 0, 256, 4);
+ wgpu::ImageCopyTexture imageCopyDstTexture =
+ utils::CreateImageCopyTexture(dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::All);
+ wgpu::ImageCopyTexture imageCopySrcTexture =
+ utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::All);
+
+ wgpu::Extent3D kBaseExtent3D;
+ kBaseExtent3D.width = 4;
+ kBaseExtent3D.height = 4;
+
+ {
+ // Valid: default
+ wgpu::Extent3D extent3D = kBaseExtent3D;
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D);
+ encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D);
+ encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D);
+ encoder.Finish();
+ }
+ {
+ // Warning: empty copy use deprecated depth == 0 but still valid
+ wgpu::Extent3D extent3D = kBaseExtent3D;
+ extent3D.width = 0;
+ extent3D.height = 0;
+ extent3D.depth = 0;
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ EXPECT_DEPRECATION_WARNING(
+ encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D));
+ EXPECT_DEPRECATION_WARNING(
+ encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D));
+ EXPECT_DEPRECATION_WARNING(
+ encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D));
+ encoder.Finish();
+ }
+ {
+ // Warning: use deprecated depth
+ // Error: depth > 1
+ // This is to verify the deprecated depth is picked up by the implementation.
+ wgpu::Extent3D extent3D = kBaseExtent3D;
+ extent3D.depth = 2;
+ {
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ EXPECT_DEPRECATION_WARNING(
+ encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D));
+ ASSERT_DEVICE_ERROR(encoder.Finish());
+ }
+ {
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ EXPECT_DEPRECATION_WARNING(
+ encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D));
+ ASSERT_DEVICE_ERROR(encoder.Finish());
+ }
+ {
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ EXPECT_DEPRECATION_WARNING(encoder.CopyTextureToTexture(
+ &imageCopySrcTexture, &imageCopyDstTexture, &extent3D));
+ ASSERT_DEVICE_ERROR(encoder.Finish());
+ }
+ }
+ {
+ // Error: use both deprecated depth and depthOrArrayLayers
+ wgpu::Extent3D extent3D = kBaseExtent3D;
+ extent3D.width = 0;
+ extent3D.height = 0;
+ extent3D.depth = 0;
+ extent3D.depthOrArrayLayers = 0;
+ {
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D);
+ ASSERT_DEVICE_ERROR(encoder.Finish());
+ }
+ {
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D);
+ ASSERT_DEVICE_ERROR(encoder.Finish());
+ }
+ {
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D);
+ ASSERT_DEVICE_ERROR(encoder.Finish());
+ }
+ }
+ {
+ // Valid: use updated depthOrArrayLayers
+ wgpu::Extent3D extent3D = kBaseExtent3D;
+ extent3D.width = 0;
+ extent3D.height = 0;
+ extent3D.depthOrArrayLayers = 0;
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D);
+ encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D);
+ encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D);
+ encoder.Finish();
+ }
+ {
+ // Error: use updated depthOrArrayLayers and is invalid
+ wgpu::Extent3D extent3D = kBaseExtent3D;
+ extent3D.depthOrArrayLayers = 2;
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ {
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D);
+ ASSERT_DEVICE_ERROR(encoder.Finish());
+ }
+ {
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D);
+ ASSERT_DEVICE_ERROR(encoder.Finish());
+ }
+ {
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D);
+ ASSERT_DEVICE_ERROR(encoder.Finish());
+ }
+ }
+}
+
+// Test GPUExtent3D.depth deprecation in WriteTexture
+TEST_P(DeprecationTests, GPUExtent3DDepthDeprecationWriteTexture) {
+ wgpu::TextureDescriptor dstTextureDesc;
+ dstTextureDesc.usage = wgpu::TextureUsage::CopyDst;
+ dstTextureDesc.size.width = 4;
+ dstTextureDesc.size.height = 4;
+ dstTextureDesc.size.depthOrArrayLayers = 1;
+ dstTextureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
+ dstTextureDesc.dimension = wgpu::TextureDimension::e2D;
+ wgpu::Texture dstTexture = device.CreateTexture(&dstTextureDesc);
+
+ size_t dataSize = 4 * 256;
+ std::vector<uint8_t> data(dataSize);
+
+ wgpu::TextureDataLayout textureDataLayout;
+ textureDataLayout.offset = 0;
+ textureDataLayout.bytesPerRow = 256;
+ textureDataLayout.rowsPerImage = 4;
+
+ wgpu::ImageCopyTexture imageCopyDstTexture =
+ utils::CreateImageCopyTexture(dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::All);
+
+ wgpu::Extent3D kBaseExtent3D;
+ kBaseExtent3D.width = 4;
+ kBaseExtent3D.height = 4;
+
+ {
+ // Valid: default
+ wgpu::Extent3D extent3D = kBaseExtent3D;
+ wgpu::Queue queue = device.GetQueue();
+ queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize, &textureDataLayout,
+ &extent3D);
+ }
+ {
+ // Warning: use deprecated depth == 0 but still valid
+ wgpu::Extent3D extent3D = kBaseExtent3D;
+ extent3D.width = 0;
+ extent3D.height = 0;
+ extent3D.depth = 0;
+ wgpu::Queue queue = device.GetQueue();
+ EXPECT_DEPRECATION_WARNING(queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize,
+ &textureDataLayout, &extent3D));
+ }
+ {
+ // Warning: use deprecated depth
+ // Error: depth > 1 for 2D textures
+ // This is to verify the deprecated depth is picked up by the implementation.
+ wgpu::Extent3D extent3D = kBaseExtent3D;
+ extent3D.depth = 2;
+ wgpu::Queue queue = device.GetQueue();
+ ASSERT_DEVICE_ERROR(EXPECT_DEPRECATION_WARNING(queue.WriteTexture(
+ &imageCopyDstTexture, data.data(), dataSize, &textureDataLayout, &extent3D)));
+ }
+ {
+ // Error: use both deprecated depth and depthOrArrayLayers
+ wgpu::Extent3D extent3D = kBaseExtent3D;
+ extent3D.width = 0;
+ extent3D.height = 0;
+ extent3D.depth = 0;
+ extent3D.depthOrArrayLayers = 0;
+ wgpu::Queue queue = device.GetQueue();
+ ASSERT_DEVICE_ERROR(queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize,
+ &textureDataLayout, &extent3D));
+ }
+ {
+ // Valid: use updated depthOrArrayLayers
+ wgpu::Extent3D extent3D = kBaseExtent3D;
+ extent3D.width = 0;
+ extent3D.height = 0;
+ extent3D.depthOrArrayLayers = 0;
+ wgpu::Queue queue = device.GetQueue();
+ queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize, &textureDataLayout,
+ &extent3D);
+ }
+ {
+ // Error: use updated depthOrArrayLayers and depthOrArrayLayers > 1 for 2D textures
+ wgpu::Extent3D extent3D = kBaseExtent3D;
+ extent3D.depthOrArrayLayers = 2;
+ wgpu::Queue queue = device.GetQueue();
+ ASSERT_DEVICE_ERROR(queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize,
+ &textureDataLayout, &extent3D));
+ }
+}
+
DAWN_INSTANTIATE_TEST(DeprecationTests,
D3D12Backend(),
MetalBackend(),
diff --git a/src/tests/end2end/DepthStencilStateTests.cpp b/src/tests/end2end/DepthStencilStateTests.cpp
index 3696c19..460f77b 100644
--- a/src/tests/end2end/DepthStencilStateTests.cpp
+++ b/src/tests/end2end/DepthStencilStateTests.cpp
@@ -29,7 +29,7 @@
renderTargetDescriptor.dimension = wgpu::TextureDimension::e2D;
renderTargetDescriptor.size.width = kRTSize;
renderTargetDescriptor.size.height = kRTSize;
- renderTargetDescriptor.size.depth = 1;
+ renderTargetDescriptor.size.depthOrArrayLayers = 1;
renderTargetDescriptor.sampleCount = 1;
renderTargetDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
renderTargetDescriptor.mipLevelCount = 1;
@@ -43,7 +43,7 @@
depthDescriptor.dimension = wgpu::TextureDimension::e2D;
depthDescriptor.size.width = kRTSize;
depthDescriptor.size.height = kRTSize;
- depthDescriptor.size.depth = 1;
+ depthDescriptor.size.depthOrArrayLayers = 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 3e2752f..0ddac92 100644
--- a/src/tests/end2end/DeviceLostTests.cpp
+++ b/src/tests/end2end/DeviceLostTests.cpp
@@ -234,7 +234,7 @@
wgpu::TextureDescriptor descriptor;
descriptor.size.width = 4;
descriptor.size.height = 4;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.mipLevelCount = 1;
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
diff --git a/src/tests/end2end/IOSurfaceWrappingTests.cpp b/src/tests/end2end/IOSurfaceWrappingTests.cpp
index d26fb8e..10ebad2 100644
--- a/src/tests/end2end/IOSurfaceWrappingTests.cpp
+++ b/src/tests/end2end/IOSurfaceWrappingTests.cpp
@@ -182,7 +182,7 @@
// Test an error occurs if the descriptor depth isn't 1
TEST_P(IOSurfaceValidationTests, InvalidDepth) {
DAWN_SKIP_TEST_IF(UsesWire());
- descriptor.size.depth = 2;
+ descriptor.size.depthOrArrayLayers = 2;
ASSERT_DEVICE_ERROR(wgpu::Texture texture =
WrapIOSurface(&descriptor, defaultIOSurface.get(), 0));
diff --git a/src/tests/end2end/MultisampledRenderingTests.cpp b/src/tests/end2end/MultisampledRenderingTests.cpp
index 62e0ae8..2eeadbb 100644
--- a/src/tests/end2end/MultisampledRenderingTests.cpp
+++ b/src/tests/end2end/MultisampledRenderingTests.cpp
@@ -101,7 +101,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kWidth << (mipLevelCount - 1);
descriptor.size.height = kHeight << (mipLevelCount - 1);
- descriptor.size.depth = arrayLayerCount;
+ descriptor.size.depthOrArrayLayers = 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 91fab10..e479fee 100644
--- a/src/tests/end2end/NonzeroTextureCreationTests.cpp
+++ b/src/tests/end2end/NonzeroTextureCreationTests.cpp
@@ -33,7 +33,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kSize;
descriptor.size.height = kSize;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
@@ -53,7 +53,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kSize;
descriptor.size.height = kSize;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.sampleCount = 1;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
@@ -75,7 +75,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kSize;
descriptor.size.height = kSize;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = mipLevels;
@@ -99,7 +99,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kSize;
descriptor.size.height = kSize;
- descriptor.size.depth = arrayLayers;
+ descriptor.size.depthOrArrayLayers = arrayLayers;
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
@@ -125,7 +125,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kSize;
descriptor.size.height = kSize;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Snorm;
descriptor.mipLevelCount = 1;
@@ -163,7 +163,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kSize;
descriptor.size.height = kSize;
- descriptor.size.depth = 2;
+ descriptor.size.depthOrArrayLayers = 2;
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Snorm;
descriptor.mipLevelCount = 1;
@@ -196,7 +196,7 @@
baseDescriptor.dimension = wgpu::TextureDimension::e2D;
baseDescriptor.size.width = kSize;
baseDescriptor.size.height = kSize;
- baseDescriptor.size.depth = 1;
+ baseDescriptor.size.depthOrArrayLayers = 1;
baseDescriptor.sampleCount = 1;
baseDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
baseDescriptor.mipLevelCount = 1;
@@ -208,10 +208,10 @@
wgpu::TextureDescriptor descriptor = baseDescriptor;
// Some textures may be cleared with render pass load/store ops.
// Test above the max attachment count.
- descriptor.size.depth = kMaxColorAttachments + 1;
+ descriptor.size.depthOrArrayLayers = kMaxColorAttachments + 1;
wgpu::Texture texture = device.CreateTexture(&descriptor);
- for (uint32_t i = 0; i < descriptor.size.depth; ++i) {
+ for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) {
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, 0, i);
}
}
@@ -230,11 +230,11 @@
wgpu::TextureDescriptor descriptor = baseDescriptor;
// Some textures may be cleared with render pass load/store ops.
// Test above the max attachment count.
- descriptor.size.depth = kMaxColorAttachments + 1;
+ descriptor.size.depthOrArrayLayers = kMaxColorAttachments + 1;
descriptor.mipLevelCount = 3;
wgpu::Texture texture = device.CreateTexture(&descriptor);
- for (uint32_t i = 0; i < descriptor.size.depth; ++i) {
+ for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) {
for (uint32_t j = 0; j < descriptor.mipLevelCount; ++j) {
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, j, i);
}
@@ -248,7 +248,7 @@
baseDescriptor.dimension = wgpu::TextureDimension::e2D;
baseDescriptor.size.width = kSize;
baseDescriptor.size.height = kSize;
- baseDescriptor.size.depth = 1;
+ baseDescriptor.size.depthOrArrayLayers = 1;
baseDescriptor.sampleCount = 1;
baseDescriptor.format = wgpu::TextureFormat::RGBA8Snorm;
baseDescriptor.mipLevelCount = 1;
@@ -260,10 +260,10 @@
wgpu::TextureDescriptor descriptor = baseDescriptor;
// Some textures may be cleared with render pass load/store ops.
// Test above the max attachment count.
- descriptor.size.depth = kMaxColorAttachments + 1;
+ descriptor.size.depthOrArrayLayers = kMaxColorAttachments + 1;
wgpu::Texture texture = device.CreateTexture(&descriptor);
- for (uint32_t i = 0; i < descriptor.size.depth; ++i) {
+ for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) {
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, 0, i);
}
}
@@ -282,11 +282,11 @@
wgpu::TextureDescriptor descriptor = baseDescriptor;
// Some textures may be cleared with render pass load/store ops.
// Test above the max attachment count.
- descriptor.size.depth = kMaxColorAttachments + 1;
+ descriptor.size.depthOrArrayLayers = kMaxColorAttachments + 1;
descriptor.mipLevelCount = 3;
wgpu::Texture texture = device.CreateTexture(&descriptor);
- for (uint32_t i = 0; i < descriptor.size.depth; ++i) {
+ for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++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/QueueTests.cpp b/src/tests/end2end/QueueTests.cpp
index bd8fd9d..4f635e9 100644
--- a/src/tests/end2end/QueueTests.cpp
+++ b/src/tests/end2end/QueueTests.cpp
@@ -286,7 +286,7 @@
const uint32_t bytesPerTexel = utils::GetTexelBlockSizeInBytes(kTextureFormat);
wgpu::Extent3D mipSize = {textureSpec.textureSize.width >> textureSpec.level,
textureSpec.textureSize.height >> textureSpec.level,
- textureSpec.textureSize.depth};
+ textureSpec.textureSize.depthOrArrayLayers};
uint32_t bytesPerRow = dataSpec.bytesPerRow;
if (bytesPerRow == wgpu::kCopyStrideUndefined) {
bytesPerRow = mipSize.width * bytesPerTexel;
@@ -296,7 +296,7 @@
dataSpec.rowsPerImage > 0 ? dataSpec.rowsPerImage : mipSize.height;
uint32_t bytesPerImage = bytesPerRow * appliedRowsPerImage;
- const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copySize.depth;
+ const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copySize.depthOrArrayLayers;
uint64_t dataOffset = dataSpec.offset;
const uint32_t texelCountLastLayer =
diff --git a/src/tests/end2end/RenderPassLoadOpTests.cpp b/src/tests/end2end/RenderPassLoadOpTests.cpp
index c8bc7ce..25d9427 100644
--- a/src/tests/end2end/RenderPassLoadOpTests.cpp
+++ b/src/tests/end2end/RenderPassLoadOpTests.cpp
@@ -60,7 +60,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kRTSize;
descriptor.size.height = kRTSize;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 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 55eb5cf..5d65ae8 100644
--- a/src/tests/end2end/RenderPassTests.cpp
+++ b/src/tests/end2end/RenderPassTests.cpp
@@ -59,7 +59,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kRTSize;
descriptor.size.height = kRTSize;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.sampleCount = 1;
descriptor.format = kFormat;
descriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/SamplerFilterAnisotropicTests.cpp b/src/tests/end2end/SamplerFilterAnisotropicTests.cpp
index 7dd08de..0f5b080 100644
--- a/src/tests/end2end/SamplerFilterAnisotropicTests.cpp
+++ b/src/tests/end2end/SamplerFilterAnisotropicTests.cpp
@@ -97,7 +97,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = textureWidthLevel0;
descriptor.size.height = textureHeightLevel0;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = mipLevelCount;
diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp
index 9855154..c3ce811 100644
--- a/src/tests/end2end/SamplerTests.cpp
+++ b/src/tests/end2end/SamplerTests.cpp
@@ -93,7 +93,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = 2;
descriptor.size.height = 2;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/SubresourceRenderAttachmentTests.cpp b/src/tests/end2end/SubresourceRenderAttachmentTests.cpp
index 010376c..fdcd891 100644
--- a/src/tests/end2end/SubresourceRenderAttachmentTests.cpp
+++ b/src/tests/end2end/SubresourceRenderAttachmentTests.cpp
@@ -121,7 +121,7 @@
renderTargetDesc.dimension = wgpu::TextureDimension::e2D;
renderTargetDesc.size.width = kTextureSize;
renderTargetDesc.size.height = kTextureSize;
- renderTargetDesc.size.depth = kArrayLayerCount;
+ renderTargetDesc.size.depthOrArrayLayers = kArrayLayerCount;
renderTargetDesc.sampleCount = 1;
renderTargetDesc.format = format;
renderTargetDesc.mipLevelCount = kMipLevelCount;
diff --git a/src/tests/end2end/TextureViewTests.cpp b/src/tests/end2end/TextureViewTests.cpp
index 1396d6e..4a34bd6 100644
--- a/src/tests/end2end/TextureViewTests.cpp
+++ b/src/tests/end2end/TextureViewTests.cpp
@@ -37,7 +37,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = width;
descriptor.size.height = height;
- descriptor.size.depth = arrayLayerCount;
+ descriptor.size.depthOrArrayLayers = 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 8076c13..11ab992 100644
--- a/src/tests/end2end/TextureZeroInitTests.cpp
+++ b/src/tests/end2end/TextureZeroInitTests.cpp
@@ -45,7 +45,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kSize;
descriptor.size.height = kSize;
- descriptor.size.depth = arrayLayerCount;
+ descriptor.size.depthOrArrayLayers = arrayLayerCount;
descriptor.sampleCount = 1;
descriptor.format = format;
descriptor.mipLevelCount = mipLevelCount;
@@ -1425,7 +1425,7 @@
wgpu::TextureDescriptor descriptor;
descriptor.size.width = kUnalignedSize;
descriptor.size.height = kUnalignedSize;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.format = wgpu::TextureFormat::R8Snorm;
descriptor.usage = wgpu::TextureUsage::CopySrc;
wgpu::Texture texture = device.CreateTexture(&descriptor);
diff --git a/src/tests/perf_tests/DrawCallPerf.cpp b/src/tests/perf_tests/DrawCallPerf.cpp
index a2cd14e..8000549 100644
--- a/src/tests/perf_tests/DrawCallPerf.cpp
+++ b/src/tests/perf_tests/DrawCallPerf.cpp
@@ -287,7 +287,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kTextureSize;
descriptor.size.height = kTextureSize;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
diff --git a/src/tests/perf_tests/SubresourceTrackingPerf.cpp b/src/tests/perf_tests/SubresourceTrackingPerf.cpp
index 7f32843..0ddf864 100644
--- a/src/tests/perf_tests/SubresourceTrackingPerf.cpp
+++ b/src/tests/perf_tests/SubresourceTrackingPerf.cpp
@@ -64,7 +64,7 @@
mMaterials = device.CreateTexture(&materialDesc);
wgpu::TextureDescriptor uploadTexDesc = materialDesc;
- uploadTexDesc.size.depth = 1;
+ uploadTexDesc.size.depthOrArrayLayers = 1;
uploadTexDesc.mipLevelCount = 1;
uploadTexDesc.usage = wgpu::TextureUsage::CopySrc;
mUploadTexture = device.CreateTexture(&uploadTexDesc);
diff --git a/src/tests/unittests/d3d12/CopySplitTests.cpp b/src/tests/unittests/d3d12/CopySplitTests.cpp
index adc546d..e18b5be 100644
--- a/src/tests/unittests/d3d12/CopySplitTests.cpp
+++ b/src/tests/unittests/d3d12/CopySplitTests.cpp
@@ -49,7 +49,8 @@
const auto& copy = copySplit.copies[i];
ASSERT_LE(copy.bufferOffset.x + copy.copySize.width, copy.bufferSize.width);
ASSERT_LE(copy.bufferOffset.y + copy.copySize.height, copy.bufferSize.height);
- ASSERT_LE(copy.bufferOffset.z + copy.copySize.depth, copy.bufferSize.depth);
+ ASSERT_LE(copy.bufferOffset.z + copy.copySize.depthOrArrayLayers,
+ copy.bufferSize.depthOrArrayLayers);
}
}
@@ -75,9 +76,9 @@
bool overlapY =
RangesOverlap(a.textureOffset.y, a.textureOffset.y + a.copySize.height,
b.textureOffset.y, b.textureOffset.y + b.copySize.height);
- bool overlapZ =
- RangesOverlap(a.textureOffset.z, a.textureOffset.z + a.copySize.depth,
- b.textureOffset.z, b.textureOffset.z + b.copySize.depth);
+ bool overlapZ = RangesOverlap(
+ a.textureOffset.z, a.textureOffset.z + a.copySize.depthOrArrayLayers,
+ b.textureOffset.z, b.textureOffset.z + b.copySize.depthOrArrayLayers);
ASSERT_TRUE(!overlapX || !overlapY || !overlapZ);
}
}
@@ -93,7 +94,8 @@
uint32_t minZ = copySplit.copies[0].textureOffset.z;
uint32_t maxX = copySplit.copies[0].textureOffset.x + copySplit.copies[0].copySize.width;
uint32_t maxY = copySplit.copies[0].textureOffset.y + copySplit.copies[0].copySize.height;
- uint32_t maxZ = copySplit.copies[0].textureOffset.z + copySplit.copies[0].copySize.depth;
+ uint32_t maxZ =
+ copySplit.copies[0].textureOffset.z + copySplit.copies[0].copySize.depthOrArrayLayers;
for (uint32_t i = 1; i < copySplit.count; ++i) {
const auto& copy = copySplit.copies[i];
@@ -102,7 +104,7 @@
minZ = std::min(minZ, copy.textureOffset.z);
maxX = std::max(maxX, copy.textureOffset.x + copy.copySize.width);
maxY = std::max(maxY, copy.textureOffset.y + copy.copySize.height);
- maxZ = std::max(maxZ, copy.textureOffset.z + copy.copySize.depth);
+ maxZ = std::max(maxZ, copy.textureOffset.z + copy.copySize.depthOrArrayLayers);
}
ASSERT_EQ(minX, textureSpec.x);
@@ -119,7 +121,7 @@
uint32_t count = 0;
for (uint32_t i = 0; i < copySplit.count; ++i) {
const auto& copy = copySplit.copies[i];
- count += copy.copySize.width * copy.copySize.height * copy.copySize.depth;
+ count += copy.copySize.width * copy.copySize.height * copy.copySize.depthOrArrayLayers;
}
ASSERT_EQ(count, textureSpec.width * textureSpec.height * textureSpec.depth);
}
@@ -192,11 +194,12 @@
const auto& copy = copySplit.copies[i];
os << " " << i << ": Texture at (" << copy.textureOffset.x << ", "
<< copy.textureOffset.y << ", " << copy.textureOffset.z << "), size ("
- << copy.copySize.width << ", " << copy.copySize.height << ", " << copy.copySize.depth
- << ")" << std::endl;
+ << copy.copySize.width << ", " << copy.copySize.height << ", "
+ << copy.copySize.depthOrArrayLayers << ")" << std::endl;
os << " " << i << ": Buffer at (" << copy.bufferOffset.x << ", " << copy.bufferOffset.y
<< ", " << copy.bufferOffset.z << "), footprint (" << copy.bufferSize.width << ", "
- << copy.bufferSize.height << ", " << copy.bufferSize.depth << ")" << std::endl;
+ << copy.bufferSize.height << ", " << copy.bufferSize.depthOrArrayLayers << ")"
+ << std::endl;
}
return os;
}
diff --git a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
index 62e4c9c..29b664a 100644
--- a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
+++ b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
@@ -41,7 +41,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = width;
descriptor.size.height = height;
- descriptor.size.depth = arrayLayerCount;
+ descriptor.size.depthOrArrayLayers = arrayLayerCount;
descriptor.sampleCount = sampleCount;
descriptor.format = format;
descriptor.mipLevelCount = mipLevelCount;
@@ -663,7 +663,7 @@
ASSERT_DEVICE_ERROR(wgpu::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
wgpu::TextureDescriptor errorTextureDescriptor;
- errorTextureDescriptor.size.depth = 0;
+ errorTextureDescriptor.size.depthOrArrayLayers = 0;
ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor));
wgpu::ImageCopyBuffer errorImageCopyBuffer = utils::CreateImageCopyBuffer(errorBuffer, 0, 0, 0);
@@ -1252,7 +1252,7 @@
ASSERT_DEVICE_ERROR(wgpu::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
wgpu::TextureDescriptor errorTextureDescriptor;
- errorTextureDescriptor.size.depth = 0;
+ errorTextureDescriptor.size.depthOrArrayLayers = 0;
ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor));
wgpu::ImageCopyBuffer errorImageCopyBuffer = utils::CreateImageCopyBuffer(errorBuffer, 0, 0, 0);
@@ -1533,12 +1533,12 @@
TestT2TCopy(utils::Expectation::Success, source, 0, {0, 0, 1}, destination, 0, {0, 0, 1},
{16, 16, 1});
- // Copy multiple slices (srcImageCopyTexture.arrayLayer + copySize.depth ==
+ // Copy multiple slices (srcImageCopyTexture.arrayLayer + copySize.depthOrArrayLayers ==
// srcImageCopyTexture.texture.arrayLayerCount)
TestT2TCopy(utils::Expectation::Success, source, 0, {0, 0, 2}, destination, 0, {0, 0, 0},
{16, 16, 2});
- // Copy multiple slices (dstImageCopyTexture.arrayLayer + copySize.depth ==
+ // Copy multiple slices (dstImageCopyTexture.arrayLayer + copySize.depthOrArrayLayers ==
// dstImageCopyTexture.texture.arrayLayerCount)
TestT2TCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, {0, 0, 2},
{16, 16, 2});
diff --git a/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp b/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp
index f115c30c..6d8a2e7 100644
--- a/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp
+++ b/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp
@@ -38,7 +38,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = size.width;
descriptor.size.height = size.height;
- descriptor.size.depth = size.depth;
+ descriptor.size.depthOrArrayLayers = size.depthOrArrayLayers;
descriptor.sampleCount = sampleCount;
descriptor.format = format;
descriptor.mipLevelCount = mipLevelCount;
@@ -358,7 +358,7 @@
// Test WriteTexture with texture in error state causes errors.
TEST_F(QueueWriteTextureValidationTest, TextureInErrorState) {
wgpu::TextureDescriptor errorTextureDescriptor;
- errorTextureDescriptor.size.depth = 0;
+ errorTextureDescriptor.size.depthOrArrayLayers = 0;
ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture =
device.CreateTexture(&errorTextureDescriptor));
wgpu::ImageCopyTexture errorImageCopyTexture =
diff --git a/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp b/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
index 9de9bdc..b02ec28 100644
--- a/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
+++ b/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
@@ -55,7 +55,7 @@
descriptor.dimension = dimension;
descriptor.size.width = width;
descriptor.size.height = height;
- descriptor.size.depth = arrayLayerCount;
+ descriptor.size.depthOrArrayLayers = 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 93175ea..1a9aaac 100644
--- a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
+++ b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
@@ -238,7 +238,7 @@
wgpu::TextureDescriptor baseTextureDescriptor;
baseTextureDescriptor.size.width = 4;
baseTextureDescriptor.size.height = 4;
- baseTextureDescriptor.size.depth = 1;
+ baseTextureDescriptor.size.depthOrArrayLayers = 1;
baseTextureDescriptor.mipLevelCount = 1;
baseTextureDescriptor.dimension = wgpu::TextureDimension::e2D;
baseTextureDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
diff --git a/src/tests/unittests/validation/TextureValidationTests.cpp b/src/tests/unittests/validation/TextureValidationTests.cpp
index 7ff68f0..48da264 100644
--- a/src/tests/unittests/validation/TextureValidationTests.cpp
+++ b/src/tests/unittests/validation/TextureValidationTests.cpp
@@ -33,7 +33,7 @@
wgpu::TextureDescriptor descriptor;
descriptor.size.width = kWidth;
descriptor.size.height = kHeight;
- descriptor.size.depth = kDefaultDepth;
+ descriptor.size.depthOrArrayLayers = kDefaultDepth;
descriptor.mipLevelCount = kDefaultMipLevels;
descriptor.sampleCount = kDefaultSampleCount;
descriptor.dimension = wgpu::TextureDimension::e2D;
@@ -109,7 +109,7 @@
{
wgpu::TextureDescriptor descriptor = defaultDescriptor;
descriptor.sampleCount = 4;
- descriptor.size.depth = 2;
+ descriptor.size.depthOrArrayLayers = 2;
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
}
@@ -217,7 +217,7 @@
wgpu::TextureDescriptor descriptor = defaultDescriptor;
descriptor.size.width = 32;
descriptor.size.height = 8;
- descriptor.size.depth = 64;
+ descriptor.size.depthOrArrayLayers = 64;
descriptor.dimension = wgpu::TextureDimension::e3D;
// Non square mip map halves width, height and depth until a 1x1x1 dimension for a 3D
// texture. So there are 7 mipmaps at most: 32 * 8 * 64, 16 * 4 * 32, 8 * 2 * 16,
@@ -231,7 +231,7 @@
wgpu::TextureDescriptor descriptor = defaultDescriptor;
descriptor.size.width = 32;
descriptor.size.height = 8;
- descriptor.size.depth = 64;
+ descriptor.size.depthOrArrayLayers = 64;
// Non square mip map halves width and height until a 1x1 dimension for a 2D texture,
// even its depth > 1. So there are 6 mipmaps at most: 32 * 8, 16 * 4, 8 * 2, 4 * 1, 2 *
// 1, 1 * 1.
@@ -261,21 +261,21 @@
{
wgpu::TextureDescriptor descriptor = defaultDescriptor;
- descriptor.size.depth = kMaxTextureArrayLayers + 1u;
+ descriptor.size.depthOrArrayLayers = kMaxTextureArrayLayers + 1u;
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
}
// Array layer count less than kMaxTextureArrayLayers is allowed
{
wgpu::TextureDescriptor descriptor = defaultDescriptor;
- descriptor.size.depth = kMaxTextureArrayLayers >> 1;
+ descriptor.size.depthOrArrayLayers = kMaxTextureArrayLayers >> 1;
device.CreateTexture(&descriptor);
}
// Array layer count equal to kMaxTextureArrayLayers is allowed
{
wgpu::TextureDescriptor descriptor = defaultDescriptor;
- descriptor.size.depth = kMaxTextureArrayLayers;
+ descriptor.size.depthOrArrayLayers = kMaxTextureArrayLayers;
device.CreateTexture(&descriptor);
}
}
@@ -602,7 +602,7 @@
for (wgpu::TextureFormat format : utils::kBCFormats) {
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
descriptor.format = format;
- descriptor.size.depth = 6;
+ descriptor.size.depthOrArrayLayers = 6;
device.CreateTexture(&descriptor);
}
}
@@ -612,7 +612,7 @@
for (wgpu::TextureFormat format : utils::kBCFormats) {
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
descriptor.format = format;
- descriptor.size.depth = 4;
+ descriptor.size.depthOrArrayLayers = 4;
descriptor.dimension = wgpu::TextureDimension::e3D;
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
}
diff --git a/src/tests/unittests/validation/TextureViewValidationTests.cpp b/src/tests/unittests/validation/TextureViewValidationTests.cpp
index e2f5476..31ad3c1 100644
--- a/src/tests/unittests/validation/TextureViewValidationTests.cpp
+++ b/src/tests/unittests/validation/TextureViewValidationTests.cpp
@@ -35,7 +35,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = width;
descriptor.size.height = height;
- descriptor.size.depth = arrayLayerCount;
+ descriptor.size.depthOrArrayLayers = 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 27b3c9c..d4a5ba9 100644
--- a/src/tests/unittests/validation/ValidationTest.cpp
+++ b/src/tests/unittests/validation/ValidationTest.cpp
@@ -187,7 +187,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = width;
descriptor.size.height = height;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.sampleCount = 1;
descriptor.format = attachmentFormat;
descriptor.mipLevelCount = 1;
diff --git a/src/tests/white_box/D3D12DescriptorHeapTests.cpp b/src/tests/white_box/D3D12DescriptorHeapTests.cpp
index 41985b1..cbbe21d 100644
--- a/src/tests/white_box/D3D12DescriptorHeapTests.cpp
+++ b/src/tests/white_box/D3D12DescriptorHeapTests.cpp
@@ -73,7 +73,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = width;
descriptor.size.height = height;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.sampleCount = 1;
descriptor.format = format;
descriptor.mipLevelCount = 1;
@@ -747,7 +747,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kRTSize;
descriptor.size.height = kRTSize;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
diff --git a/src/tests/white_box/D3D12ResourceHeapTests.cpp b/src/tests/white_box/D3D12ResourceHeapTests.cpp
index 450cb9e..b9606ce 100644
--- a/src/tests/white_box/D3D12ResourceHeapTests.cpp
+++ b/src/tests/white_box/D3D12ResourceHeapTests.cpp
@@ -54,7 +54,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = 8;
descriptor.size.height = 8;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::BC1RGBAUnorm;
descriptor.mipLevelCount = 1;
diff --git a/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp b/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp
index 1ab886b..c5b36e6 100644
--- a/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp
+++ b/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp
@@ -225,7 +225,7 @@
// Test an error occurs if the descriptor depth isn't 1
TEST_P(VulkanImageWrappingValidationTests, InvalidDepth) {
- defaultDescriptor.size.depth = 2;
+ defaultDescriptor.size.depthOrArrayLayers = 2;
ASSERT_DEVICE_ERROR(wgpu::Texture texture =
WrapVulkanImage(device, &defaultDescriptor, defaultFd,
@@ -770,7 +770,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = 640;
descriptor.size.height = 480;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 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 7df34ab..9e16567 100644
--- a/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp
+++ b/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp
@@ -314,7 +314,7 @@
// Test an error occurs if the descriptor depth isn't 1
TEST_P(VulkanImageWrappingValidationTests, InvalidDepth) {
DAWN_SKIP_TEST_IF(UsesWire());
- defaultDescriptor.size.depth = 2;
+ defaultDescriptor.size.depthOrArrayLayers = 2;
ASSERT_DEVICE_ERROR(wgpu::Texture texture = WrapVulkanImage(
device, &defaultDescriptor, defaultFd, defaultAllocationSize,
@@ -929,7 +929,7 @@
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = 640;
descriptor.size.height = 480;
- descriptor.size.depth = 1;
+ descriptor.size.depthOrArrayLayers = 1;
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
descriptor.mipLevelCount = 1;