| 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 GrTestBatch_DEFINED | 8 #ifndef GrTestBatch_DEFINED |
| 9 #define GrTestBatch_DEFINED | 9 #define GrTestBatch_DEFINED |
| 10 | 10 |
| 11 #include "GrBatchFlushState.h" | 11 #include "GrBatchFlushState.h" |
| 12 #include "GrGeometryProcessor.h" | 12 #include "GrGeometryProcessor.h" |
| 13 #include "GrVertexBuffer.h" | 13 #include "GrVertexBuffer.h" |
| 14 | 14 |
| 15 #include "batches/GrVertexBatch.h" | 15 #include "batches/GrVertexBatch.h" |
| 16 | 16 |
| 17 /* | 17 /* |
| 18 * A simple batch only for testing purposes which actually doesn't batch at all,
but can fit into | 18 * A simple batch only for testing purposes which actually doesn't batch at all,
but can fit into |
| 19 * the batch pipeline and generate arbitrary geometry | 19 * the batch pipeline and generate arbitrary geometry |
| 20 */ | 20 */ |
| 21 class GrTestBatch : public GrVertexBatch { | 21 class GrTestBatch : public GrVertexBatch { |
| 22 public: | 22 public: |
| 23 struct Geometry { | 23 struct Geometry { |
| 24 GrColor fColor; | 24 GrColor fColor; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 virtual const char* name() const override = 0; | 27 virtual const char* name() const override = 0; |
| 28 | 28 |
| 29 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 29 void computeBatchToXPOverrides(GrInitInvariantOutput* color, GrInitInvariant
Output* coverage, |
| 30 bool* usePLSDstRead) const { |
| 30 // When this is called on a batch, there is only one geometry bundle | 31 // When this is called on a batch, there is only one geometry bundle |
| 31 out->setKnownFourComponents(this->geoData(0)->fColor); | 32 color->setKnownFourComponents(this->geoData(0)->fColor); |
| 32 } | 33 coverage->setUnknownSingleComponent(); |
| 33 | 34 *usePLSDstRead = false; |
| 34 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | |
| 35 out->setUnknownSingleComponent(); | |
| 36 } | 35 } |
| 37 | 36 |
| 38 void initBatchTracker(const GrPipelineOptimizations& opt) override { | 37 void initBatchTracker(const GrPipelineOptimizations& opt) override { |
| 39 // Handle any color overrides | 38 // Handle any color overrides |
| 40 if (!opt.readsColor()) { | 39 if (!opt.readsColor()) { |
| 41 this->geoData(0)->fColor = GrColor_ILLEGAL; | 40 this->geoData(0)->fColor = GrColor_ILLEGAL; |
| 42 } | 41 } |
| 43 opt.getOverrideColorIfSet(&this->geoData(0)->fColor); | 42 opt.getOverrideColorIfSet(&this->geoData(0)->fColor); |
| 44 | 43 |
| 45 // setup batch properties | 44 // setup batch properties |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 bool fCoverageIgnored; | 80 bool fCoverageIgnored; |
| 82 }; | 81 }; |
| 83 | 82 |
| 84 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; | 83 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; |
| 85 BatchTracker fBatch; | 84 BatchTracker fBatch; |
| 86 | 85 |
| 87 typedef GrVertexBatch INHERITED; | 86 typedef GrVertexBatch INHERITED; |
| 88 }; | 87 }; |
| 89 | 88 |
| 90 #endif | 89 #endif |
| OLD | NEW |