| 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 |
| 11 #include "GrGLFragmentProcessor.h" | 11 #include "GrGLProcessor.h" |
| 12 #include "glsl/GrGLSLProgramDataManager.h" |
| 12 | 13 |
| 13 class GrGLXPBuilder; | 14 class GrGLXPBuilder; |
| 14 class GrXferProcessor; | 15 class GrXferProcessor; |
| 15 | 16 |
| 16 class GrGLXferProcessor { | 17 class GrGLXferProcessor { |
| 17 public: | 18 public: |
| 18 GrGLXferProcessor() {} | 19 GrGLXferProcessor() {} |
| 19 virtual ~GrGLXferProcessor() {} | 20 virtual ~GrGLXferProcessor() {} |
| 20 | 21 |
| 21 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; | 22 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 49 */ | 50 */ |
| 50 void emitCode(const EmitArgs&); | 51 void emitCode(const EmitArgs&); |
| 51 | 52 |
| 52 /** A GrGLXferProcessor instance can be reused with any GrGLXferProcessor th
at produces | 53 /** 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 | 54 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 | 55 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 | 56 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 | 57 to have an identical processor key as the one that created this GrGLXfer
Processor. This |
| 57 function calls onSetData on the subclass of GrGLXferProcessor | 58 function calls onSetData on the subclass of GrGLXferProcessor |
| 58 */ | 59 */ |
| 59 void setData(const GrGLProgramDataManager& pdm, const GrXferProcessor& xp); | 60 void setData(const GrGLSLProgramDataManager& pdm, const GrXferProcessor& xp)
; |
| 60 | 61 |
| 61 private: | 62 private: |
| 62 /** | 63 /** |
| 63 * Called by emitCode() when the XP will not be performing a dst read. This
method is | 64 * 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 * 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 * it can construct a GrXferProcessor that will not read the dst color. |
| 66 */ | 67 */ |
| 67 virtual void emitOutputsForBlendState(const EmitArgs&) { | 68 virtual void emitOutputsForBlendState(const EmitArgs&) { |
| 68 SkFAIL("emitOutputsForBlendState not implemented."); | 69 SkFAIL("emitOutputsForBlendState not implemented."); |
| 69 } | 70 } |
| 70 | 71 |
| 71 /** | 72 /** |
| 72 * Called by emitCode() when the XP will perform a dst read. This method onl
y needs to supply | 73 * 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 * 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 * method if it can construct a GrXferProcessor that reads the dst color. |
| 75 */ | 76 */ |
| 76 virtual void emitBlendCodeForDstRead(GrGLXPBuilder*, const char* srcColor, c
onst char* dstColor, | 77 virtual void emitBlendCodeForDstRead(GrGLXPBuilder*, const char* srcColor, c
onst char* dstColor, |
| 77 const char* outColor, const GrXferProce
ssor&) { | 78 const char* outColor, const GrXferProce
ssor&) { |
| 78 SkFAIL("emitBlendCodeForDstRead not implemented."); | 79 SkFAIL("emitBlendCodeForDstRead not implemented."); |
| 79 } | 80 } |
| 80 | 81 |
| 81 virtual void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&
) = 0; | 82 virtual void onSetData(const GrGLSLProgramDataManager&, const GrXferProcesso
r&) = 0; |
| 82 | 83 |
| 83 GrGLProgramDataManager::UniformHandle fDstTopLeftUni; | 84 GrGLSLProgramDataManager::UniformHandle fDstTopLeftUni; |
| 84 GrGLProgramDataManager::UniformHandle fDstScaleUni; | 85 GrGLSLProgramDataManager::UniformHandle fDstScaleUni; |
| 85 | 86 |
| 86 typedef GrGLProcessor INHERITED; | 87 typedef GrGLProcessor INHERITED; |
| 87 }; | 88 }; |
| 88 #endif | 89 #endif |
| OLD | NEW |