aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gpu/gl/GrGLRenderTarget.cpp5
-rw-r--r--src/gpu/gl/GrGLRenderTarget.h4
-rw-r--r--src/gpu/gl/GrGLTexture.cpp5
-rw-r--r--src/gpu/gl/GrGLTexture.h4
4 files changed, 16 insertions, 2 deletions
diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp
index 8482ecdc6..2d6c19c04 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::gpuMemorySize() 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 0f041600e..50e3b5ace 100644
--- a/src/gpu/gl/GrGLRenderTarget.h
+++ b/src/gpu/gl/GrGLRenderTarget.h
@@ -77,6 +77,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 8777d1b75..ce892ddbb 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 f23adae0d..c3c396eff 100644
--- a/src/gpu/gl/GrGLTexture.h
+++ b/src/gpu/gl/GrGLTexture.h
@@ -70,6 +70,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;
};