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

Side by Side Diff: src/gpu/gl/GrGLRenderTarget.h

Issue 1187523005: Add support for creating texture backed images where Skia will delete the texture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add default param to support Chrome's current callers Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLPathRange.cpp ('k') | src/gpu/gl/GrGLRenderTarget.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #ifndef GrGLRenderTarget_DEFINED 9 #ifndef GrGLRenderTarget_DEFINED
10 #define GrGLRenderTarget_DEFINED 10 #define GrGLRenderTarget_DEFINED
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // catches FBO 0 and non MSAA case 49 // catches FBO 0 and non MSAA case
50 return kAutoResolves_ResolveType; 50 return kAutoResolves_ResolveType;
51 } else if (kUnresolvableFBOID == fTexFBOID) { 51 } else if (kUnresolvableFBOID == fTexFBOID) {
52 return kCantResolve_ResolveType; 52 return kCantResolve_ResolveType;
53 } else { 53 } else {
54 return kCanResolve_ResolveType; 54 return kCanResolve_ResolveType;
55 } 55 }
56 } 56 }
57 57
58 /** When we don't own the FBO ID we don't attempt to modify its attachments. */ 58 /** When we don't own the FBO ID we don't attempt to modify its attachments. */
59 bool canAttemptStencilAttachment() const override { return !fIsWrapped; } 59 bool canAttemptStencilAttachment() const override {
60 return kCached_LifeCycle == fRTLifecycle || kUncached_LifeCycle == fRTLi fecycle;
61 }
60 62
61 protected: 63 protected:
62 // The public constructor registers this object with the cache. However, onl y the most derived 64 // The public constructor registers this object with the cache. However, onl y the most derived
63 // class should register with the cache. This constructor does not do the re gistration and 65 // class should register with the cache. This constructor does not do the re gistration and
64 // rather moves that burden onto the derived class. 66 // rather moves that burden onto the derived class.
65 enum Derived { kDerived }; 67 enum Derived { kDerived };
66 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, Derived); 68 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, Derived);
67 69
68 void init(const GrSurfaceDesc&, const IDDesc&); 70 void init(const GrSurfaceDesc&, const IDDesc&);
69 71
70 void onAbandon() override; 72 void onAbandon() override;
71 void onRelease() override; 73 void onRelease() override;
72 74
73 // In protected because subclass GrGLTextureRenderTarget calls this version. 75 // In protected because subclass GrGLTextureRenderTarget calls this version.
74 size_t onGpuMemorySize() const override; 76 size_t onGpuMemorySize() const override;
75 77
76 private: 78 private:
77 GrGLuint fRTFBOID; 79 GrGLuint fRTFBOID;
78 GrGLuint fTexFBOID; 80 GrGLuint fTexFBOID;
79 GrGLuint fMSColorRenderbufferID; 81 GrGLuint fMSColorRenderbufferID;
80 82
81 // We track this separately from GrGpuResource because this may be both a te xture and a render 83 // We track this separately from GrGpuResource because this may be both a te xture and a render
82 // target, and the texture may be wrapped while the render target is not. 84 // target, and the texture may be wrapped while the render target is not.
83 bool fIsWrapped; 85 LifeCycle fRTLifecycle;
84 86
85 // when we switch to this render target we want to set the viewport to 87 // when we switch to this render target we want to set the viewport to
86 // only render to content area (as opposed to the whole allocation) and 88 // only render to content area (as opposed to the whole allocation) and
87 // we want the rendering to be at top left (GL has origin in bottom left) 89 // we want the rendering to be at top left (GL has origin in bottom left)
88 GrGLIRect fViewport; 90 GrGLIRect fViewport;
89 91
90 // onGpuMemorySize() needs to know the VRAM footprint of the FBO(s). However , abandon and 92 // onGpuMemorySize() needs to know the VRAM footprint of the FBO(s). However , abandon and
91 // release zero out the IDs and the cache needs to know the size even after those actions. 93 // release zero out the IDs and the cache needs to know the size even after those actions.
92 size_t fGpuMemorySize; 94 size_t fGpuMemorySize;
93 95
94 typedef GrRenderTarget INHERITED; 96 typedef GrRenderTarget INHERITED;
95 }; 97 };
96 98
97 #endif 99 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLPathRange.cpp ('k') | src/gpu/gl/GrGLRenderTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698