Minor changes in TextureValidationTests
Bug: dawn:558 Change-Id: I86f014b6d82edd4cf7ca112577d08c3b85b20c39 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30767 Commit-Queue: Yunchao He <yunchao.he@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
bb3d7981ec
commit
346b20ab7c
|
@ -144,25 +144,35 @@ namespace {
|
|||
device.CreateTexture(&descriptor);
|
||||
}
|
||||
|
||||
// Too big mip chains on width are disallowed
|
||||
// Test non-power-of-two width
|
||||
{
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
// Mip level width: 31, 15, 7, 3, 1
|
||||
descriptor.size.width = 31;
|
||||
descriptor.size.height = 32;
|
||||
// Mip level width: 31, 15, 7, 3, 1, 1
|
||||
descriptor.mipLevelCount = 7;
|
||||
descriptor.size.height = 4;
|
||||
|
||||
// Full mip chains on non-power-of-two width are allowed
|
||||
descriptor.mipLevelCount = 5;
|
||||
device.CreateTexture(&descriptor);
|
||||
|
||||
// Too big mip chains on non-power-of-two width are disallowed
|
||||
descriptor.mipLevelCount = 6;
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
|
||||
// Too big mip chains on height are disallowed
|
||||
// Test non-power-of-two height
|
||||
{
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.size.width = 32;
|
||||
descriptor.size.width = 4;
|
||||
// Mip level height: 31, 15, 7, 3, 1
|
||||
descriptor.size.height = 31;
|
||||
// Mip level height: 31, 15, 7, 3, 1, 1
|
||||
descriptor.mipLevelCount = 7;
|
||||
|
||||
// Full mip chains on non-power-of-two height are allowed
|
||||
descriptor.mipLevelCount = 5;
|
||||
device.CreateTexture(&descriptor);
|
||||
|
||||
// Too big mip chains on non-power-of-two height are disallowed
|
||||
descriptor.mipLevelCount = 6;
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
|
||||
|
@ -446,25 +456,16 @@ namespace {
|
|||
TEST_F(CompressedTextureFormatsValidationTests, TextureUsage) {
|
||||
// Test that only CopySrc, CopyDst and Sampled are accepted as the texture usage of the
|
||||
// textures in BC formats.
|
||||
wgpu::TextureUsage invalidUsages[] = {
|
||||
wgpu::TextureUsage::OutputAttachment,
|
||||
wgpu::TextureUsage::Storage,
|
||||
wgpu::TextureUsage::Present,
|
||||
};
|
||||
for (wgpu::TextureFormat format : kBCFormats) {
|
||||
{
|
||||
for (wgpu::TextureUsage usage : invalidUsages) {
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = format;
|
||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
|
||||
{
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = format;
|
||||
descriptor.usage = wgpu::TextureUsage::Storage;
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
|
||||
{
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = format;
|
||||
descriptor.usage = wgpu::TextureUsage::Present;
|
||||
descriptor.usage = usage;
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue