diff options
author | Greg Daniel <egdaniel@google.com> | 2017-04-21 11:52:27 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-21 17:20:27 +0000 |
commit | cef213c97ea9992efacd028fe304a18b438f8147 (patch) | |
tree | aa7662dd076fad410dad942da947014abb8cd205 /src/gpu/gl/GrGLTexture.h | |
parent | 795c5b156756796cbb3a584c99b1ab51fb5fe187 (diff) |
Move ReleaseProc info to GrTexture and for implementations to define it.
Bug: skia:
Change-Id: I0dbe421ebd17ef7d21fd2f4f027d2a3bdcf04b7b
Reviewed-on: https://skia-review.googlesource.com/14031
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/gl/GrGLTexture.h')
-rw-r--r-- | src/gpu/gl/GrGLTexture.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h index 16b47f1f07..7ba8058fc8 100644 --- a/src/gpu/gl/GrGLTexture.h +++ b/src/gpu/gl/GrGLTexture.h @@ -36,10 +36,20 @@ public: GrGLTexture(GrGLGpu*, SkBudgeted, const GrSurfaceDesc&, const IDDesc&, bool wasMipMapDataProvided); + ~GrGLTexture() override { + // check that invokeReleaseProc has been called (if needed) + SkASSERT(!fReleaseProc); + } + GrBackendObject getTextureHandle() const override; void textureParamsModified() override { fTexParams.invalidate(); } + void setRelease(ReleaseProc proc, ReleaseCtx ctx) override { + fReleaseProc = proc; + fReleaseCtx = ctx; + } + // These functions are used to track the texture parameters associated with the texture. const TexParams& getCachedTexParams(GrGpu::ResetTimestamp* timestamp) const { *timestamp = fTexParamsTimestamp; @@ -74,6 +84,13 @@ protected: std::unique_ptr<GrExternalTextureData> detachBackendTexture() override; private: + void invokeReleaseProc() { + if (fReleaseProc) { + fReleaseProc(fReleaseCtx); + fReleaseProc = nullptr; + } + } + TexParams fTexParams; GrGpu::ResetTimestamp fTexParamsTimestamp; // Holds the texture target and ID. A pointer to this may be shared to external clients for @@ -81,6 +98,9 @@ private: GrGLTextureInfo fInfo; GrBackendObjectOwnership fTextureIDOwnership; + ReleaseProc fReleaseProc = nullptr; + ReleaseCtx fReleaseCtx = nullptr; + typedef GrTexture INHERITED; }; |