From 48661b868fbbf7a6193ef49bb6a05a0df61e7c45 Mon Sep 17 00:00:00 2001 From: Greg Daniel Date: Mon, 22 Jan 2018 16:11:35 -0500 Subject: Make use of VkSemaphores thread safe assuming use of the same VkQueue. This allows us to re-enable support for multiple GrContexts in GrBackendTextureImageGenerator. Bug: skia: Change-Id: Ifd6ac1ad81cdfbd1fd986467d8beb359399d6588 Reviewed-on: https://skia-review.googlesource.com/98340 Reviewed-by: Brian Osman Reviewed-by: Brian Salomon Commit-Queue: Greg Daniel --- src/gpu/GrBackendTextureImageGenerator.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/gpu/GrBackendTextureImageGenerator.cpp') diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp index 9b55704dce..b07115ef2d 100644 --- a/src/gpu/GrBackendTextureImageGenerator.cpp +++ b/src/gpu/GrBackendTextureImageGenerator.cpp @@ -80,6 +80,7 @@ void GrBackendTextureImageGenerator::ReleaseRefHelper_TextureReleaseProc(void* c SkASSERT(refHelper); refHelper->fBorrowedTexture = nullptr; + refHelper->fBorrowingContextID = SK_InvalidGenID; refHelper->unref(); } @@ -125,11 +126,12 @@ sk_sp GrBackendTextureImageGenerator::onGenerateTexture( if (!resourceProvider) { // If we get here then we never created a texture to pass the refHelper ref off // to. Thus we must unref it ourselves. + refHelper->fBorrowingContextID = SK_InvalidGenID; refHelper->unref(); return sk_sp(); } - if (semaphore && !semaphore->hasSubmittedWait()) { + if (semaphore) { resourceProvider->priv().gpu()->waitSemaphore(semaphore); } @@ -155,6 +157,7 @@ sk_sp GrBackendTextureImageGenerator::onGenerateTexture( tex = resourceProvider->wrapBackendTexture(backendTexture, kBorrow_GrWrapOwnership); if (!tex) { + refHelper->fBorrowingContextID = SK_InvalidGenID; refHelper->unref(); return sk_sp(); } -- cgit v1.2.3