Add a validation test for compressed texture with mipmaps
Compressed textures (BC formats) can support full or partial mip chains. This tiny change adds a validation test to ensure it. Bug: dawn:558 Change-Id: I584b65b7d049a3f188e3b56ca5c9ff36748151ae Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42004 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
parent
1024d6e187
commit
e9e9ee64f6
|
@ -440,8 +440,7 @@ namespace dawn_native {
|
||||||
}
|
}
|
||||||
uint32_t TextureBase::GetHeight() const {
|
uint32_t TextureBase::GetHeight() const {
|
||||||
ASSERT(!IsError());
|
ASSERT(!IsError());
|
||||||
ASSERT(mDimension == wgpu::TextureDimension::e2D ||
|
ASSERT(mDimension != wgpu::TextureDimension::e1D);
|
||||||
mDimension == wgpu::TextureDimension::e3D);
|
|
||||||
return mSize.height;
|
return mSize.height;
|
||||||
}
|
}
|
||||||
uint32_t TextureBase::GetDepth() const {
|
uint32_t TextureBase::GetDepth() const {
|
||||||
|
|
|
@ -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.
|
// 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.
|
// It is invalid to specify SampleCount > 1 when we create a texture in BC formats.
|
||||||
TEST_F(CompressedTextureFormatsValidationTests, SampleCount) {
|
TEST_F(CompressedTextureFormatsValidationTests, SampleCount) {
|
||||||
|
|
Loading…
Reference in New Issue