diff --git a/src/dawn_native/Texture.cpp b/src/dawn_native/Texture.cpp index 93e4070f4a..21ae34b61b 100644 --- a/src/dawn_native/Texture.cpp +++ b/src/dawn_native/Texture.cpp @@ -440,8 +440,7 @@ namespace dawn_native { } uint32_t TextureBase::GetHeight() const { ASSERT(!IsError()); - ASSERT(mDimension == wgpu::TextureDimension::e2D || - mDimension == wgpu::TextureDimension::e3D); + ASSERT(mDimension != wgpu::TextureDimension::e1D); return mSize.height; } uint32_t TextureBase::GetDepth() const { diff --git a/src/tests/unittests/validation/TextureValidationTests.cpp b/src/tests/unittests/validation/TextureValidationTests.cpp index f5c0de5430..7ff68f08d9 100644 --- a/src/tests/unittests/validation/TextureValidationTests.cpp +++ b/src/tests/unittests/validation/TextureValidationTests.cpp @@ -575,6 +575,17 @@ namespace { } } + TEST_F(CompressedTextureFormatsValidationTests, MipLevelCount) { + for (wgpu::TextureFormat format : utils::kBCFormats) { + for (uint32_t mipLevels : {1, 3, 6}) { + wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor(); + descriptor.format = format; + descriptor.mipLevelCount = mipLevels; + device.CreateTexture(&descriptor); + } + } + } + // Test the validation of sample count when creating textures in compressed texture formats. // It is invalid to specify SampleCount > 1 when we create a texture in BC formats. TEST_F(CompressedTextureFormatsValidationTests, SampleCount) {