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

Unified Diff: src/gpu/gl/GrGLGpu.h

Issue 949263002: Improve tracking of bound FBOs in GrGLGpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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
Index: src/gpu/gl/GrGLGpu.h
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index b93080b70037d2b5a624b0b9996dc7b798adad12..62c21f8c080d4bebdd5f3f17128d52ba15311920 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -246,9 +246,26 @@ private:
// ensures that such operations don't negatively interact with tracking bound textures.
void setScratchTextureUnit();
- // bounds is region that may be modified and therefore has to be resolved.
- // NULL means whole target. Can be an empty rect.
- void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds);
+ // Enumerates the reasons for binding an FBO.
+ enum FBOBinding {
+ kDraw_FBOBinding,
+ kClear_FBOBinding,
+ kDiscard_FBOBinding,
+ kChangeAttachments_FBOBinding,
+ kReadPixels_FBOBinding,
+ kBlitSrc_FBOBinding,
+ kBlitDst_FBOBinding,
+ };
+
+ // binds the FBO and returns the GL enum of the framebuffer target it was bound to.
+ GrGLenum bindFBO(FBOBinding, const GrGLFBO*);
+
+ // Tracks dirty area for resolve, and tracks whether mip maps need rebuilding. bounds is the
+ // region that may be modified. NULL means whole surface. Can be an empty rect.
+ void markSurfaceContentsDirty(GrSurface*, const SkIRect* bounds);
+
+ void setViewport(const GrGLIRect& viewport);
+
egdaniel 2015/03/17 17:44:58 extra \n
void flushStencil(const GrStencilSettings&);
void flushHWAAState(GrRenderTarget* rt, bool useHWAA, bool isLineDraw);
@@ -281,15 +298,14 @@ private:
bool createRenderTargetObjects(const GrSurfaceDesc&, bool budgeted, GrGLuint texID,
GrGLRenderTarget::IDDesc*);
- enum TempFBOTarget {
- kSrc_TempFBOTarget,
- kDst_TempFBOTarget
- };
+ static const FBOBinding kInvalidFBOBinding = static_cast<FBOBinding>(-1);
- GrGLuint bindSurfaceAsFBO(GrSurface* surface, GrGLenum fboTarget, GrGLIRect* viewport,
- TempFBOTarget tempFBOTarget);
+ // Binds a surface as an FBO. A temporary FBO ID may be used if the surface is not already
+ // a render target. Afterwards unbindSurfaceAsFBOForCopy must be called with the value returned.
+ FBOBinding bindSurfaceAsFBOForCopy(GrSurface*, FBOBinding, GrGLIRect* viewport);
- void unbindTextureFromFBO(GrGLenum fboTarget);
+ // Must be matched with bindSurfaceAsFBOForCopy.
+ void unbindSurfaceAsFBOForCopy(FBOBinding);
GrGLContext fGLContext;
@@ -309,10 +325,9 @@ private:
kUnknown_TriState
};
- GrGLuint fTempSrcFBOID;
- GrGLuint fTempDstFBOID;
-
- GrGLuint fStencilClearFBOID;
+ SkAutoTUnref<GrGLFBO> fTempSrcFBO;
+ SkAutoTUnref<GrGLFBO> fTempDstFBO;
+ SkAutoTUnref<GrGLFBO> fStencilClearFBO;
// last scissor / viewport scissor state seen by the GL.
struct {
@@ -458,9 +473,14 @@ private:
GrPipelineBuilder::DrawFace fHWDrawFace;
TriState fHWWriteToColor;
TriState fHWDitherEnabled;
- uint32_t fHWBoundRenderTargetUniqueID;
SkTArray<uint32_t, true> fHWBoundTextureUniqueIDs;
+ // Track fbo binding state for GL_DRAW_FRAMEBUFFER and GL_READ_FRAMEBUFFER
+ struct HWFBOBinding {
+ SkAutoTUnref<const GrGLFBO> fFBO;
+ void invalidate() { fFBO.reset(NULL); }
+ } fHWFBOBinding[2];
+
///@}
// we record what stencil format worked last time to hopefully exit early
« no previous file with comments | « src/gpu/gl/GrGLCaps.cpp ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | src/gpu/gl/GrGLGpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698