Match WebGPU's TextureViewDescriptor.dimension defaults.

This matches the choice made in https://github.com/gpuweb/gpuweb/pull/424

BUG=dawn:214

Change-Id: I9913f2c9c2f40b1ccc40c51cf79f50c171a48b3d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10861
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Corentin Wallez
2019-09-05 09:35:57 +00:00
committed by Commit Bot service account
parent c6c7a42e6e
commit a560104617
2 changed files with 33 additions and 27 deletions

View File

@@ -181,10 +181,7 @@ TEST_F(TextureViewValidationTest, TextureViewDescriptorDefaultsArray) {
constexpr uint32_t kDefaultArrayLayers = 6;
dawn::Texture texture = Create2DArrayTexture(device, kDefaultArrayLayers);
{
dawn::TextureViewDescriptor descriptor;
texture.CreateView(&descriptor);
}
{ texture.CreateView(); }
{
dawn::TextureViewDescriptor descriptor;
descriptor.format = dawn::TextureFormat::Undefined;
@@ -205,8 +202,14 @@ TEST_F(TextureViewValidationTest, TextureViewDescriptorDefaultsArray) {
}
{
dawn::TextureViewDescriptor descriptor;
// Setting array layers to non-0 means the dimensionality will
// default to 2D so by itself it causes an error.
descriptor.arrayLayerCount = kDefaultArrayLayers;
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
descriptor.dimension = dawn::TextureViewDimension::e2DArray;
texture.CreateView(&descriptor);
descriptor.mipLevelCount = kDefaultMipLevels;
texture.CreateView(&descriptor);
}
@@ -219,10 +222,7 @@ TEST_F(TextureViewValidationTest, TextureViewDescriptorDefaultsNonArray) {
constexpr uint32_t kDefaultArrayLayers = 1;
dawn::Texture texture = Create2DArrayTexture(device, kDefaultArrayLayers);
{
dawn::TextureViewDescriptor descriptor;
texture.CreateView(&descriptor);
}
{ texture.CreateView(); }
{
dawn::TextureViewDescriptor descriptor;
descriptor.format = dawn::TextureFormat::Undefined;