Make sure we release all refs in GrD3DTextureResource::releaseResource.

We were holding on to an additional ref to the ID3D12Resource* in the
fInfo struct, so it didn't actually get released until the destructor.

Change-Id: I529daf66ff6caf1516fd21881f9820d7d21bb642
Bug: skia:9935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318657
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Jim Van Verth 2020-09-22 14:01:36 -04:00 committed by Skia Commit-Bot
parent 3d6d4160ee
commit 772e04d1af

View File

@ -112,6 +112,7 @@ std::pair<GrD3DTextureResourceInfo, sk_sp<GrD3DResourceState>> GrD3DTextureResou
GrD3DTextureResource::~GrD3DTextureResource() {
// Should have been reset() before
SkASSERT(!fResource);
SkASSERT(!fInfo.fResource);
}
void GrD3DTextureResource::prepareForPresent(GrD3DGpu* gpu) {
@ -122,8 +123,9 @@ void GrD3DTextureResource::releaseResource(GrD3DGpu* gpu) {
// TODO: do we need to migrate resource state if we change queues?
if (fResource) {
fResource->removeOwningTexture();
fResource.reset(nullptr);
fResource.reset();
}
fInfo.fResource.reset();
}
void GrD3DTextureResource::setResourceRelease(sk_sp<GrRefCntedCallback> releaseHelper) {