cleanup GrGLTexture / GrGLRenderTarget cons. Make GrRenderTarget aware of its msaa sample count.
Review URL: http://codereview.appspot.com/4833045/
git-svn-id: http://skia.googlecode.com/svn/trunk@1996 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrGLRenderTarget.h b/gpu/src/GrGLRenderTarget.h
index 48ff12d..3d64fab 100644
--- a/gpu/src/GrGLRenderTarget.h
+++ b/gpu/src/GrGLRenderTarget.h
@@ -25,23 +25,28 @@
// Gr doesn't know how to resolve it.
enum { kUnresolvableFBOID = 0 };
- struct GLRenderTargetIDs {
+ struct Desc {
GrGLuint fRTFBOID;
GrGLuint fTexFBOID;
GrGLuint fStencilRenderbufferID;
GrGLuint fMSColorRenderbufferID;
bool fOwnIDs;
- void reset() { memset(this, 0, sizeof(GLRenderTargetIDs)); }
+ GrPixelConfig fConfig;
+ int fStencilBits;
+ int fSampleCnt;
};
- GrGLRenderTarget(GrGpuGL* gpu,
- const GLRenderTargetIDs& ids,
- GrGLTexID* texID,
- GrPixelConfig config,
- GrGLuint stencilBits,
- bool isMultisampled,
- const GrGLIRect& fViewport,
- GrGLTexture* texture);
+ // creates a GrGLRenderTarget associated with a texture
+ GrGLRenderTarget(GrGpuGL* gpu,
+ const Desc& desc,
+ const GrGLIRect& viewport,
+ GrGLTexID* texID,
+ GrGLTexture* texture);
+
+ // creates an independent GrGLRenderTarget
+ GrGLRenderTarget(GrGpuGL* gpu,
+ const Desc& desc,
+ const GrGLIRect& viewport);
virtual ~GrGLRenderTarget() { this->release(); }
@@ -97,6 +102,8 @@
// non-NULL if this RT was created by Gr with an associated GrGLTexture.
GrGLTexID* fTexIDObj;
+ void init(const Desc& desc, const GrGLIRect& viewport, GrGLTexID* texID);
+
typedef GrRenderTarget INHERITED;
};