Fix up GPUDDLSink for Vulkan

Change-Id: If38afff3d07f51fd0f5a989c2f59e3c788086f8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/284099
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2020-04-16 15:42:50 -04:00 committed by Skia Commit-Bot
parent c15c936c3e
commit 4e3ceb96b8
2 changed files with 15 additions and 1 deletions

View File

@ -1671,7 +1671,17 @@ Result GPUDDLSink::ddlDraw(const Src& src,
recordingTaskGroup->wait();
// This should be the only explicit flush for the entire DDL draw
gpuTaskGroup->add([gpuThreadCtx]() { gpuThreadCtx->flush(); });
gpuTaskGroup->add([gpuThreadCtx]() {
// We need to ensure all the GPU work is finished so
// the following 'deleteAllFromGPU' call will work
// on Vulkan.
// TODO: switch over to using the promiseImage callbacks
// to free the backendTextures. This is complicated a
// bit by which thread possesses the direct context.
GrFlushInfo flushInfoSyncCpu;
flushInfoSyncCpu.fFlags = kSyncCpu_GrFlushFlag;
gpuThreadCtx->flush(flushInfoSyncCpu);
});
// The backend textures are created on the gpuThread by the 'uploadAllToGPU' call.
// It is simpler to also delete them at this point on the gpuThread.

View File

@ -88,6 +88,10 @@ private:
void destroyBackendTexture() {
SkASSERT(!fPromiseImageTexture || fPromiseImageTexture->unique());
if (fPromiseImageTexture) {
fContext->deleteBackendTexture(fPromiseImageTexture->backendTexture());
}
fPromiseImageTexture = nullptr;
}