Clear reference to MTLTexture on TextureView::DestroyImpl

Bug: dawn:1355
Change-Id: I834b02a05d50c39b1a8d272e2d437d7ce1f96fb5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115061
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
This commit is contained in:
Austin Eng 2022-12-19 23:36:00 +00:00 committed by Dawn LUCI CQ
parent 13e48132c0
commit 5cc118bde7
2 changed files with 5 additions and 1 deletions

View File

@ -104,8 +104,8 @@ class TextureView final : public TextureViewBase {
private:
using TextureViewBase::TextureViewBase;
MaybeError Initialize(const TextureViewDescriptor* descriptor);
void DestroyImpl() override;
// TODO(crbug.com/dawn/1355): Clear this reference on texture destroy.
NSPRef<id<MTLTexture>> mMtlTextureView;
};

View File

@ -1124,6 +1124,10 @@ MaybeError TextureView::Initialize(const TextureViewDescriptor* descriptor) {
return {};
}
void TextureView::DestroyImpl() {
mMtlTextureView = nil;
}
id<MTLTexture> TextureView::GetMTLTexture() const {
ASSERT(mMtlTextureView != nullptr);
return mMtlTextureView.Get();