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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 * GrBatch which should be forwarded to the GrPrimitiveProcessor(s) created by t
he batch. | 76 * GrBatch which should be forwarded to the GrPrimitiveProcessor(s) created by t
he batch. |
77 * These are not properly part of the pipeline because they assume the specific
inputs | 77 * These are not properly part of the pipeline because they assume the specific
inputs |
78 * that the batch provided when it created the pipeline. Identical pipelines may
be | 78 * that the batch provided when it created the pipeline. Identical pipelines may
be |
79 * created by different batches with different input assumptions and therefore d
ifferent | 79 * created by different batches with different input assumptions and therefore d
ifferent |
80 * computed optimizations. It is the batch-specific optimizations that allow the
pipelines | 80 * computed optimizations. It is the batch-specific optimizations that allow the
pipelines |
81 * to be equal. | 81 * to be equal. |
82 */ | 82 */ |
83 class GrPipelineOptimizations { | 83 class GrPipelineOptimizations { |
84 public: | 84 public: |
85 /** Does the pipeline require the GrPrimitiveProcessor's color? */ | 85 /** Does the pipeline require the GrPrimitiveProcessor's color? */ |
86 bool readsColor() const { return SkToBool(kReadsColor_GrPipelineOptimization
sFlag & fFlags); } | 86 bool readsColor() const { return SkToBool(kReadsColor_Flag & fFlags); } |
87 | 87 |
88 /** Does the pipeline require the GrPrimitiveProcessor's coverage? */ | 88 /** Does the pipeline require the GrPrimitiveProcessor's coverage? */ |
89 bool readsCoverage() const { return | 89 bool readsCoverage() const { return |
90 SkToBool(kReadsCoverage_GrPipelineOptimizationsFlag & fFlags); } | 90 SkToBool(kReadsCoverage_Flag & fFlags); } |
91 | 91 |
92 /** Does the pipeline require access to (implicit or explicit) local coordin
ates? */ | 92 /** Does the pipeline require access to (implicit or explicit) local coordin
ates? */ |
93 bool readsLocalCoords() const { | 93 bool readsLocalCoords() const { |
94 return SkToBool(kReadsLocalCoords_GrPipelineOptimizationsFlag & fFlags); | 94 return SkToBool(kReadsLocalCoords_Flag & fFlags); |
95 } | 95 } |
96 | 96 |
97 /** Does the pipeline allow the GrPrimitiveProcessor to combine color and co
verage into one | 97 /** Does the pipeline allow the GrPrimitiveProcessor to combine color and co
verage into one |
98 color output ? */ | 98 color output ? */ |
99 bool canTweakAlphaForCoverage() const { | 99 bool canTweakAlphaForCoverage() const { |
100 return SkToBool(kCanTweakAlphaForCoverage_GrPipelineOptimizationsFlag &
fFlags); | 100 return SkToBool(kCanTweakAlphaForCoverage_Flag & fFlags); |
101 } | 101 } |
102 | 102 |
103 /** Does the pipeline require the GrPrimitiveProcessor to specify a specific
color (and if | 103 /** Does the pipeline require the GrPrimitiveProcessor to specify a specific
color (and if |
104 so get the color)? */ | 104 so get the color)? */ |
105 bool getOverrideColorIfSet(GrColor* overrideColor) const { | 105 bool getOverrideColorIfSet(GrColor* overrideColor) const { |
106 if (SkToBool(kUseOverrideColor_GrPipelineOptimizationsFlag & fFlags)) { | 106 if (SkToBool(kUseOverrideColor_Flag & fFlags)) { |
107 SkASSERT(SkToBool(kReadsColor_GrPipelineOptimizationsFlag & fFlags))
; | 107 SkASSERT(SkToBool(kReadsColor_Flag & fFlags)); |
108 if (overrideColor) { | 108 if (overrideColor) { |
109 *overrideColor = fOverrideColor; | 109 *overrideColor = fOverrideColor; |
110 } | 110 } |
111 return true; | 111 return true; |
112 } | 112 } |
113 return false; | 113 return false; |
114 } | 114 } |
115 | 115 |
116 private: | 116 private: |
117 enum { | 117 enum { |
118 // If this is not set the primitive processor need not produce a color o
utput | 118 // If this is not set the primitive processor need not produce a color o
utput |
119 kReadsColor_GrPipelineOptimizationsFlag = 0x1, | 119 kReadsColor_Flag = 0x1, |
120 | 120 |
121 // If this is not set the primitive processor need not produce a coverag
e output | 121 // If this is not set the primitive processor need not produce a coverag
e output |
122 kReadsCoverage_GrPipelineOptimizationsFlag = 0x2, | 122 kReadsCoverage_Flag = 0x2, |
123 | 123 |
124 // If this is not set the primitive processor need not produce local coo
rdinates | 124 // If this is not set the primitive processor need not produce local coo
rdinates |
125 kReadsLocalCoords_GrPipelineOptimizationsFlag = 0x4, | 125 kReadsLocalCoords_Flag = 0x4, |
126 | 126 |
127 // If this flag is set then the primitive processor may produce color*co
verage as | 127 // If this flag is set then the primitive processor may produce color*co
verage as |
128 // its color output (and not output a separate coverage). | 128 // its color output (and not output a separate coverage). |
129 kCanTweakAlphaForCoverage_GrPipelineOptimizationsFlag = 0x8, | 129 kCanTweakAlphaForCoverage_Flag = 0x8, |
130 | 130 |
131 // If this flag is set the GrPrimitiveProcessor must produce fOverrideCo
lor as its | 131 // If this flag is set the GrPrimitiveProcessor must produce fOverrideCo
lor as its |
132 // output color. If not set fOverrideColor is to be ignored. | 132 // output color. If not set fOverrideColor is to be ignored. |
133 kUseOverrideColor_GrPipelineOptimizationsFlag = 0x10, | 133 kUseOverrideColor_Flag = 0x10, |
134 }; | 134 }; |
135 | 135 |
136 uint32_t fFlags; | 136 uint32_t fFlags; |
137 GrColor fOverrideColor; | 137 GrColor fOverrideColor; |
138 | 138 |
139 friend class GrPipeline; // To initialize this | 139 friend class GrPipeline; // To initialize this |
140 }; | 140 }; |
141 | 141 |
142 /* | 142 /* |
143 * This enum is shared by GrPrimitiveProcessors and GrGLPrimitiveProcessors to c
oordinate shaders | 143 * This enum is shared by GrPrimitiveProcessors and GrGLPrimitiveProcessors to c
oordinate shaders |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 private: | 245 private: |
246 virtual bool hasExplicitLocalCoords() const = 0; | 246 virtual bool hasExplicitLocalCoords() const = 0; |
247 | 247 |
248 bool fIsPathRendering; | 248 bool fIsPathRendering; |
249 | 249 |
250 typedef GrProcessor INHERITED; | 250 typedef GrProcessor INHERITED; |
251 }; | 251 }; |
252 | 252 |
253 #endif | 253 #endif |
OLD | NEW |