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

Side by Side Diff: src/gpu/batches/GrBatch.h

Issue 1336413006: Just an experiment (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 3 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/batches/GrAAFillRectBatch.cpp ('k') | src/gpu/batches/GrNonAAFillRectBatch.h » ('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 2015 Google Inc. 2 * Copyright 2015 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 GrBatch_DEFINED 8 #ifndef GrBatch_DEFINED
9 #define GrBatch_DEFINED 9 #define GrBatch_DEFINED
10 10
11 #include <new> 11 #include <new>
12 #include "GrNonAtomicRef.h" 12 #include "GrNonAtomicRef.h"
13 13
14 #include "SkRect.h" 14 #include "SkRect.h"
15 #include "SkString.h" 15 #include "SkString.h"
16 16
17 #include "draws/GrDraw.h"
18
17 class GrCaps; 19 class GrCaps;
18 class GrBatchFlushState; 20 class GrBatchFlushState;
19 21
20 /** 22 /**
21 * GrBatch is the base class for all Ganesh deferred geometry generators. To fa cilitate 23 * GrBatch is the base class for all Ganesh deferred geometry generators. To fa cilitate
22 * reorderable batching, Ganesh does not generate geometry inline with draw call s. Instead, it 24 * reorderable batching, Ganesh does not generate geometry inline with draw call s. Instead, it
23 * captures the arguments to the draw and then generates the geometry on demand. This gives GrBatch 25 * captures the arguments to the draw and then generates the geometry on demand. This gives GrBatch
24 * subclasses complete freedom to decide how / what they can batch. 26 * subclasses complete freedom to decide how / what they can batch.
25 * 27 *
26 * Batches are created when GrContext processes a draw call. Batches of the same subclass may be 28 * Batches are created when GrContext processes a draw call. Batches of the same subclass may be
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 /** Issues the batches commands to GrGpu. */ 104 /** Issues the batches commands to GrGpu. */
103 void draw(GrBatchFlushState* state) { this->onDraw(state); } 105 void draw(GrBatchFlushState* state) { this->onDraw(state); }
104 106
105 /** Used to block batching across render target changes. Remove this once we store 107 /** Used to block batching across render target changes. Remove this once we store
106 GrBatches for different RTs in different targets. */ 108 GrBatches for different RTs in different targets. */
107 virtual uint32_t renderTargetUniqueID() const = 0; 109 virtual uint32_t renderTargetUniqueID() const = 0;
108 110
109 /** Used for spewing information about batches when debugging. */ 111 /** Used for spewing information about batches when debugging. */
110 virtual SkString dumpInfo() const = 0; 112 virtual SkString dumpInfo() const = 0;
111 113
114 // TODO put on stack
115 void setDrawSnap(const GrDrawSnap* snap) const { fSnap.reset(snap); }
116 const GrDrawSnap* drawSnap() const { return fSnap.get(); }
117
112 protected: 118 protected:
113 // NOTE, compute some bounds, even if extremely conservative. Do *NOT* setL argest on the bounds 119 // NOTE, compute some bounds, even if extremely conservative. Do *NOT* setL argest on the bounds
114 // rect because we outset it for dst copy textures 120 // rect because we outset it for dst copy textures
115 void setBounds(const SkRect& newBounds) { fBounds = newBounds; } 121 void setBounds(const SkRect& newBounds) { fBounds = newBounds; }
116 122
117 void joinBounds(const SkRect& otherBounds) { 123 void joinBounds(const SkRect& otherBounds) {
118 return fBounds.joinPossiblyEmptyRect(otherBounds); 124 return fBounds.joinPossiblyEmptyRect(otherBounds);
119 } 125 }
120 126
121 static uint32_t GenBatchClassID() { return GenID(&gCurrBatchClassID); } 127 static uint32_t GenBatchClassID() { return GenID(&gCurrBatchClassID); }
(...skipping 21 matching lines...) Expand all
143 kIllegalBatchID = 0, 149 kIllegalBatchID = 0,
144 }; 150 };
145 151
146 SkDEBUGCODE(bool fUsed;) 152 SkDEBUGCODE(bool fUsed;)
147 const uint32_t fClassID; 153 const uint32_t fClassID;
148 #if GR_BATCH_SPEW 154 #if GR_BATCH_SPEW
149 static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); } 155 static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); }
150 const uint32_t fUniqueID; 156 const uint32_t fUniqueID;
151 static int32_t gCurrBatchUniqueID; 157 static int32_t gCurrBatchUniqueID;
152 #endif 158 #endif
159
160
161 // TODO put this on the stack, also does it belong here
162 mutable SkAutoTUnref<const GrDrawSnap> fSnap;
163
153 static int32_t gCurrBatchClassID; 164 static int32_t gCurrBatchClassID;
154 typedef GrNonAtomicRef INHERITED; 165 typedef GrNonAtomicRef INHERITED;
155 }; 166 };
156 167
157 #endif 168 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAAFillRectBatch.cpp ('k') | src/gpu/batches/GrNonAAFillRectBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698