Destroy frontend and backend for Textures

Same idea as for buffers, Destroy can be used to free GPU memory
associated with resources without waiting for javascript garbage
collection to occur.

Bug: dawn:46
Change-Id: Ia796b06b5228cbec4cfe8d78a500f967181d8c1f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5540
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
This commit is contained in:
Natasha Lee
2019-03-27 22:04:10 +00:00
committed by Commit Bot service account
parent 889d743baa
commit cae68ff846
17 changed files with 235 additions and 52 deletions

View File

@@ -242,4 +242,12 @@ TEST_F(TextureViewValidationTest, TextureViewFormatCompatibility) {
}
}
// Test that it's invalid to create a texture view from a destroyed texture
TEST_F(TextureViewValidationTest, DestroyCreateTextureView) {
dawn::Texture texture = Create2DArrayTexture(device, 1);
dawn::TextureViewDescriptor descriptor =
CreateDefaultTextureViewDescriptor(dawn::TextureViewDimension::e2D);
texture.Destroy();
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
}
}