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>
This commit is contained in:
shrekshao
2021-03-22 21:12:36 +00:00
committed by Commit Bot service account
parent a9b211d202
commit b00de7f8e8
63 changed files with 580 additions and 232 deletions

View File

@@ -41,7 +41,7 @@ class CopyCommandTest : public ValidationTest {
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 @@ TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
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 @@ TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
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 @@ TEST_F(CopyCommandTest_T2T, Success) {
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});

View File

@@ -38,7 +38,7 @@ namespace {
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 @@ namespace {
// 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 =

View File

@@ -55,7 +55,7 @@ namespace {
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;

View File

@@ -238,7 +238,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
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;

View File

@@ -33,7 +33,7 @@ namespace {
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 @@ namespace {
{
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 @@ namespace {
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 @@ namespace {
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 @@ namespace {
{
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 @@ namespace {
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 @@ namespace {
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));
}

View File

@@ -35,7 +35,7 @@ namespace {
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;

View File

@@ -187,7 +187,7 @@ ValidationTest::DummyRenderPass::DummyRenderPass(const wgpu::Device& device)
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;