| 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 "../private/SkAtomics.h" | 11 #include "../private/SkAtomics.h" |
| 12 #include "GrNonAtomicRef.h" | 12 #include "GrNonAtomicRef.h" |
| 13 #include "SkMatrix.h" | 13 #include "SkMatrix.h" |
| 14 #include "SkRect.h" | 14 #include "SkRect.h" |
| 15 #include "SkString.h" | 15 #include "SkString.h" |
| 16 | 16 |
| 17 #include <new> | 17 #include <new> |
| 18 | 18 |
| 19 class GrCaps; | 19 class GrCaps; |
| 20 class GrGpuCommandBuffer; | 20 class GrGpuCommandBuffer; |
| 21 class GrBatchFlushState; | 21 class GrBatchFlushState; |
| 22 class GrRenderTarget; | 22 class GrRenderTarget; |
| 23 class GrRenderTargetProxy; |
| 23 | 24 |
| 24 /** | 25 /** |
| 25 * GrBatch is the base class for all Ganesh deferred geometry generators. To fa
cilitate | 26 * 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 | 27 * 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 | 28 * 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. | 29 * subclasses complete freedom to decide how / what they can batch. |
| 29 * | 30 * |
| 30 * Batches are created when GrContext processes a draw call. Batches of the same
subclass may be | 31 * 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 | 32 * 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 | 33 * and the other is left empty. The merged batch becomes responsible for drawing
the data from both |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 134 |
| 134 /** Used for spewing information about batches when debugging. */ | 135 /** Used for spewing information about batches when debugging. */ |
| 135 virtual SkString dumpInfo() const { | 136 virtual SkString dumpInfo() const { |
| 136 SkString string; | 137 SkString string; |
| 137 string.appendf("BatchBounds: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n", | 138 string.appendf("BatchBounds: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n", |
| 138 fBounds.fLeft, fBounds.fTop, fBounds.fRight, fBounds.fBot
tom); | 139 fBounds.fLeft, fBounds.fTop, fBounds.fRight, fBounds.fBot
tom); |
| 139 return string; | 140 return string; |
| 140 } | 141 } |
| 141 | 142 |
| 142 /** Can remove this when multi-draw-buffer lands */ | 143 /** Can remove this when multi-draw-buffer lands */ |
| 143 virtual GrRenderTarget* renderTarget() const = 0; | 144 virtual GrRenderTargetProxy* rtp() const = 0; |
| 144 | 145 |
| 145 protected: | 146 protected: |
| 146 /** | 147 /** |
| 147 * Indicates that the batch will produce geometry that extends beyond its bo
unds for the | 148 * Indicates that the batch will produce geometry that extends beyond its bo
unds for the |
| 148 * purpose of ensuring that the fragment shader runs on partially covered pi
xels for | 149 * purpose of ensuring that the fragment shader runs on partially covered pi
xels for |
| 149 * non-MSAA antialiasing. | 150 * non-MSAA antialiasing. |
| 150 */ | 151 */ |
| 151 enum class HasAABloat { | 152 enum class HasAABloat { |
| 152 kYes, | 153 kYes, |
| 153 kNo | 154 kNo |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 227 |
| 227 static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); } | 228 static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); } |
| 228 mutable uint32_t fUniqueID; | 229 mutable uint32_t fUniqueID; |
| 229 SkRect fBounds; | 230 SkRect fBounds; |
| 230 | 231 |
| 231 static int32_t gCurrBatchUniqueID; | 232 static int32_t gCurrBatchUniqueID; |
| 232 static int32_t gCurrBatchClassID; | 233 static int32_t gCurrBatchClassID; |
| 233 }; | 234 }; |
| 234 | 235 |
| 235 #endif | 236 #endif |
| OLD | NEW |