Make sure we wait to call finishedCallback in vk setBackendSurfaceState.

Bug: b/189671648
Change-Id: Iae04853184a5fe12459469db5e129db0cb5719a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414520
Auto-Submit: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Greg Daniel 2021-06-01 15:33:29 -04:00 committed by Skia Commit-Bot
parent df3ed435a7
commit 1ebf23c95d
2 changed files with 10 additions and 4 deletions

View File

@ -1801,7 +1801,8 @@ bool GrVkGpu::setBackendSurfaceState(GrVkImageInfo info,
sk_sp<GrBackendSurfaceMutableStateImpl> currentState,
SkISize dimensions,
const GrVkSharedImageInfo& newInfo,
GrBackendSurfaceMutableState* previousState) {
GrBackendSurfaceMutableState* previousState,
sk_sp<GrRefCntedCallback> finishedCallback) {
sk_sp<GrVkAttachment> texture = GrVkAttachment::MakeWrapped(
this, dimensions, info, std::move(currentState),
GrVkAttachment::UsageFlags::kColorAttachment, kBorrow_GrWrapOwnership,
@ -1815,6 +1816,9 @@ bool GrVkGpu::setBackendSurfaceState(GrVkImageInfo info,
texture->currentQueueFamilyIndex());
}
set_layout_and_queue_from_mutable_state(this, texture.get(), newInfo);
if (finishedCallback) {
this->addFinishedCallback(std::move(finishedCallback));
}
return true;
}
@ -1828,7 +1832,8 @@ bool GrVkGpu::setBackendTextureState(const GrBackendTexture& backendTeture,
SkASSERT(currentState);
SkASSERT(newState.isValid() && newState.fBackend == GrBackend::kVulkan);
return this->setBackendSurfaceState(info, std::move(currentState), backendTeture.dimensions(),
newState.fVkState, previousState);
newState.fVkState, previousState,
std::move(finishedCallback));
}
bool GrVkGpu::setBackendRenderTargetState(const GrBackendRenderTarget& backendRenderTarget,
@ -1842,7 +1847,7 @@ bool GrVkGpu::setBackendRenderTargetState(const GrBackendRenderTarget& backendRe
SkASSERT(newState.fBackend == GrBackend::kVulkan);
return this->setBackendSurfaceState(info, std::move(currentState),
backendRenderTarget.dimensions(), newState.fVkState,
previousState);
previousState, std::move(finishedCallback));
}
void GrVkGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType barrierType) {

View File

@ -232,7 +232,8 @@ private:
sk_sp<GrBackendSurfaceMutableStateImpl> currentState,
SkISize dimensions,
const GrVkSharedImageInfo& newInfo,
GrBackendSurfaceMutableState* previousState);
GrBackendSurfaceMutableState* previousState,
sk_sp<GrRefCntedCallback> finishedCallback);
sk_sp<GrTexture> onCreateTexture(SkISize,
const GrBackendFormat&,