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

Side by Side Diff: include/gpu/GrProcessorStage.h

Issue 647183002: Revert of Opt state takes a GP instead of a GeometryStage (Closed) Base URL: https://skia.googlesource.com/skia.git@builder_cleanup
Patch Set: Created 6 years, 2 months 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 | « include/gpu/GrProcessor.h ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
11 #ifndef GrProcessorStage_DEFINED 11 #ifndef GrProcessorStage_DEFINED
12 #define GrProcessorStage_DEFINED 12 #define GrProcessorStage_DEFINED
13 13
14 #include "GrBackendProcessorFactory.h" 14 #include "GrBackendProcessorFactory.h"
15 #include "GrCoordTransform.h" 15 #include "GrCoordTransform.h"
16 #include "GrProcessor.h" 16 #include "GrProcessor.h"
17 #include "GrGeometryProcessor.h" 17 #include "GrGeometryProcessor.h"
18 #include "GrProgramElementRef.h" 18 #include "GrProgramElementRef.h"
19 #include "SkMatrix.h" 19 #include "SkMatrix.h"
20 #include "SkShader.h" 20 #include "SkShader.h"
21 21
22 // TODO: Make two variations on this class: One for GrDrawState that only owns r egular refs 22 // TODO: Make two variations on this class: One for GrDrawState that only owns r egular refs
23 // and supports compatibility checks and changing local coords. The second is fo r GrOptDrawState, 23 // and supports compatibility checks and changing local coords. The second is fo r GrOptDrawState,
24 // is immutable, and only owns pending execution refs. This requries removing th e common base 24 // is immutable, and only owns pending execution refs. This requries removing th e common base
25 // class from GrDrawState and GrOptDrawState called GrRODrawState and converting to GrOptDrawState 25 // class from GrDrawState and GrOptDrawState called GrRODrawState and converting to GrOptDrawState
26 // when draws are enqueued in the GrInOrderDrawBuffer. 26 // when draws are enqueued in the GrInOrderDrawBuffer.
27 class GrFragmentStage { 27 class GrProcessorStage {
28 public: 28 public:
29 explicit GrFragmentStage(const GrFragmentProcessor* proc) 29 explicit GrProcessorStage(const GrProcessor* proc)
30 : fProc(SkRef(proc)) { 30 : fProc(SkRef(proc)) {
31 fCoordChangeMatrixSet = false; 31 fCoordChangeMatrixSet = false;
32 } 32 }
33 33
34 GrFragmentStage(const GrFragmentStage& other) { 34 virtual ~GrProcessorStage() {}
35
36 GrProcessorStage(const GrProcessorStage& other) {
35 fCoordChangeMatrixSet = other.fCoordChangeMatrixSet; 37 fCoordChangeMatrixSet = other.fCoordChangeMatrixSet;
36 if (other.fCoordChangeMatrixSet) { 38 if (other.fCoordChangeMatrixSet) {
37 fCoordChangeMatrix = other.fCoordChangeMatrix; 39 fCoordChangeMatrix = other.fCoordChangeMatrix;
38 } 40 }
39 fProc.initAndRef(other.fProc); 41 fProc.initAndRef(other.fProc);
40 } 42 }
41 43
42 static bool AreCompatible(const GrFragmentStage& a, const GrFragmentStage& b , 44 static bool AreCompatible(const GrProcessorStage& a, const GrProcessorStage& b,
43 bool usingExplicitLocalCoords) { 45 bool usingExplicitLocalCoords) {
44 SkASSERT(a.fProc.get()); 46 SkASSERT(a.fProc.get());
45 SkASSERT(b.fProc.get()); 47 SkASSERT(b.fProc.get());
46 48
47 if (!a.getProcessor()->isEqual(*b.getProcessor())) { 49 if (!a.getProcessor()->isEqual(*b.getProcessor())) {
48 return false; 50 return false;
49 } 51 }
50 52
51 // We always track the coord change matrix, but it has no effect when ex plicit local coords 53 // We always track the coord change matrix, but it has no effect when ex plicit local coords
52 // are used. 54 // are used.
(...skipping 28 matching lines...) Expand all
81 } 83 }
82 84
83 class SavedCoordChange { 85 class SavedCoordChange {
84 public: 86 public:
85 SkDEBUGCODE(SavedCoordChange() : fEffectUniqueID(SK_InvalidUniqueID) {}) 87 SkDEBUGCODE(SavedCoordChange() : fEffectUniqueID(SK_InvalidUniqueID) {})
86 private: 88 private:
87 bool fCoordChangeMatrixSet; 89 bool fCoordChangeMatrixSet;
88 SkMatrix fCoordChangeMatrix; 90 SkMatrix fCoordChangeMatrix;
89 SkDEBUGCODE(mutable uint32_t fEffectUniqueID;) 91 SkDEBUGCODE(mutable uint32_t fEffectUniqueID;)
90 92
91 friend class GrFragmentStage; 93 friend class GrProcessorStage;
92 }; 94 };
93 95
94 /** 96 /**
95 * This gets the current coordinate system change. It is the accumulation of 97 * This gets the current coordinate system change. It is the accumulation of
96 * localCoordChange calls since the effect was installed. It is used when th en caller 98 * localCoordChange calls since the effect was installed. It is used when th en caller
97 * wants to temporarily change the source geometry coord system, draw someth ing, and then 99 * wants to temporarily change the source geometry coord system, draw someth ing, and then
98 * restore the previous coord system (e.g. temporarily draw in device coords ). 100 * restore the previous coord system (e.g. temporarily draw in device coords ).
99 */ 101 */
100 void saveCoordChange(SavedCoordChange* savedCoordChange) const { 102 void saveCoordChange(SavedCoordChange* savedCoordChange) const {
101 savedCoordChange->fCoordChangeMatrixSet = fCoordChangeMatrixSet; 103 savedCoordChange->fCoordChangeMatrixSet = fCoordChangeMatrixSet;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 142 }
141 143
142 int combinedTypes = type0 | type1; 144 int combinedTypes = type0 | type1;
143 if (SkMatrix::kPerspective_Mask & combinedTypes) { 145 if (SkMatrix::kPerspective_Mask & combinedTypes) {
144 return true; 146 return true;
145 } else { 147 } else {
146 return false; 148 return false;
147 } 149 }
148 } 150 }
149 151
150 const GrFragmentProcessor* getProcessor() const { return fProc.get(); } 152 virtual const GrProcessor* getProcessor() const = 0;
151 153
152 void convertToPendingExec() { fProc.convertToPendingExec(); } 154 void convertToPendingExec() { fProc.convertToPendingExec(); }
153 155
154 protected: 156 protected:
155 bool fCoordChangeMatrixSet; 157 bool fCoordChangeMatrixSet;
156 SkMatrix fCoordChangeMatrix; 158 SkMatrix fCoordChangeMatrix;
157 GrProgramElementRef<const GrFragmentProcessor> fProc; 159 GrProgramElementRef<const GrProcessor> fProc;
160 };
161
162 class GrFragmentStage : public GrProcessorStage {
163 public:
164 GrFragmentStage(const GrFragmentProcessor* fp) : GrProcessorStage(fp) {}
165
166 virtual const GrFragmentProcessor* getProcessor() const {
167 return static_cast<const GrFragmentProcessor*>(fProc.get());
168 }
169
170 typedef GrFragmentProcessor Processor;
171 typedef GrGLFragmentProcessor GLProcessor;
172 };
173
174 class GrGeometryStage : public GrProcessorStage {
175 public:
176 GrGeometryStage(const GrGeometryProcessor* gp) : GrProcessorStage(gp) {}
177
178 virtual const GrGeometryProcessor* getProcessor() const {
179 return static_cast<const GrGeometryProcessor*>(fProc.get());
180 }
181
182 typedef GrGeometryProcessor Processor;
183 typedef GrGLGeometryProcessor GLProcessor;
158 }; 184 };
159 185
160 #endif 186 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrProcessor.h ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698