| 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 GrDrawBatch_DEFINED | 8 #ifndef GrDrawBatch_DEFINED |
| 9 #define GrDrawBatch_DEFINED | 9 #define GrDrawBatch_DEFINED |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 /** | 36 /** |
| 37 * Base class for GrBatches that draw. These batches have a GrPipeline installed
by GrDrawTarget. | 37 * Base class for GrBatches that draw. These batches have a GrPipeline installed
by GrDrawTarget. |
| 38 */ | 38 */ |
| 39 class GrDrawBatch : public GrBatch { | 39 class GrDrawBatch : public GrBatch { |
| 40 public: | 40 public: |
| 41 class Target; | 41 class Target; |
| 42 | 42 |
| 43 GrDrawBatch(uint32_t classID); | 43 GrDrawBatch(uint32_t classID); |
| 44 ~GrDrawBatch() override; | 44 ~GrDrawBatch() override; |
| 45 | 45 |
| 46 virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0; | 46 /** |
| 47 virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const =
0; | 47 * Fills in a structure informing the XP of overrides to its normal behavior
. |
| 48 */ |
| 49 void getPipelineOptimizations(GrPipelineOptimizations* override) const; |
| 48 | 50 |
| 49 const GrPipeline* pipeline() const { | 51 const GrPipeline* pipeline() const { |
| 50 SkASSERT(fPipelineInstalled); | 52 SkASSERT(fPipelineInstalled); |
| 51 return reinterpret_cast<const GrPipeline*>(fPipelineStorage.get()); | 53 return reinterpret_cast<const GrPipeline*>(fPipelineStorage.get()); |
| 52 } | 54 } |
| 53 | 55 |
| 54 bool installPipeline(const GrPipeline::CreateArgs&); | 56 bool installPipeline(const GrPipeline::CreateArgs&); |
| 55 | 57 |
| 56 // TODO no GrPrimitiveProcessors yet read fragment position | 58 // TODO no GrPrimitiveProcessors yet read fragment position |
| 57 bool willReadFragmentPosition() const { return false; } | 59 bool willReadFragmentPosition() const { return false; } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 73 string.append("CoverageStages:\n"); | 75 string.append("CoverageStages:\n"); |
| 74 for (int i = 0; i < this->pipeline()->numCoverageFragmentProcessors(); i
++) { | 76 for (int i = 0; i < this->pipeline()->numCoverageFragmentProcessors(); i
++) { |
| 75 string.appendf("\t\t%s\n\t\t%s\n", | 77 string.appendf("\t\t%s\n\t\t%s\n", |
| 76 this->pipeline()->getCoverageFragmentProcessor(i).nam
e(), | 78 this->pipeline()->getCoverageFragmentProcessor(i).nam
e(), |
| 77 this->pipeline()->getCoverageFragmentProcessor(i).dum
pInfo().c_str()); | 79 this->pipeline()->getCoverageFragmentProcessor(i).dum
pInfo().c_str()); |
| 78 } | 80 } |
| 79 string.appendf("XP: %s\n", this->pipeline()->getXferProcessor()->name())
; | 81 string.appendf("XP: %s\n", this->pipeline()->getXferProcessor()->name())
; |
| 80 return string; | 82 return string; |
| 81 } | 83 } |
| 82 | 84 |
| 85 protected: |
| 86 virtual void computePipelineOptimizations(GrInitInvariantOutput* color, |
| 87 GrInitInvariantOutput* coverage, |
| 88 GrBatchToXPOverrides* overrides) c
onst = 0; |
| 89 |
| 83 private: | 90 private: |
| 84 /** | 91 /** |
| 85 * initBatchTracker is a hook for the some additional overrides / optimizati
on possibilities | 92 * initBatchTracker is a hook for the some additional overrides / optimizati
on possibilities |
| 86 * from the GrXferProcessor. | 93 * from the GrXferProcessor. |
| 87 */ | 94 */ |
| 88 virtual void initBatchTracker(const GrPipelineOptimizations&) = 0; | 95 virtual void initBatchTracker(const GrXPOverridesForBatch&) = 0; |
| 89 | 96 |
| 90 protected: | 97 protected: |
| 91 SkTArray<SkAutoTUnref<GrBatchUploader>, true> fInlineUploads; | 98 SkTArray<SkAutoTUnref<GrBatchUploader>, true> fInlineUploads; |
| 92 | 99 |
| 93 private: | 100 private: |
| 94 SkAlignedSTStorage<1, GrPipeline> fPipelineStorage; | 101 SkAlignedSTStorage<1, GrPipeline> fPipelineStorage; |
| 95 bool fPipelineInstalled; | 102 bool fPipelineInstalled; |
| 96 typedef GrBatch INHERITED; | 103 typedef GrBatch INHERITED; |
| 97 }; | 104 }; |
| 98 | 105 |
| 99 #endif | 106 #endif |
| OLD | NEW |