Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: src/gpu/batches/GrTestBatch.h

Issue 1467553002: New API for computing optimization invariants. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/batches/GrTessellatingPathRenderer.cpp ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 computePipelineOptimizations(GrInitInvariantOutput* color,
30 GrInitInvariantOutput* coverage,
31 GrBatchToXPOverrides* overrides) const ove rride {
30 // When this is called on a batch, there is only one geometry bundle 32 // When this is called on a batch, there is only one geometry bundle
31 out->setKnownFourComponents(this->geoData(0)->fColor); 33 color->setKnownFourComponents(this->geoData(0)->fColor);
34 coverage->setUnknownSingleComponent();
35 overrides->fUsePLSDstRead = false;
32 } 36 }
33 37
34 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { 38 void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
35 out->setUnknownSingleComponent();
36 }
37
38 void initBatchTracker(const GrPipelineOptimizations& opt) override {
39 // Handle any color overrides 39 // Handle any color overrides
40 if (!opt.readsColor()) { 40 if (!overrides.readsColor()) {
41 this->geoData(0)->fColor = GrColor_ILLEGAL; 41 this->geoData(0)->fColor = GrColor_ILLEGAL;
42 } 42 }
43 opt.getOverrideColorIfSet(&this->geoData(0)->fColor); 43 overrides.getOverrideColorIfSet(&this->geoData(0)->fColor);
44 44
45 // setup batch properties 45 // setup batch properties
46 fBatch.fColorIgnored = !opt.readsColor(); 46 fBatch.fColorIgnored = !overrides.readsColor();
47 fBatch.fColor = this->geoData(0)->fColor; 47 fBatch.fColor = this->geoData(0)->fColor;
48 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); 48 fBatch.fUsesLocalCoords = overrides.readsLocalCoords();
49 fBatch.fCoverageIgnored = !opt.readsCoverage(); 49 fBatch.fCoverageIgnored = !overrides.readsCoverage();
50 } 50 }
51 51
52 protected: 52 protected:
53 GrTestBatch(uint32_t classID, const GrGeometryProcessor* gp, const SkRect& b ounds) 53 GrTestBatch(uint32_t classID, const GrGeometryProcessor* gp, const SkRect& b ounds)
54 : INHERITED(classID) { 54 : INHERITED(classID) {
55 fGeometryProcessor.reset(SkRef(gp)); 55 fGeometryProcessor.reset(SkRef(gp));
56 56
57 this->setBounds(bounds); 57 this->setBounds(bounds);
58 } 58 }
59 59
(...skipping 21 matching lines...) Expand all
81 bool fCoverageIgnored; 81 bool fCoverageIgnored;
82 }; 82 };
83 83
84 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; 84 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor;
85 BatchTracker fBatch; 85 BatchTracker fBatch;
86 86
87 typedef GrVertexBatch INHERITED; 87 typedef GrVertexBatch INHERITED;
88 }; 88 };
89 89
90 #endif 90 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrTessellatingPathRenderer.cpp ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698