Make RG11B10 non-renderable.

This also adds the extra validation needed to support non-renderable
formats, as well as tests for it

BUG=dawn:128

Change-Id: I3bc79b641aa0fd5e3358f89a87f2e457d0ecc58a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8760
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Corentin Wallez
2019-07-11 14:57:15 +00:00
committed by Commit Bot service account
parent ea2d558479
commit 002395300f
3 changed files with 55 additions and 10 deletions

View File

@@ -235,6 +235,21 @@ TEST_F(TextureValidationTest, EncodeDestroySubmit) {
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
}
// Test it is an error to create an OutputAttachment texture with a non-renderable format.
TEST_F(TextureValidationTest, NonRenderableAndOutputAttachment) {
dawn::TextureDescriptor descriptor;
descriptor.size = {1, 1, 1};
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
// Succeeds because RGBA8Unorm is renderable
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
device.CreateTexture(&descriptor);
// Fails because RG11B10Float is non-renderable
descriptor.format = dawn::TextureFormat::RG11B10Float;
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
}
// TODO(jiawei.shao@intel.com): use compressed texture formats as extensions.
// TODO(jiawei.shao@intel.com): add tests to verify we cannot create 1D or 3D textures with
// compressed texture formats.