Index: src/gpu/gl/GrGLGpu.h |
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h |
index b93080b70037d2b5a624b0b9996dc7b798adad12..74e955eed6ff07210e040390b10a1c12767f28d5 100644 |
--- a/src/gpu/gl/GrGLGpu.h |
+++ b/src/gpu/gl/GrGLGpu.h |
@@ -50,6 +50,15 @@ public: |
return static_cast<GrGLPathRendering*>(pathRendering()); |
} |
+ // On older GLs there may not be separate FBO bindings for draw and read. In that case these |
+ // alias each other. |
+ enum FBOBinding { |
+ kDraw_FBOBinding, // drawing or dst of blit |
+ kRead_FBOBinding, // src of blit, read pixels. |
+ }; |
+ |
+ void willDeleteOrAbandonFramebuffer(GrGLFBO* fbo); |
+ |
void discard(GrRenderTarget*) SK_OVERRIDE; |
// Used by GrGLProgram and GrGLPathTexGenProgramEffects to configure OpenGL |
@@ -246,9 +255,18 @@ 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); |
+ // Binds the render target, sets the viewport, tracks dirty are for resolve, and tracks whether |
+ // mip maps need rebuilding. |
+ // bounds is region that may be modified by the draw. NULL means whole target. Can be an empty |
+ // rect. |
+ void prepareToDrawToRenderTarget(GrGLRenderTarget*, const SkIRect* bounds); |
+ |
+ static const FBOBinding kInvalidFBOBinding = static_cast<FBOBinding>(-1); |
+ |
+ // binds the FBO and returns the GL enum of the framebuffer target it was bound to. |
+ GrGLenum bindFBO(FBOBinding, const GrGLFBO*); |
+ |
+ void setViewport(const GrGLIRect& viewport); |
void flushStencil(const GrStencilSettings&); |
void flushHWAAState(GrRenderTarget* rt, bool useHWAA, bool isLineDraw); |
@@ -281,15 +299,12 @@ private: |
bool createRenderTargetObjects(const GrSurfaceDesc&, bool budgeted, GrGLuint texID, |
GrGLRenderTarget::IDDesc*); |
- enum TempFBOTarget { |
- kSrc_TempFBOTarget, |
- kDst_TempFBOTarget |
- }; |
- |
- 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 unbindSurfaceforCopy 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 +324,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 +472,18 @@ private: |
GrPipelineBuilder::DrawFace fHWDrawFace; |
TriState fHWWriteToColor; |
TriState fHWDitherEnabled; |
- uint32_t fHWBoundRenderTargetUniqueID; |
SkTArray<uint32_t, true> fHWBoundTextureUniqueIDs; |
+ // Track read/draw fbo binding state. |
+ struct HWFBOBinding { |
+ uint32_t fGenID; |
+ bool fIsDefaultFBO; |
+ void invalidate() { |
+ fGenID = SK_InvalidGenID; |
+ fIsDefaultFBO = false; |
+ } |
+ } fHWFBOBinding[2]; |
egdaniel
2015/02/24 18:47:01
Do we want to distinguish these as 0 is draw and 1
bsalomon
2015/02/24 21:00:52
I added a cnt value and used it here. In the impl
|
+ |
///@} |
// we record what stencil format worked last time to hopefully exit early |