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

Side by Side Diff: include/gpu/GrRenderTarget.h

Issue 1406173003: Loosen requirement that there be only one GrDrawTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comment Created 5 years, 2 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 | « include/gpu/GrDrawContext.h ('k') | src/gpu/GrContext.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 #ifndef GrRenderTarget_DEFINED 8 #ifndef GrRenderTarget_DEFINED
9 #define GrRenderTarget_DEFINED 9 #define GrRenderTarget_DEFINED
10 10
11 #include "GrSurface.h" 11 #include "GrSurface.h"
12 #include "SkRect.h" 12 #include "SkRect.h"
13 13
14 class GrDrawTarget;
14 class GrStencilAttachment; 15 class GrStencilAttachment;
15 class GrRenderTargetPriv; 16 class GrRenderTargetPriv;
16 17
17 /** 18 /**
18 * GrRenderTarget represents a 2D buffer of pixels that can be rendered to. 19 * GrRenderTarget represents a 2D buffer of pixels that can be rendered to.
19 * A context's render target is set by setRenderTarget(). Render targets are 20 * A context's render target is set by setRenderTarget(). Render targets are
20 * created by a createTexture with the kRenderTarget_SurfaceFlag flag. 21 * created by a createTexture with the kRenderTarget_SurfaceFlag flag.
21 * Additionally, GrContext provides methods for creating GrRenderTargets 22 * Additionally, GrContext provides methods for creating GrRenderTargets
22 * that wrap externally created render targets. 23 * that wrap externally created render targets.
23 */ 24 */
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 */ 145 */
145 virtual GrBackendObject getRenderTargetHandle() const = 0; 146 virtual GrBackendObject getRenderTargetHandle() const = 0;
146 147
147 // Checked when this object is asked to attach a stencil buffer. 148 // Checked when this object is asked to attach a stencil buffer.
148 virtual bool canAttemptStencilAttachment() const = 0; 149 virtual bool canAttemptStencilAttachment() const = 0;
149 150
150 // Provides access to functions that aren't part of the public API. 151 // Provides access to functions that aren't part of the public API.
151 GrRenderTargetPriv renderTargetPriv(); 152 GrRenderTargetPriv renderTargetPriv();
152 const GrRenderTargetPriv renderTargetPriv() const; 153 const GrRenderTargetPriv renderTargetPriv() const;
153 154
155 void setLastDrawTarget(GrDrawTarget* dt);
156 GrDrawTarget* getLastDrawTarget() { return fLastDrawTarget; }
157
154 protected: 158 protected:
155 GrRenderTarget(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc, 159 GrRenderTarget(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc,
156 SampleConfig sampleConfig, GrStencilAttachment* stencil = nul lptr) 160 SampleConfig sampleConfig, GrStencilAttachment* stencil = nul lptr)
157 : INHERITED(gpu, lifeCycle, desc) 161 : INHERITED(gpu, lifeCycle, desc)
158 , fStencilAttachment(stencil) 162 , fStencilAttachment(stencil)
159 , fSampleConfig(sampleConfig) { 163 , fSampleConfig(sampleConfig)
164 , fLastDrawTarget(nullptr) {
160 fResolveRect.setLargestInverted(); 165 fResolveRect.setLargestInverted();
161 } 166 }
162 167
163 // override of GrResource 168 // override of GrResource
164 void onAbandon() override; 169 void onAbandon() override;
165 void onRelease() override; 170 void onRelease() override;
166 171
167 private: 172 private:
168 // Allows the backends to perform any additional work that is required for a ttaching a 173 // Allows the backends to perform any additional work that is required for a ttaching a
169 // GrStencilAttachment. When this is called, the GrStencilAttachment has alr eady been put onto 174 // GrStencilAttachment. When this is called, the GrStencilAttachment has alr eady been put onto
170 // the GrRenderTarget. This function must return false if any failures occur when completing the 175 // the GrRenderTarget. This function must return false if any failures occur when completing the
171 // stencil attachment. 176 // stencil attachment.
172 virtual bool completeStencilAttachment() = 0; 177 virtual bool completeStencilAttachment() = 0;
173 178
174 friend class GrRenderTargetPriv; 179 friend class GrRenderTargetPriv;
175 180
176 GrStencilAttachment* fStencilAttachment; 181 GrStencilAttachment* fStencilAttachment;
177 SampleConfig fSampleConfig; 182 SampleConfig fSampleConfig;
178 183
179 SkIRect fResolveRect; 184 SkIRect fResolveRect;
180 185
186 // The last drawTarget that wrote to or is currently going to write to this renderTarget
187 // The drawTarget can be closed (e.g., no draw context is currently bound
188 // to this renderTarget).
189 // This back-pointer is required so that we can add a dependancy between
190 // the drawTarget used to create the current contents of this renderTarget
191 // and the drawTarget of a destination renderTarget to which this one is bei ng drawn.
192 GrDrawTarget* fLastDrawTarget;
193
181 typedef GrSurface INHERITED; 194 typedef GrSurface INHERITED;
182 }; 195 };
183 196
184 197
185 #endif 198 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrDrawContext.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698