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 GrGLXferProcessor_DEFINED | 8 #ifndef GrGLXferProcessor_DEFINED |
9 #define GrGLXferProcessor_DEFINED | 9 #define GrGLXferProcessor_DEFINED |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 /** A GrGLXferProcessor instance can be reused with any GrGLXferProcessor th
at produces | 52 /** A GrGLXferProcessor instance can be reused with any GrGLXferProcessor th
at produces |
53 the same stage key; this function reads data from a GrGLXferProcessor an
d uploads any | 53 the same stage key; this function reads data from a GrGLXferProcessor an
d uploads any |
54 uniform variables required by the shaders created in emitCode(). The Gr
XferProcessor | 54 uniform variables required by the shaders created in emitCode(). The Gr
XferProcessor |
55 parameter is guaranteed to be of the same type that created this GrGLXfe
rProcessor and | 55 parameter is guaranteed to be of the same type that created this GrGLXfe
rProcessor and |
56 to have an identical processor key as the one that created this GrGLXfer
Processor. This | 56 to have an identical processor key as the one that created this GrGLXfer
Processor. This |
57 function calls onSetData on the subclass of GrGLXferProcessor | 57 function calls onSetData on the subclass of GrGLXferProcessor |
58 */ | 58 */ |
59 void setData(const GrGLProgramDataManager& pdm, const GrXferProcessor& xp); | 59 void setData(const GrGLProgramDataManager& pdm, const GrXferProcessor& xp); |
60 | 60 |
61 private: | 61 private: |
62 virtual void onEmitCode(const EmitArgs&) = 0; | 62 /** |
| 63 * Called by emitCode() when the XP will not be performing a dst read. This
method is |
| 64 * responsible for both blending and coverage. A subclass only needs to impl
ement this method if |
| 65 * it can construct a GrXferProcessor that will not read the dst color. |
| 66 */ |
| 67 virtual void emitOutputsForBlendState(const EmitArgs&) { |
| 68 SkFAIL("emitOutputsForBlendState not implemented."); |
| 69 } |
| 70 |
| 71 /** |
| 72 * Called by emitCode() when the XP will perform a dst read. This method onl
y needs to supply |
| 73 * the blending logic. The base class applies coverage. A subclass only need
s to implement this |
| 74 * method if it can construct a GrXferProcessor that reads the dst color. |
| 75 */ |
| 76 virtual void emitBlendCodeForDstRead(GrGLXPBuilder*, const char* srcColor, c
onst char* dstColor, |
| 77 const char* outColor, const GrXferProce
ssor&) { |
| 78 SkFAIL("emitBlendCodeForDstRead not implemented."); |
| 79 } |
63 | 80 |
64 virtual void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&
) = 0; | 81 virtual void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&
) = 0; |
65 | 82 |
66 GrGLProgramDataManager::UniformHandle fDstTopLeftUni; | 83 GrGLProgramDataManager::UniformHandle fDstTopLeftUni; |
67 GrGLProgramDataManager::UniformHandle fDstScaleUni; | 84 GrGLProgramDataManager::UniformHandle fDstScaleUni; |
68 | 85 |
69 typedef GrGLProcessor INHERITED; | 86 typedef GrGLProcessor INHERITED; |
70 }; | 87 }; |
71 #endif | 88 #endif |
OLD | NEW |