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