| 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 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #define GrBATCH_INFO(...) | 41 #define GrBATCH_INFO(...) |
| 42 #endif | 42 #endif |
| 43 | 43 |
| 44 // A helper macro to generate a class static id | 44 // A helper macro to generate a class static id |
| 45 #define DEFINE_BATCH_CLASS_ID \ | 45 #define DEFINE_BATCH_CLASS_ID \ |
| 46 static uint32_t ClassID() { \ | 46 static uint32_t ClassID() { \ |
| 47 static uint32_t kClassID = GenBatchClassID(); \ | 47 static uint32_t kClassID = GenBatchClassID(); \ |
| 48 return kClassID; \ | 48 return kClassID; \ |
| 49 } | 49 } |
| 50 | 50 |
| 51 class GrRenderTarget; |
| 52 |
| 51 class GrBatch : public GrNonAtomicRef { | 53 class GrBatch : public GrNonAtomicRef { |
| 52 public: | 54 public: |
| 53 GrBatch(uint32_t classID); | 55 GrBatch(uint32_t classID); |
| 54 ~GrBatch() override; | 56 ~GrBatch() override; |
| 55 | 57 |
| 56 virtual const char* name() const = 0; | 58 virtual const char* name() const = 0; |
| 57 | 59 |
| 58 bool combineIfPossible(GrBatch* that, const GrCaps& caps) { | 60 bool combineIfPossible(GrBatch* that, const GrCaps& caps) { |
| 59 if (this->classID() != that->classID()) { | 61 if (this->classID() != that->classID()) { |
| 60 return false; | 62 return false; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 to quickly issue its draw when draw is called. */ | 101 to quickly issue its draw when draw is called. */ |
| 100 void prepare(GrBatchFlushState* state) { this->onPrepare(state); } | 102 void prepare(GrBatchFlushState* state) { this->onPrepare(state); } |
| 101 | 103 |
| 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 |
| 111 virtual GrRenderTarget* rt2() const = 0; |
| 112 |
| 109 /** Used for spewing information about batches when debugging. */ | 113 /** Used for spewing information about batches when debugging. */ |
| 110 virtual SkString dumpInfo() const = 0; | 114 virtual SkString dumpInfo() const = 0; |
| 111 | 115 |
| 112 protected: | 116 protected: |
| 113 // NOTE, compute some bounds, even if extremely conservative. Do *NOT* setL
argest on the bounds | 117 // 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 | 118 // rect because we outset it for dst copy textures |
| 115 void setBounds(const SkRect& newBounds) { fBounds = newBounds; } | 119 void setBounds(const SkRect& newBounds) { fBounds = newBounds; } |
| 116 | 120 |
| 117 void joinBounds(const SkRect& otherBounds) { | 121 void joinBounds(const SkRect& otherBounds) { |
| 118 return fBounds.joinPossiblyEmptyRect(otherBounds); | 122 return fBounds.joinPossiblyEmptyRect(otherBounds); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 148 #if GR_BATCH_SPEW | 152 #if GR_BATCH_SPEW |
| 149 static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); } | 153 static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); } |
| 150 const uint32_t fUniqueID; | 154 const uint32_t fUniqueID; |
| 151 static int32_t gCurrBatchUniqueID; | 155 static int32_t gCurrBatchUniqueID; |
| 152 #endif | 156 #endif |
| 153 static int32_t gCurrBatchClassID; | 157 static int32_t gCurrBatchClassID; |
| 154 typedef GrNonAtomicRef INHERITED; | 158 typedef GrNonAtomicRef INHERITED; |
| 155 }; | 159 }; |
| 156 | 160 |
| 157 #endif | 161 #endif |
| OLD | NEW |