diff options
author | Brian Osman <brianosman@google.com> | 2017-03-02 15:09:20 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-02 20:47:36 +0000 |
commit | fe3b51636d4216c4ea6cb74ed0964c1d315ca487 (patch) | |
tree | e85907dad1a167ecceace5de1e6157a787fe0bac /include/gpu | |
parent | e836b7817e8b28f0bd69578b8dfd83b8ef00248c (diff) |
Use GrSemaphore rather than GrFence for external texture data
BUG=skia:
Change-Id: I0d23eb9dcf5c01c71d3571ef97690af68b900807
Reviewed-on: https://skia-review.googlesource.com/9141
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include/gpu')
-rw-r--r-- | include/gpu/GrContext.h | 6 | ||||
-rw-r--r-- | include/gpu/GrExternalTextureData.h | 10 | ||||
-rw-r--r-- | include/gpu/gl/GrGLTypes.h | 9 | ||||
-rw-r--r-- | include/gpu/vk/GrVkTypes.h | 7 |
4 files changed, 14 insertions, 18 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 285525f2f7..702fdb64eb 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -325,12 +325,6 @@ public: void prepareSurfaceForExternalIO(GrSurface*); /** - * As above, but additionally flushes the backend API (eg calls glFlush), and returns a fence - * that can be used to determine if the surface is safe to use on another context or thread. - */ - GrFence SK_WARN_UNUSED_RESULT prepareSurfaceForExternalIOAndFlush(GrSurface*); - - /** * An ID associated with this context, guaranteed to be unique. */ uint32_t uniqueID() { return fUniqueID; } diff --git a/include/gpu/GrExternalTextureData.h b/include/gpu/GrExternalTextureData.h index 9ab819ce70..5943fd8c58 100644 --- a/include/gpu/GrExternalTextureData.h +++ b/include/gpu/GrExternalTextureData.h @@ -10,21 +10,19 @@ #define GrExternalTextureData_DEFINED #include "GrTypes.h" -#include "GrTypesPriv.h" + +class GrContext; class SK_API GrExternalTextureData : SkNoncopyable { public: - GrExternalTextureData(GrFence fence) : fFence(fence) {} virtual ~GrExternalTextureData() {} virtual GrBackend getBackend() const = 0; - GrFence getFence() const { return fFence; } - protected: virtual GrBackendObject getBackendObject() const = 0; - - GrFence fFence; + virtual void attachToContext(GrContext*) = 0; friend class SkCrossContextImageData; + friend class SkImage; }; #endif diff --git a/include/gpu/gl/GrGLTypes.h b/include/gpu/gl/GrGLTypes.h index d03363c75e..baf87a4b61 100644 --- a/include/gpu/gl/GrGLTypes.h +++ b/include/gpu/gl/GrGLTypes.h @@ -11,6 +11,7 @@ #include "GrExternalTextureData.h" #include "GrGLConfig.h" +#include "SkRefCnt.h" /** * Classifies GL contexts by which standard they implement (currently as OpenGL vs. OpenGL ES). @@ -113,19 +114,21 @@ struct GrGLTextureInfo { GrGLuint fID; }; +class GrSemaphore; + class GrGLExternalTextureData : public GrExternalTextureData { public: - GrGLExternalTextureData(const GrGLTextureInfo& info, GrFence fence) - : INHERITED(fence) - , fInfo(info) {} + GrGLExternalTextureData(const GrGLTextureInfo& info, sk_sp<GrSemaphore> semaphore); GrBackend getBackend() const override { return kOpenGL_GrBackend; } protected: GrBackendObject getBackendObject() const override { return reinterpret_cast<GrBackendObject>(&fInfo); } + void attachToContext(GrContext*) override; GrGLTextureInfo fInfo; + sk_sp<GrSemaphore> fSemaphore; typedef GrExternalTextureData INHERITED; }; diff --git a/include/gpu/vk/GrVkTypes.h b/include/gpu/vk/GrVkTypes.h index e9a312160d..c98a94aa92 100644 --- a/include/gpu/vk/GrVkTypes.h +++ b/include/gpu/vk/GrVkTypes.h @@ -62,15 +62,16 @@ struct GrVkImageInfo { class GrVkExternalTextureData : public GrExternalTextureData { public: - GrVkExternalTextureData(const GrVkImageInfo& info, GrFence fence) - : INHERITED(fence) - , fInfo(info) {} + GrVkExternalTextureData(const GrVkImageInfo& info) : fInfo(info) {} GrBackend getBackend() const override { return kVulkan_GrBackend; } protected: GrBackendObject getBackendObject() const override { return reinterpret_cast<GrBackendObject>(&fInfo); } + void attachToContext(GrContext*) override { + // TODO: Implement this + } GrVkImageInfo fInfo; |