/* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef GrBackendTextureImageGenerator_DEFINED #define GrBackendTextureImageGenerator_DEFINED #include "include/core/SkRefCnt.h" #include "include/gpu/ganesh/GrBackendSurface.h" #include "include/gpu/ganesh/GrDirectContext.h" #include "include/gpu/ganesh/GrRecordingContext.h" #include "include/private/base/SkMutex.h" #include "include/private/gpu/ganesh/GrTextureGenerator.h" #include "src/gpu/ResourceKey.h" #include "src/gpu/ganesh/GrSurfaceProxyView.h" #include <memory> class GrSemaphore; class GrTexture; class SkColorInfo; class SkColorSpace; enum GrSurfaceOrigin : int; enum SkAlphaType : int; enum SkColorType : int; enum class GrImageTexGenPolicy : int; struct SkImageInfo; namespace skgpu { class RefCntedCallback; enum class Mipmapped : bool; } // namespace skgpu /* * This ImageGenerator is used to wrap a texture in one GrContext and can then be used as a source * in another GrContext. It holds onto a semaphore which the producing GrContext will signal and the * consuming GrContext will wait on before using the texture. Only one GrContext can ever be used * as a consumer (this is mostly because Vulkan can't allow multiple things to wait on the same * semaphore). * * In practice, this capability is used by clients to create backend-specific texture resources in * one thread (with, say, GrContext-A) and then ship them over to another GrContext (say, * GrContext-B) which will then use the texture as a source for draws. GrContext-A uses the * semaphore to notify GrContext-B when the shared texture is ready to use. */ class GrBackendTextureImageGenerator : public GrTextureGenerator { … }; #endif // GrBackendTextureImageGenerator_DEFINED