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

Side by Side Diff: src/gpu/GrDrawTarget.h

Issue 1278643006: Make GrBatch carry its own GrPipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 5 years, 4 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/GrCommandBuilder.h ('k') | src/gpu/GrDrawTarget.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 2010 Google Inc. 2 * Copyright 2010 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 GrDrawTarget_DEFINED 8 #ifndef GrDrawTarget_DEFINED
9 #define GrDrawTarget_DEFINED 9 #define GrDrawTarget_DEFINED
10 10
11 #include "GrClip.h" 11 #include "GrClip.h"
12 #include "GrClipMaskManager.h" 12 #include "GrClipMaskManager.h"
13 #include "GrContext.h" 13 #include "GrContext.h"
14 #include "GrPathProcessor.h" 14 #include "GrPathProcessor.h"
15 #include "GrPrimitiveProcessor.h" 15 #include "GrPrimitiveProcessor.h"
16 #include "GrIndexBuffer.h" 16 #include "GrIndexBuffer.h"
17 #include "GrPathRendering.h" 17 #include "GrPathRendering.h"
18 #include "GrPipelineBuilder.h" 18 #include "GrPipelineBuilder.h"
19 #include "GrPipeline.h"
19 #include "GrTraceMarker.h" 20 #include "GrTraceMarker.h"
20 #include "GrVertexBuffer.h" 21 #include "GrVertexBuffer.h"
21 #include "GrXferProcessor.h" 22 #include "GrXferProcessor.h"
22 23
23 #include "SkClipStack.h" 24 #include "SkClipStack.h"
24 #include "SkMatrix.h" 25 #include "SkMatrix.h"
25 #include "SkPath.h" 26 #include "SkPath.h"
26 #include "SkStrokeRec.h" 27 #include "SkStrokeRec.h"
27 #include "SkTArray.h" 28 #include "SkTArray.h"
28 #include "SkTLazy.h" 29 #include "SkTLazy.h"
29 #include "SkTypes.h" 30 #include "SkTypes.h"
30 #include "SkXfermode.h" 31 #include "SkXfermode.h"
31 32
32 class GrClip; 33 class GrClip;
33 class GrCaps; 34 class GrCaps;
34 class GrPath; 35 class GrPath;
35 class GrPathRange; 36 class GrPathRange;
36 class GrPipeline;
37 37
38 class GrDrawTarget : public SkRefCnt { 38 class GrDrawTarget : public SkRefCnt {
39 public: 39 public:
40 40
41 41
42 typedef GrPathRange::PathIndexType PathIndexType; 42 typedef GrPathRange::PathIndexType PathIndexType;
43 typedef GrPathRendering::PathTransformType PathTransformType; 43 typedef GrPathRendering::PathTransformType PathTransformType;
44 44
45 /////////////////////////////////////////////////////////////////////////// 45 ///////////////////////////////////////////////////////////////////////////
46 46
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 const SkIRect& srcRect, 193 const SkIRect& srcRect,
194 const SkIPoint& dstPoint); 194 const SkIPoint& dstPoint);
195 /** 195 /**
196 * Release any resources that are cached but not currently in use. This 196 * Release any resources that are cached but not currently in use. This
197 * is intended to give an application some recourse when resources are low. 197 * is intended to give an application some recourse when resources are low.
198 */ 198 */
199 virtual void purgeResources() {}; 199 virtual void purgeResources() {};
200 200
201 bool programUnitTest(GrContext* owner, int maxStages); 201 bool programUnitTest(GrContext* owner, int maxStages);
202 202
203 struct PipelineInfo {
204 PipelineInfo(const GrPipelineBuilder* pipelineBuilder, const GrScissorSt ate* scissor,
205 const GrPrimitiveProcessor* primProc,
206 const SkRect* devBounds, GrDrawTarget* target);
207
208 PipelineInfo(const GrPipelineBuilder* pipelineBuilder, const GrScissorSt ate* scissor,
209 const GrBatch* batch, const SkRect* devBounds,
210 GrDrawTarget* target);
211
212 bool valid() const { return SkToBool(fArgs.fPipelineBuilder); }
213
214 const GrPipeline::CreateArgs& pipelineCreateArgs() const {
215 SkASSERT(this->valid());
216 return fArgs;
217 }
218
219 bool willColorBlendWithDst(const GrPrimitiveProcessor* primProc) const {
220 SkASSERT(this->valid());
221 return fArgs.fPipelineBuilder->willColorBlendWithDst(primProc);
222 }
223 private:
224 GrPipeline::CreateArgs fArgs;
225 };
226
203 protected: 227 protected:
204 friend class GrCommandBuilder; // for PipelineInfo
205 friend class GrInOrderCommandBuilder; // for PipelineInfo
206 friend class GrReorderCommandBuilder; // for PipelineInfo
207 friend class GrTargetCommands; // for PipelineInfo
208 228
209 GrGpu* getGpu() { return fGpu; } 229 GrGpu* getGpu() { return fGpu; }
210 const GrGpu* getGpu() const { return fGpu; } 230 const GrGpu* getGpu() const { return fGpu; }
211 231
212 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers ; } 232 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers ; }
213 233
214 // Makes a copy of the dst if it is necessary for the draw. Returns false if a copy is required 234 // Makes a copy of the dst if it is necessary for the draw. Returns false if a copy is required
215 // but couldn't be made. Otherwise, returns true. This method needs to be p rotected because it 235 // but couldn't be made. Otherwise, returns true. This method needs to be p rotected because it
216 // needs to be accessed by GLPrograms to setup a correct drawstate 236 // needs to be accessed by GLPrograms to setup a correct drawstate
217 bool setupDstReadIfNecessary(const GrPipelineBuilder&, 237 bool setupDstReadIfNecessary(const GrPipelineBuilder&,
218 const GrProcOptInfo& colorPOI, 238 const GrProcOptInfo& colorPOI,
219 const GrProcOptInfo& coveragePOI, 239 const GrProcOptInfo& coveragePOI,
220 GrXferProcessor::DstTexture*, 240 GrXferProcessor::DstTexture*,
221 const SkRect* drawBounds); 241 const SkRect* drawBounds);
222 242
223 struct PipelineInfo {
224 PipelineInfo(const GrPipelineBuilder& pipelineBuilder, GrScissorState* s cissor,
225 const GrPrimitiveProcessor* primProc,
226 const SkRect* devBounds, GrDrawTarget* target);
227
228 PipelineInfo(const GrPipelineBuilder& pipelineBuilder, GrScissorState* s cissor,
229 const GrBatch* batch, const SkRect* devBounds,
230 GrDrawTarget* target);
231
232 bool willColorBlendWithDst(const GrPrimitiveProcessor* primProc) const {
233 return fPipelineBuilder->willColorBlendWithDst(primProc);
234 }
235 private:
236 friend class GrDrawTarget;
237
238 bool mustSkipDraw() const { return (NULL == fPipelineBuilder); }
239
240 const GrPipelineBuilder* fPipelineBuilder;
241 GrScissorState* fScissor;
242 GrProcOptInfo fColorPOI;
243 GrProcOptInfo fCoveragePOI;
244 GrXferProcessor::DstTexture fDstTexture;
245 };
246
247 const GrPipeline* setupPipeline(const PipelineInfo&, void* pipelineAddr,
248 GrPipelineOptimizations*);
249
250 private: 243 private:
251 virtual void onReset() = 0; 244 virtual void onReset() = 0;
252 245
253 virtual void onFlush() = 0; 246 virtual void onFlush() = 0;
254 247
255 virtual void onDrawBatch(GrBatch*, const PipelineInfo&) = 0; 248 virtual void onDrawBatch(GrBatch*) = 0;
256 virtual void onStencilPath(const GrPipelineBuilder&, 249 virtual void onStencilPath(const GrPipelineBuilder&,
257 const GrPathProcessor*, 250 const GrPathProcessor*,
258 const GrPath*, 251 const GrPath*,
259 const GrScissorState&, 252 const GrScissorState&,
260 const GrStencilSettings&) = 0; 253 const GrStencilSettings&) = 0;
261 virtual void onDrawPath(const GrPathProcessor*, 254 virtual void onDrawPath(const GrPathProcessor*,
262 const GrPath*, 255 const GrPath*,
263 const GrStencilSettings&, 256 const GrStencilSettings&,
264 const PipelineInfo&) = 0; 257 const PipelineInfo&) = 0;
265 virtual void onDrawPaths(const GrPathProcessor*, 258 virtual void onDrawPaths(const GrPathProcessor*,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 bool setupClip(const GrPipelineBuilder&, 335 bool setupClip(const GrPipelineBuilder&,
343 GrPipelineBuilder::AutoRestoreFragmentProcessorState*, 336 GrPipelineBuilder::AutoRestoreFragmentProcessorState*,
344 GrPipelineBuilder::AutoRestoreStencil*, 337 GrPipelineBuilder::AutoRestoreStencil*,
345 GrScissorState* scissorState, 338 GrScissorState* scissorState,
346 const SkRect* devBounds) override; 339 const SkRect* devBounds) override;
347 340
348 typedef GrDrawTarget INHERITED; 341 typedef GrDrawTarget INHERITED;
349 }; 342 };
350 343
351 #endif 344 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrCommandBuilder.h ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698