Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 26 class TextureUploader; | 26 class TextureUploader; |
| 27 | 27 |
| 28 GrBatchUploader(GrBatchToken lastUploadToken) : fLastUploadToken(lastUploadT oken) {} | 28 GrBatchUploader(GrBatchToken lastUploadToken) : fLastUploadToken(lastUploadT oken) {} |
| 29 GrBatchToken lastUploadToken() const { return fLastUploadToken; } | 29 GrBatchToken lastUploadToken() const { return fLastUploadToken; } |
| 30 virtual void upload(TextureUploader*)=0; | 30 virtual void upload(TextureUploader*)=0; |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 GrBatchToken fLastUploadToken; | 33 GrBatchToken fLastUploadToken; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 struct GrBatchToXPOverrides { | |
|
joshualitt
2015/11/23 19:09:29
GrPipelineOptimizations
| |
| 37 GrProcOptInfo fColorPOI; | |
| 38 GrProcOptInfo fCoveragePOI; | |
| 39 bool fUsePLSDstRead; | |
|
joshualitt
2015/11/23 19:09:29
GrBatchToXPOverrides
| |
| 40 }; | |
| 41 | |
| 36 /** | 42 /** |
| 37 * Base class for GrBatches that draw. These batches have a GrPipeline installed by GrDrawTarget. | 43 * Base class for GrBatches that draw. These batches have a GrPipeline installed by GrDrawTarget. |
| 38 */ | 44 */ |
| 39 class GrDrawBatch : public GrBatch { | 45 class GrDrawBatch : public GrBatch { |
| 40 public: | 46 public: |
| 41 class Target; | 47 class Target; |
| 42 | 48 |
| 43 GrDrawBatch(uint32_t classID); | 49 GrDrawBatch(uint32_t classID); |
| 44 ~GrDrawBatch() override; | 50 ~GrDrawBatch() override; |
| 45 | 51 |
| 46 virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0; | 52 /** |
| 47 virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const = 0; | 53 * Fills in a structure informing the XP of overrides to its normal behavior . |
| 54 */ | |
| 55 void getBatchToXPOverrides(GrBatchToXPOverrides &override) const; | |
|
joshualitt
2015/11/23 19:09:29
getPipelineOptimizations
| |
| 48 | 56 |
| 49 const GrPipeline* pipeline() const { | 57 const GrPipeline* pipeline() const { |
| 50 SkASSERT(fPipelineInstalled); | 58 SkASSERT(fPipelineInstalled); |
| 51 return reinterpret_cast<const GrPipeline*>(fPipelineStorage.get()); | 59 return reinterpret_cast<const GrPipeline*>(fPipelineStorage.get()); |
| 52 } | 60 } |
| 53 | 61 |
| 54 bool installPipeline(const GrPipeline::CreateArgs&); | 62 bool installPipeline(const GrPipeline::CreateArgs&); |
| 55 | 63 |
| 56 // TODO no GrPrimitiveProcessors yet read fragment position | 64 // TODO no GrPrimitiveProcessors yet read fragment position |
| 57 bool willReadFragmentPosition() const { return false; } | 65 bool willReadFragmentPosition() const { return false; } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 73 string.append("CoverageStages:\n"); | 81 string.append("CoverageStages:\n"); |
| 74 for (int i = 0; i < this->pipeline()->numCoverageFragmentProcessors(); i ++) { | 82 for (int i = 0; i < this->pipeline()->numCoverageFragmentProcessors(); i ++) { |
| 75 string.appendf("\t\t%s\n\t\t%s\n", | 83 string.appendf("\t\t%s\n\t\t%s\n", |
| 76 this->pipeline()->getCoverageFragmentProcessor(i).nam e(), | 84 this->pipeline()->getCoverageFragmentProcessor(i).nam e(), |
| 77 this->pipeline()->getCoverageFragmentProcessor(i).dum pInfo().c_str()); | 85 this->pipeline()->getCoverageFragmentProcessor(i).dum pInfo().c_str()); |
| 78 } | 86 } |
| 79 string.appendf("XP: %s\n", this->pipeline()->getXferProcessor()->name()) ; | 87 string.appendf("XP: %s\n", this->pipeline()->getXferProcessor()->name()) ; |
| 80 return string; | 88 return string; |
| 81 } | 89 } |
| 82 | 90 |
| 91 protected: | |
| 92 virtual void computeBatchToXPOverrides(GrInitInvariantOutput* color, GrInitI nvariantOutput* coverage, | |
|
joshualitt
2015/11/23 19:09:29
line wraps.
onGetPipelineOptimizations
| |
| 93 bool* usePLSDstRead) const = 0; | |
| 94 | |
| 83 private: | 95 private: |
| 84 /** | 96 /** |
| 85 * initBatchTracker is a hook for the some additional overrides / optimizati on possibilities | 97 * initBatchTracker is a hook for the some additional overrides / optimizati on possibilities |
| 86 * from the GrXferProcessor. | 98 * from the GrXferProcessor. |
| 87 */ | 99 */ |
| 88 virtual void initBatchTracker(const GrPipelineOptimizations&) = 0; | 100 virtual void initBatchTracker(const GrPipelineOptimizations&) = 0; |
| 89 | 101 |
| 90 protected: | 102 protected: |
| 91 SkTArray<SkAutoTUnref<GrBatchUploader>, true> fInlineUploads; | 103 SkTArray<SkAutoTUnref<GrBatchUploader>, true> fInlineUploads; |
| 92 | 104 |
| 93 private: | 105 private: |
| 94 SkAlignedSTStorage<1, GrPipeline> fPipelineStorage; | 106 SkAlignedSTStorage<1, GrPipeline> fPipelineStorage; |
| 95 bool fPipelineInstalled; | 107 bool fPipelineInstalled; |
| 96 typedef GrBatch INHERITED; | 108 typedef GrBatch INHERITED; |
| 97 }; | 109 }; |
| 98 | 110 |
| 99 #endif | 111 #endif |
| OLD | NEW |