Validate that the device is alive when wrapping external images

Will be tested in Chromium's webgpu_mailbox_unittest.cc

Bug: chromium:1359106
Change-Id: I8a9bf01cd593f2835e2876fa04139fd3afda9b2e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103462
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2022-09-22 22:10:56 +00:00 committed by Dawn LUCI CQ
parent d4dd547bae
commit 534a198f88
2 changed files with 6 additions and 1 deletions

View File

@ -464,7 +464,9 @@ MaybeError Device::CopyFromStagingToTexture(const StagingBufferBase* source,
Ref<Texture> Device::CreateTextureWrappingIOSurface(const ExternalImageDescriptor* descriptor, Ref<Texture> Device::CreateTextureWrappingIOSurface(const ExternalImageDescriptor* descriptor,
IOSurfaceRef ioSurface) { IOSurfaceRef ioSurface) {
const TextureDescriptor* textureDescriptor = FromAPI(descriptor->cTextureDescriptor); const TextureDescriptor* textureDescriptor = FromAPI(descriptor->cTextureDescriptor);
if (ConsumedError(ValidateIsAlive())) {
return nullptr;
}
if (ConsumedError(ValidateTextureDescriptor(this, textureDescriptor))) { if (ConsumedError(ValidateTextureDescriptor(this, textureDescriptor))) {
return nullptr; return nullptr;
} }

View File

@ -904,6 +904,9 @@ TextureBase* Device::CreateTextureWrappingVulkanImage(
const TextureDescriptor* textureDescriptor = FromAPI(descriptor->cTextureDescriptor); const TextureDescriptor* textureDescriptor = FromAPI(descriptor->cTextureDescriptor);
// Initial validation // Initial validation
if (ConsumedError(ValidateIsAlive())) {
return nullptr;
}
if (ConsumedError(ValidateTextureDescriptor(this, textureDescriptor))) { if (ConsumedError(ValidateTextureDescriptor(this, textureDescriptor))) {
return nullptr; return nullptr;
} }