Add validation on the creation of 4x Multisampled textures

This patch adds validations on the creation of the multisampled textures
with sampleCount == 4. The validations include:
1. Only accept 1 or 4 as valid value of sampleCount.
2. According to Vulkan SPEC, when sampleCount > 1:
- The value of mipLevelCount can only be 1
- We cannot create cube map or cube map array texture views on this
  texture.

BUG=dawn:56
TEST=dawn_unittests

Change-Id: Iac7cbe7cd7af16216b9185afd37a80eef0712f6b
Reviewed-on: https://dawn-review.googlesource.com/c/5160
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Jiawei Shao
2019-03-04 01:31:38 +00:00
committed by Commit Bot service account
parent 1c92c159ad
commit a8ce0a434e
4 changed files with 98 additions and 8 deletions

View File

@@ -56,6 +56,14 @@ TEST_F(TextureValidationTest, SampleCount) {
device.CreateTexture(&descriptor);
}
// sampleCount == 4 is allowed.
{
dawn::TextureDescriptor descriptor = defaultDescriptor;
descriptor.sampleCount = 4;
device.CreateTexture(&descriptor);
}
// It is an error to create a texture with an invalid sampleCount.
{
dawn::TextureDescriptor descriptor = defaultDescriptor;
@@ -63,5 +71,14 @@ TEST_F(TextureValidationTest, SampleCount) {
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
}
// It is an error to create a multisampled texture with mipLevelCount > 1.
{
dawn::TextureDescriptor descriptor = defaultDescriptor;
descriptor.sampleCount = 4;
descriptor.mipLevelCount = 2;
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
}
}
} // namespace