| Index: src/gpu/gl/GrGLRenderTarget.h
|
| diff --git a/src/gpu/gl/GrGLRenderTarget.h b/src/gpu/gl/GrGLRenderTarget.h
|
| index d1365efd420c10af802bd173fd534a4d443871cd..4d4d404c28c75a22213d320ca1121291101100fd 100644
|
| --- a/src/gpu/gl/GrGLRenderTarget.h
|
| +++ b/src/gpu/gl/GrGLRenderTarget.h
|
| @@ -23,14 +23,21 @@ public:
|
| enum { kUnresolvableFBOID = 0 };
|
|
|
| struct IDDesc {
|
| + IDDesc() : fRTFBOID(0), fRTFBOLifeCycle(GrBackendObjectLifeCycle::kInternal),
|
| + fTexID(0), fTexLifeCycle(GrBackendObjectLifeCycle::kInternal),
|
| + fTexFBOID(kUnresolvableFBOID), fMSColorRenderbufferID(0),
|
| + fSampleConfig(GrRenderTarget::kUnified_SampleConfig) {}
|
| GrGLuint fRTFBOID;
|
| + GrBackendObjectLifeCycle fRTFBOLifeCycle;
|
| + GrGLuint fTexID; // ID of an adopted texture as rt.
|
| + GrBackendObjectLifeCycle fTexLifeCycle;
|
| GrGLuint fTexFBOID;
|
| GrGLuint fMSColorRenderbufferID;
|
| - GrGpuResource::LifeCycle fLifeCycle;
|
| GrRenderTarget::SampleConfig fSampleConfig;
|
| };
|
|
|
| static GrGLRenderTarget* CreateWrapped(GrGLGpu*,
|
| + SkBudgeted,
|
| const GrSurfaceDesc&,
|
| const IDDesc&,
|
| int stencilBits);
|
| @@ -42,71 +49,64 @@ public:
|
| // texture/render target is multisampled, and different IDs when
|
| // it is.
|
| // FBO ID used to render into
|
| - GrGLuint renderFBOID() const { return fRTFBOID; }
|
| + GrGLuint renderFBOID() const { return fIDDesc.fRTFBOID; }
|
| // FBO ID that has texture ID attached.
|
| - GrGLuint textureFBOID() const { return fTexFBOID; }
|
| + GrGLuint textureFBOID() const { return fIDDesc.fTexFBOID; }
|
|
|
| // override of GrRenderTarget
|
| ResolveType getResolveType() const override {
|
| if (!this->isUnifiedMultisampled() ||
|
| - fRTFBOID == fTexFBOID) {
|
| + fIDDesc.fRTFBOID == fIDDesc.fTexFBOID) {
|
| // catches FBO 0 and non MSAA case
|
| return kAutoResolves_ResolveType;
|
| - } else if (kUnresolvableFBOID == fTexFBOID) {
|
| + } else if (kUnresolvableFBOID == fIDDesc.fTexFBOID) {
|
| return kCantResolve_ResolveType;
|
| } else {
|
| return kCanResolve_ResolveType;
|
| }
|
| }
|
|
|
| - GrBackendObject getRenderTargetHandle() const override { return fRTFBOID; }
|
| + GrBackendObject getRenderTargetHandle() const override { return fIDDesc.fRTFBOID; }
|
|
|
| /** When we don't own the FBO ID we don't attempt to modify its attachments. */
|
| bool canAttemptStencilAttachment() const override {
|
| - return kCached_LifeCycle == fRTLifecycle || kUncached_LifeCycle == fRTLifecycle;
|
| + return GrBackendObjectLifeCycle::kInternal == fIDDesc.fRTFBOLifeCycle;
|
| }
|
|
|
| // GrGLRenderTarget overrides dumpMemoryStatistics so it can log its texture and renderbuffer
|
| // components seperately.
|
| void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override;
|
| -
|
| protected:
|
| // The public constructor registers this object with the cache. However, only the most derived
|
| // class should register with the cache. This constructor does not do the registration and
|
| // rather moves that burden onto the derived class.
|
| enum Derived { kDerived };
|
| - GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, Derived);
|
| + GrGLRenderTarget(GrGLGpu*, SkBudgeted, const GrSurfaceDesc&, const IDDesc&, Derived);
|
|
|
| - void init(const GrSurfaceDesc&, const IDDesc&);
|
| + void init(const GrSurfaceDesc&);
|
|
|
| void onAbandon() override;
|
| void onRelease() override;
|
|
|
| + bool refsWrappedResources() const override;
|
| +
|
| // In protected because subclass GrGLTextureRenderTarget calls this version.
|
| size_t onGpuMemorySize() const override;
|
|
|
| private:
|
| // This ctor is used only for creating wrapped render targets and is only called for the static
|
| // create function CreateWrapped(...).
|
| - GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, GrGLStencilAttachment*);
|
| + GrGLRenderTarget(GrGLGpu*, SkBudgeted, const GrSurfaceDesc&, const IDDesc&, GrGLStencilAttachment*);
|
|
|
| GrGLGpu* getGLGpu() const;
|
| bool completeStencilAttachment() override;
|
|
|
| // The total size of the resource (including all pixels) for a single sample.
|
| size_t totalBytesPerSample() const;
|
| - int msaaSamples() const;
|
| // The number total number of samples, including both MSAA and resolve texture samples.
|
| int totalSamples() const;
|
|
|
| - GrGLuint fRTFBOID;
|
| - 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.
|
| - LifeCycle fRTLifecycle;
|
| -
|
| + IDDesc fIDDesc;
|
| // 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)
|
|
|