OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrXferProcessor_DEFINED | 8 #ifndef GrXferProcessor_DEFINED |
9 #define GrXferProcessor_DEFINED | 9 #define GrXferProcessor_DEFINED |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 fTexture.reset(SkSafeRef(texture)); | 85 fTexture.reset(SkSafeRef(texture)); |
86 return texture; | 86 return texture; |
87 } | 87 } |
88 | 88 |
89 private: | 89 private: |
90 SkAutoTUnref<GrTexture> fTexture; | 90 SkAutoTUnref<GrTexture> fTexture; |
91 SkIPoint fOffset; | 91 SkIPoint fOffset; |
92 }; | 92 }; |
93 | 93 |
94 /** | 94 /** |
95 * Sets a unique key on the GrProcessorKeyBuilder calls onGetGLProcessorKey(
...) to get the | 95 * Sets a unique key on the GrProcessorKeyBuilder calls onGetGLSLProcessorKe
y(...) to get the |
96 * specific subclass's key. | 96 * specific subclass's key. |
97 */ | 97 */ |
98 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con
st; | 98 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst; |
99 | 99 |
100 /** Returns a new instance of the appropriate *GL* implementation class | 100 /** Returns a new instance of the appropriate *GL* implementation class |
101 for the given GrXferProcessor; caller is responsible for deleting | 101 for the given GrXferProcessor; caller is responsible for deleting |
102 the object. */ | 102 the object. */ |
103 virtual GrGLSLXferProcessor* createGLInstance() const = 0; | 103 virtual GrGLSLXferProcessor* createGLSLInstance() const = 0; |
104 | 104 |
105 /** | 105 /** |
106 * Optimizations for blending / coverage that an OptDrawState should apply t
o itself. | 106 * Optimizations for blending / coverage that an OptDrawState should apply t
o itself. |
107 */ | 107 */ |
108 enum OptFlags { | 108 enum OptFlags { |
109 /** | 109 /** |
110 * The draw can be skipped completely. | 110 * The draw can be skipped completely. |
111 */ | 111 */ |
112 kSkipDraw_OptFlag = 0x1, | 112 kSkipDraw_OptFlag = 0x1, |
113 /** | 113 /** |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 * Returns whether or not this xferProcossor will set a secondary output to
be used with dual | 207 * Returns whether or not this xferProcossor will set a secondary output to
be used with dual |
208 * source blending. | 208 * source blending. |
209 */ | 209 */ |
210 bool hasSecondaryOutput() const; | 210 bool hasSecondaryOutput() const; |
211 | 211 |
212 /** Returns true if this and other processor conservatively draw identically
. It can only return | 212 /** Returns true if this and other processor conservatively draw identically
. It can only return |
213 true when the two processor are of the same subclass (i.e. they return t
he same object from | 213 true when the two processor are of the same subclass (i.e. they return t
he same object from |
214 from getFactory()). | 214 from getFactory()). |
215 | 215 |
216 A return value of true from isEqual() should not be used to test whether
the processor would | 216 A return value of true from isEqual() should not be used to test whether
the processor would |
217 generate the same shader code. To test for identical code generation use
getGLProcessorKey*/ | 217 generate the same shader code. To test for identical code generation use
getGLSLProcessorKey |
| 218 */ |
218 | 219 |
219 bool isEqual(const GrXferProcessor& that) const { | 220 bool isEqual(const GrXferProcessor& that) const { |
220 if (this->classID() != that.classID()) { | 221 if (this->classID() != that.classID()) { |
221 return false; | 222 return false; |
222 } | 223 } |
223 if (this->fWillReadDstColor != that.fWillReadDstColor) { | 224 if (this->fWillReadDstColor != that.fWillReadDstColor) { |
224 return false; | 225 return false; |
225 } | 226 } |
226 if (this->fReadsCoverage != that.fReadsCoverage) { | 227 if (this->fReadsCoverage != that.fReadsCoverage) { |
227 return false; | 228 return false; |
(...skipping 20 matching lines...) Expand all Loading... |
248 virtual OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI, | 249 virtual OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI, |
249 const GrProcOptInfo& coveragePOI, | 250 const GrProcOptInfo& coveragePOI, |
250 bool doesStencilWrite, | 251 bool doesStencilWrite, |
251 GrColor* overrideColor, | 252 GrColor* overrideColor, |
252 const GrCaps& caps) = 0; | 253 const GrCaps& caps) = 0; |
253 | 254 |
254 /** | 255 /** |
255 * Sets a unique key on the GrProcessorKeyBuilder that is directly associate
d with this xfer | 256 * Sets a unique key on the GrProcessorKeyBuilder that is directly associate
d with this xfer |
256 * processor's GL backend implementation. | 257 * processor's GL backend implementation. |
257 */ | 258 */ |
258 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, | 259 virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
259 GrProcessorKeyBuilder* b) const = 0; | 260 GrProcessorKeyBuilder* b) const = 0; |
260 | 261 |
261 /** | 262 /** |
262 * Determines the type of barrier (if any) required by the subclass. Note th
at the possibility | 263 * Determines the type of barrier (if any) required by the subclass. Note th
at the possibility |
263 * that a kTexture type barrier is required is handled by the base class and
need not be | 264 * that a kTexture type barrier is required is handled by the base class and
need not be |
264 * considered by subclass overrides of this function. | 265 * considered by subclass overrides of this function. |
265 */ | 266 */ |
266 virtual GrXferBarrierType onXferBarrier(const GrRenderTarget*, const GrCaps&
) const { | 267 virtual GrXferBarrierType onXferBarrier(const GrRenderTarget*, const GrCaps&
) const { |
267 return kNone_GrXferBarrierType; | 268 return kNone_GrXferBarrierType; |
268 } | 269 } |
269 | 270 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 enum { | 401 enum { |
401 kIllegalXPFClassID = 0, | 402 kIllegalXPFClassID = 0, |
402 }; | 403 }; |
403 static int32_t gCurrXPFClassID; | 404 static int32_t gCurrXPFClassID; |
404 | 405 |
405 typedef GrProgramElement INHERITED; | 406 typedef GrProgramElement INHERITED; |
406 }; | 407 }; |
407 | 408 |
408 #endif | 409 #endif |
409 | 410 |
OLD | NEW |