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

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

Issue 1862043002: Refactor to separate backend object lifecycle and GpuResource budget decision (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 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/GrGLRenderTarget.h
diff --git a/src/gpu/gl/GrGLRenderTarget.h b/src/gpu/gl/GrGLRenderTarget.h
index d1365efd420c10af802bd173fd534a4d443871cd..f226b1bee44f4bc4d4a4c7ca3cf8005aab9a31b5 100644
--- a/src/gpu/gl/GrGLRenderTarget.h
+++ b/src/gpu/gl/GrGLRenderTarget.h
@@ -24,9 +24,9 @@ public:
struct IDDesc {
GrGLuint fRTFBOID;
+ GrBackendObjectLifeCycle fRTFBOLifeCycle;
GrGLuint fTexFBOID;
GrGLuint fMSColorRenderbufferID;
- GrGpuResource::LifeCycle fLifeCycle;
GrRenderTarget::SampleConfig fSampleConfig;
};
@@ -61,9 +61,9 @@ public:
GrBackendObject getRenderTargetHandle() const override { return fRTFBOID; }
- /** When we don't own the FBO ID we don't attempt to modify its attachments. */
+ /** When we have not created the FBO ID we do not attempt to modify its attachments. */
bool canAttemptStencilAttachment() const override {
- return kCached_LifeCycle == fRTLifecycle || kUncached_LifeCycle == fRTLifecycle;
+ return GrBackendObjectLifeCycle::kInternal == fRTFBOLifeCycle;
}
// GrGLRenderTarget overrides dumpMemoryStatistics so it can log its texture and renderbuffer
@@ -71,11 +71,8 @@ public:
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);
+ // Constructor for subclasses.
+ GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&);
void init(const GrSurfaceDesc&, const IDDesc&);
@@ -86,8 +83,7 @@ protected:
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(...).
+ // Constructor for instances wrapping backend objects.
GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, GrGLStencilAttachment*);
GrGLGpu* getGLGpu() const;
@@ -103,9 +99,7 @@ private:
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;
+ GrBackendObjectLifeCycle fRTFBOLifeCycle;
// 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

Powered by Google App Engine
This is Rietveld 408576698