OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrPrimitiveProcessor_DEFINED | 8 #ifndef GrPrimitiveProcessor_DEFINED |
9 #define GrPrimitiveProcessor_DEFINED | 9 #define GrPrimitiveProcessor_DEFINED |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 private: | 65 private: |
66 SkAlignedSStorage<kMaxSize> fData; | 66 SkAlignedSStorage<kMaxSize> fData; |
67 }; | 67 }; |
68 | 68 |
69 class GrGLSLCaps; | 69 class GrGLSLCaps; |
70 class GrGLPrimitiveProcessor; | 70 class GrGLPrimitiveProcessor; |
71 | 71 |
72 struct GrInitInvariantOutput; | 72 struct GrInitInvariantOutput; |
73 | 73 |
74 /* | 74 /* |
75 * This class allows the GrPipeline to communicate information about the pipelin
e to a | 75 * This struct allows the GrPipeline to communicate information about the pipeli
ne. Most of this |
76 * GrPrimitiveProcessor that will be used in conjunction with the GrPipeline. | 76 * is overrides, but some of it is general information. Logically it should liv
e in GrPipeline.h, |
| 77 * but this is problematic due to circular dependencies. |
77 */ | 78 */ |
78 class GrPipelineInfo { | 79 struct GrPipelineInfo { |
79 public: | 80 bool fColorIgnored; |
80 /** Does the pipeline require the GrPrimitiveProcessor's color? */ | 81 bool fCoverageIgnored; |
81 bool readsColor() const { return SkToBool(kReadsColor_GrPipelineInfoFlag & f
Flags); } | 82 GrColor fOverrideColor; |
82 | 83 bool fUsesLocalCoords; |
83 /** Does the pipeline require the GrPrimitiveProcessor's coverage? */ | 84 bool fCanTweakAlphaForCoverage; |
84 bool readsCoverage() const { return SkToBool(kReadsCoverage_GrPipelineInfoFl
ag & fFlags); } | |
85 | |
86 /** Does the pipeline require access to (implicit or explicit) local coordin
ates? */ | |
87 bool readsLocalCoords() const { | |
88 return SkToBool(kReadsLocalCoords_GrPipelineInfoFlag & fFlags); | |
89 } | |
90 | |
91 /** Does the pipeline allow the GrPrimitiveProcessor to combine color and co
verage into one | |
92 color output ? */ | |
93 bool canTweakAlphaForCoverage() const { | |
94 return SkToBool(kCanTweakAlphaForCoverage_GrPipelineInfoFlag & fFlags); | |
95 } | |
96 | |
97 /** Does the pipeline require the GrPrimitiveProcessor to specify a specific
color (and if | |
98 so get the color)? */ | |
99 bool getOverrideColorIfSet(GrColor* overrideColor) const { | |
100 if (SkToBool(kUseOverrideColor_GrPipelineInfoFlag & fFlags)) { | |
101 SkASSERT(SkToBool(kReadsColor_GrPipelineInfoFlag & fFlags)); | |
102 if (overrideColor) { | |
103 *overrideColor = fOverrideColor; | |
104 } | |
105 return true; | |
106 } | |
107 return false; | |
108 } | |
109 | |
110 private: | |
111 enum { | |
112 // If this is not set the primitive processor need not produce a color o
utput | |
113 kReadsColor_GrPipelineInfoFlag = 0x1, | |
114 | |
115 // If this is not set the primitive processor need not produce a coverag
e output | |
116 kReadsCoverage_GrPipelineInfoFlag = 0x2, | |
117 | |
118 // If this is not set the primitive processor need not produce local coo
rdinates | |
119 kReadsLocalCoords_GrPipelineInfoFlag = 0x4, | |
120 | |
121 // If this flag is set then the primitive processor may produce color*co
verage as | |
122 // its color output (and not output a separate coverage). | |
123 kCanTweakAlphaForCoverage_GrPipelineInfoFlag = 0x8, | |
124 | |
125 // If this flag is set the GrPrimitiveProcessor must produce fOverrideCo
lor as its | |
126 // output color. If not set fOverrideColor is to be ignored. | |
127 kUseOverrideColor_GrPipelineInfoFlag = 0x10, | |
128 }; | |
129 | |
130 uint32_t fFlags; | |
131 GrColor fOverrideColor; | |
132 | |
133 friend class GrPipeline; // To initialize this | |
134 }; | 85 }; |
135 | 86 |
136 /* | 87 /* |
137 * This enum is shared by GrPrimitiveProcessors and GrGLPrimitiveProcessors to c
oordinate shaders | 88 * This enum is shared by GrPrimitiveProcessors and GrGLPrimitiveProcessors to c
oordinate shaders |
138 * with vertex attributes / uniforms. | 89 * with vertex attributes / uniforms. |
139 */ | 90 */ |
140 enum GrGPInput { | 91 enum GrGPInput { |
141 kAllOnes_GrGPInput, | 92 kAllOnes_GrGPInput, |
142 kAttribute_GrGPInput, | 93 kAttribute_GrGPInput, |
143 kUniform_GrGPInput, | 94 kUniform_GrGPInput, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 183 |
233 private: | 184 private: |
234 virtual bool hasExplicitLocalCoords() const = 0; | 185 virtual bool hasExplicitLocalCoords() const = 0; |
235 | 186 |
236 bool fIsPathRendering; | 187 bool fIsPathRendering; |
237 | 188 |
238 typedef GrProcessor INHERITED; | 189 typedef GrProcessor INHERITED; |
239 }; | 190 }; |
240 | 191 |
241 #endif | 192 #endif |
OLD | NEW |