Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Unified Diff: src/gpu/gl/GrGLRenderTarget.cpp

Issue 1009563003: Revert of Improve tracking of bound FBOs in GrGLGpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLRenderTarget.h ('k') | src/gpu/gl/debug/GrGLCreateDebugInterface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLRenderTarget.cpp
diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp
index 8b9bb98b6b5ac8d89c020a4198c79da1901fe1ed..3eb2ae09fea489802fe38faa77523be8c6c17fc9 100644
--- a/src/gpu/gl/GrGLRenderTarget.cpp
+++ b/src/gpu/gl/GrGLRenderTarget.cpp
@@ -9,20 +9,8 @@
#include "GrGLGpu.h"
-void GrGLFBO::release(const GrGLInterface* gl) {
- SkASSERT(gl);
- if (this->isValid()) {
- GR_GL_CALL(gl, DeleteFramebuffers(1, &fID));
- fIsValid = false;
- }
-}
-
-void GrGLFBO::abandon() { fIsValid = false; }
-
-//////////////////////////////////////////////////////////////////////////////
-
-#define GLGPU static_cast<GrGLGpu*>(this->getGpu())
-#define GL_CALL(X) GR_GL_CALL(GLGPU->glInterface(), X)
+#define GPUGL static_cast<GrGLGpu*>(this->getGpu())
+#define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X)
// Because this class is virtually derived from GrSurface we must explicitly call its constructor.
GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc)
@@ -40,10 +28,8 @@
}
void GrGLRenderTarget::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) {
- fRenderFBO.reset(SkRef(idDesc.fRenderFBO.get()));
- fTextureFBO.reset(SkSafeRef(idDesc.fTextureFBO.get()));
- SkASSERT(fRenderFBO->isValid());
- SkASSERT(!fTextureFBO || fTextureFBO->isValid());
+ fRTFBOID = idDesc.fRTFBOID;
+ fTexFBOID = idDesc.fTexFBOID;
fMSColorRenderbufferID = idDesc.fMSColorRenderbufferID;
fIsWrapped = kWrapped_LifeCycle == idDesc.fLifeCycle;
@@ -54,7 +40,7 @@
// We own one color value for each MSAA sample.
fColorValuesPerPixel = SkTMax(1, fDesc.fSampleCnt);
- if (fTextureFBO && fTextureFBO != fRenderFBO) {
+ if (fTexFBOID != fRTFBOID) {
// If we own the resolve buffer then that is one more sample per pixel.
fColorValuesPerPixel += 1;
}
@@ -70,42 +56,27 @@
void GrGLRenderTarget::onRelease() {
if (!fIsWrapped) {
- const GrGLInterface* gl = GLGPU->glInterface();
- if (fRenderFBO) {
- fRenderFBO->release(gl);
- fRenderFBO.reset(NULL);
+ if (fTexFBOID) {
+ GL_CALL(DeleteFramebuffers(1, &fTexFBOID));
}
- if (fTextureFBO) {
- fTextureFBO->release(gl);
- fTextureFBO.reset(NULL);
+ if (fRTFBOID && fRTFBOID != fTexFBOID) {
+ GL_CALL(DeleteFramebuffers(1, &fRTFBOID));
}
if (fMSColorRenderbufferID) {
GL_CALL(DeleteRenderbuffers(1, &fMSColorRenderbufferID));
- fMSColorRenderbufferID = 0;
}
- } else {
- if (fRenderFBO) {
- fRenderFBO->abandon();
- fRenderFBO.reset(NULL);
- }
- if (fTextureFBO) {
- fTextureFBO->abandon();
- fTextureFBO.reset(NULL);
- }
- fMSColorRenderbufferID = 0;
}
+ fRTFBOID = 0;
+ fTexFBOID = 0;
+ fMSColorRenderbufferID = 0;
+ fIsWrapped = false;
INHERITED::onRelease();
}
void GrGLRenderTarget::onAbandon() {
- if (fRenderFBO) {
- fRenderFBO->abandon();
- fRenderFBO.reset(NULL);
- }
- if (fTextureFBO) {
- fTextureFBO->abandon();
- fTextureFBO.reset(NULL);
- }
+ fRTFBOID = 0;
+ fTexFBOID = 0;
fMSColorRenderbufferID = 0;
+ fIsWrapped = false;
INHERITED::onAbandon();
}
« no previous file with comments | « src/gpu/gl/GrGLRenderTarget.h ('k') | src/gpu/gl/debug/GrGLCreateDebugInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698