Add unsafe API tests for 3D textures

This change also marks 3D view creation as Unsafe API.

BUG: dawn:547

Change-Id: Icdb7b48f19054d70258363f6d58ded957be72b70
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/46723
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
Yunchao He
2021-04-08 18:32:17 +00:00
committed by Commit Bot service account
parent 9002c67ab4
commit 1e45c5e764
4 changed files with 28 additions and 3 deletions

View File

@@ -28,6 +28,22 @@ class UnsafeAPIValidationTest : public ValidationTest {
}
};
// Check that 3D Texture creation is disallowed as part of unsafe APIs.
TEST_F(UnsafeAPIValidationTest, 3DTextureCreationDisallowed) {
wgpu::TextureDescriptor baseDesc;
baseDesc.size = {32, 32, 6};
baseDesc.format = wgpu::TextureFormat::RGBA8Unorm;
baseDesc.usage = wgpu::TextureUsage::Sampled;
// Control case: 2D (array) texture creation is allowed.
device.CreateTexture(&baseDesc);
// 3D texture creation is disallowed.
wgpu::TextureDescriptor texture3DDesc = baseDesc;
texture3DDesc.dimension = wgpu::TextureDimension::e3D;
ASSERT_DEVICE_ERROR(device.CreateTexture(&texture3DDesc));
}
// Check that DrawIndexedIndirect is disallowed as part of unsafe APIs.
TEST_F(UnsafeAPIValidationTest, DrawIndexedIndirectDisallowed) {
// Create the index and indirect buffers.