| OLD | NEW |
| 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 "GrBatchTarget.h" | 12 #include "GrBatchTarget.h" |
| 13 #include "GrGeometryProcessor.h" | 13 #include "GrGeometryProcessor.h" |
| 14 #include "GrVertices.h" | 14 #include "GrVertices.h" |
| 15 #include "SkAtomics.h" |
| 15 #include "SkRefCnt.h" | 16 #include "SkRefCnt.h" |
| 16 #include "SkThread.h" | |
| 17 #include "SkTypes.h" | 17 #include "SkTypes.h" |
| 18 | 18 |
| 19 class GrGpu; | 19 class GrGpu; |
| 20 class GrPipeline; | 20 class GrPipeline; |
| 21 | 21 |
| 22 struct GrInitInvariantOutput; | 22 struct GrInitInvariantOutput; |
| 23 | 23 |
| 24 /* | 24 /* |
| 25 * GrBatch is the base class for all Ganesh deferred geometry generators. To fa
cilitate | 25 * GrBatch is the base class for all Ganesh deferred geometry generators. To fa
cilitate |
| 26 * reorderable batching, Ganesh does not generate geometry inline with draw call
s. Instead, it | 26 * reorderable batching, Ganesh does not generate geometry inline with draw call
s. Instead, it |
| 27 * captures the arguments to the draw and then generates the geometry on demand.
This gives GrBatch | 27 * captures the arguments to the draw and then generates the geometry on demand.
This gives GrBatch |
| 28 * subclasses complete freedom to decide how / what they can batch. | 28 * subclasses complete freedom to decide how / what they can batch. |
| 29 * | 29 * |
| 30 * Batches are created when GrContext processes a draw call. Batches of the same
subclass may be | 30 * Batches are created when GrContext processes a draw call. Batches of the same
subclass may be |
| 31 * merged using combineIfPossible. When two batches merge, one takes on the unio
n of the data | 31 * merged using combineIfPossible. When two batches merge, one takes on the unio
n of the data |
| 32 * and the other is left empty. The merged batch becomes responsible for drawing
the data from both | 32 * and the other is left empty. The merged batch becomes responsible for drawing
the data from both |
| 33 * the original batches. | 33 * the original batches. |
| 34 * | 34 * |
| 35 * If there are any possible optimizations which might require knowing more abou
t the full state of | 35 * If there are any possible optimizations which might require knowing more abou
t the full state of |
| 36 * the draw, ie whether or not the GrBatch is allowed to tweak alpha for coverag
e, then this | 36 * the draw, ie whether or not the GrBatch is allowed to tweak alpha for coverag
e, then this |
| 37 * information will be communicated to the GrBatch prior to geometry generation. | 37 * information will be communicated to the GrBatch prior to geometry generation. |
| 38 */ | 38 */ |
| 39 | 39 |
| 40 class GrBatch : public SkRefCnt { | 40 class GrBatch : public SkRefCnt { |
| 41 public: | 41 public: |
| 42 | 42 |
| 43 GrBatch() : fClassID(kIllegalBatchClassID), fNumberOfDraws(0) { SkDEBUGCODE(
fUsed = false;) } | 43 GrBatch() : fClassID(kIllegalBatchClassID), fNumberOfDraws(0) { SkDEBUGCODE(
fUsed = false;) } |
| 44 virtual ~GrBatch() {} | 44 virtual ~GrBatch() {} |
| 45 | 45 |
| 46 virtual const char* name() const = 0; | 46 virtual const char* name() const = 0; |
| 47 virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0; | 47 virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0; |
| 48 virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const =
0; | 48 virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const =
0; |
| 49 | 49 |
| 50 /* | 50 /* |
| 51 * initBatchTracker is a hook for the some additional overrides / optimizati
on possibilities | 51 * initBatchTracker is a hook for the some additional overrides / optimizati
on possibilities |
| 52 * from the GrXferProcessor. | 52 * from the GrXferProcessor. |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 static int32_t gCurrBatchClassID; | 169 static int32_t gCurrBatchClassID; |
| 170 | 170 |
| 171 SkDEBUGCODE(bool fUsed;) | 171 SkDEBUGCODE(bool fUsed;) |
| 172 | 172 |
| 173 int fNumberOfDraws; | 173 int fNumberOfDraws; |
| 174 | 174 |
| 175 typedef SkRefCnt INHERITED; | 175 typedef SkRefCnt INHERITED; |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 #endif | 178 #endif |
| OLD | NEW |