diff options
author | 2014-12-09 14:26:47 -0800 | |
---|---|---|
committer | 2014-12-09 14:26:47 -0800 | |
commit | 9a0c7abfd7ce8694136840fa224e99579b8329f6 (patch) | |
tree | 33ce865c05e9b6874ead18b1a40163d311b8f4ee /src/gpu | |
parent | 7af39f6e8da480930186e5c2fff90ac21ebdba82 (diff) |
Skia: Track the fIsWrapped separately so that we delete correctly
GrGlTextureRenderTarget inherits virtually from both GrGlRenderTarget and
GrGLTexture, which both have a 'wrap' flag. The passed in wrap setting could
be different for the two base classes, but since it's virtually inherited,
they share the same flag, so they're either both on, or both off.
As a result, we fail to delete the frambuffer.
To fix this, we now keep a separate isWrapped flag for GrGlRenderTarget.
BUG=437998
Review URL: https://codereview.chromium.org/791493003
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/gl/GrGLRenderTarget.cpp | 5 | ||||
-rw-r--r-- | src/gpu/gl/GrGLRenderTarget.h | 4 | ||||
-rw-r--r-- | src/gpu/gl/GrGLTexture.cpp | 5 | ||||
-rw-r--r-- | src/gpu/gl/GrGLTexture.h | 4 |
4 files changed, 16 insertions, 2 deletions
diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp index 98813beb2c..4af7be2c1b 100644 --- a/src/gpu/gl/GrGLRenderTarget.cpp +++ b/src/gpu/gl/GrGLRenderTarget.cpp @@ -31,6 +31,7 @@ void GrGLRenderTarget::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { fRTFBOID = idDesc.fRTFBOID; fTexFBOID = idDesc.fTexFBOID; fMSColorRenderbufferID = idDesc.fMSColorRenderbufferID; + fIsWrapped = idDesc.fIsWrapped; fViewport.fLeft = 0; fViewport.fBottom = 0; @@ -54,7 +55,7 @@ size_t GrGLRenderTarget::onGpuMemorySize() const { } void GrGLRenderTarget::onRelease() { - if (!this->isWrapped()) { + if (!fIsWrapped) { if (fTexFBOID) { GL_CALL(DeleteFramebuffers(1, &fTexFBOID)); } @@ -68,6 +69,7 @@ void GrGLRenderTarget::onRelease() { fRTFBOID = 0; fTexFBOID = 0; fMSColorRenderbufferID = 0; + fIsWrapped = false; INHERITED::onRelease(); } @@ -75,5 +77,6 @@ void GrGLRenderTarget::onAbandon() { fRTFBOID = 0; fTexFBOID = 0; fMSColorRenderbufferID = 0; + fIsWrapped = false; INHERITED::onAbandon(); } diff --git a/src/gpu/gl/GrGLRenderTarget.h b/src/gpu/gl/GrGLRenderTarget.h index fd149b1185..e66475d92c 100644 --- a/src/gpu/gl/GrGLRenderTarget.h +++ b/src/gpu/gl/GrGLRenderTarget.h @@ -76,6 +76,10 @@ private: GrGLuint fTexFBOID; GrGLuint fMSColorRenderbufferID; + // We track this separately from GrGpuResource because this may be both a texture and a render + // target, and the texture may be wrapped while the render target is not. + bool fIsWrapped; + // when we switch to this render target we want to set the viewport to // only render to content area (as opposed to the whole allocation) and // we want the rendering to be at top left (GL has origin in bottom left) diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp index 8777d1b755..ce892ddbb1 100644 --- a/src/gpu/gl/GrGLTexture.cpp +++ b/src/gpu/gl/GrGLTexture.cpp @@ -30,20 +30,23 @@ void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { fTexParams.invalidate(); fTexParamsTimestamp = GrGpu::kExpiredTimestamp; fTextureID = idDesc.fTextureID; + fIsWrapped = idDesc.fIsWrapped; } void GrGLTexture::onRelease() { if (fTextureID) { - if (!this->isWrapped()) { + if (!fIsWrapped) { GL_CALL(DeleteTextures(1, &fTextureID)); } fTextureID = 0; + fIsWrapped = false; } INHERITED::onRelease(); } void GrGLTexture::onAbandon() { fTextureID = 0; + fIsWrapped = false; INHERITED::onAbandon(); } diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h index 268fe9239e..bfa0ec34ac 100644 --- a/src/gpu/gl/GrGLTexture.h +++ b/src/gpu/gl/GrGLTexture.h @@ -68,6 +68,10 @@ private: GrGpu::ResetTimestamp fTexParamsTimestamp; GrGLuint fTextureID; + // We track this separately from GrGpuResource because this may be both a texture and a render + // target, and the texture may be wrapped while the render target is not. + bool fIsWrapped; + typedef GrTexture INHERITED; }; |