OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrGLSLXferProcessor_DEFINED | 8 #ifndef GrGLSLXferProcessor_DEFINED |
9 #define GrGLSLXferProcessor_DEFINED | 9 #define GrGLSLXferProcessor_DEFINED |
10 | 10 |
11 #include "glsl/GrGLSLProgramDataManager.h" | 11 #include "glsl/GrGLSLProgramDataManager.h" |
12 #include "glsl/GrGLSLTextureSampler.h" | 12 #include "glsl/GrGLSLTextureSampler.h" |
13 | 13 |
| 14 class GrGLSLXPFragmentBuilder; |
14 class GrGLSLXPBuilder; | 15 class GrGLSLXPBuilder; |
15 class GrXferProcessor; | 16 class GrXferProcessor; |
16 | 17 |
17 class GrGLSLXferProcessor { | 18 class GrGLSLXferProcessor { |
18 public: | 19 public: |
19 GrGLSLXferProcessor() {} | 20 GrGLSLXferProcessor() {} |
20 virtual ~GrGLSLXferProcessor() {} | 21 virtual ~GrGLSLXferProcessor() {} |
21 | 22 |
22 typedef GrGLSLTextureSampler::TextureSamplerArray TextureSamplerArray; | 23 typedef GrGLSLTextureSampler::TextureSamplerArray TextureSamplerArray; |
23 struct EmitArgs { | 24 struct EmitArgs { |
24 EmitArgs(GrGLSLXPBuilder* pb, | 25 EmitArgs(GrGLSLXPBuilder* pb, |
| 26 GrGLSLXPFragmentBuilder* fragBuilder, |
25 const GrXferProcessor& xp, | 27 const GrXferProcessor& xp, |
26 const char* inputColor, | 28 const char* inputColor, |
27 const char* inputCoverage, | 29 const char* inputCoverage, |
28 const char* outputPrimary, | 30 const char* outputPrimary, |
29 const char* outputSecondary, | 31 const char* outputSecondary, |
30 const TextureSamplerArray& samplers) | 32 const TextureSamplerArray& samplers) |
31 : fPB(pb) | 33 : fPB(pb) |
| 34 , fXPFragBuilder(fragBuilder) |
32 , fXP(xp) | 35 , fXP(xp) |
33 , fInputColor(inputColor) | 36 , fInputColor(inputColor) |
34 , fInputCoverage(inputCoverage) | 37 , fInputCoverage(inputCoverage) |
35 , fOutputPrimary(outputPrimary) | 38 , fOutputPrimary(outputPrimary) |
36 , fOutputSecondary(outputSecondary) | 39 , fOutputSecondary(outputSecondary) |
37 , fSamplers(samplers) {} | 40 , fSamplers(samplers) {} |
38 | 41 |
39 GrGLSLXPBuilder* fPB; | 42 GrGLSLXPBuilder* fPB; |
| 43 GrGLSLXPFragmentBuilder* fXPFragBuilder; |
40 const GrXferProcessor& fXP; | 44 const GrXferProcessor& fXP; |
41 const char* fInputColor; | 45 const char* fInputColor; |
42 const char* fInputCoverage; | 46 const char* fInputCoverage; |
43 const char* fOutputPrimary; | 47 const char* fOutputPrimary; |
44 const char* fOutputSecondary; | 48 const char* fOutputSecondary; |
45 const TextureSamplerArray& fSamplers; | 49 const TextureSamplerArray& fSamplers; |
46 }; | 50 }; |
47 /** | 51 /** |
48 * This is similar to emitCode() in the base class, except it takes a full s
hader builder. | 52 * This is similar to emitCode() in the base class, except it takes a full s
hader builder. |
49 * This allows the effect subclass to emit vertex code. | 53 * This allows the effect subclass to emit vertex code. |
(...skipping 18 matching lines...) Expand all Loading... |
68 virtual void emitOutputsForBlendState(const EmitArgs&) { | 72 virtual void emitOutputsForBlendState(const EmitArgs&) { |
69 SkFAIL("emitOutputsForBlendState not implemented."); | 73 SkFAIL("emitOutputsForBlendState not implemented."); |
70 } | 74 } |
71 | 75 |
72 /** | 76 /** |
73 * Called by emitCode() when the XP will perform a dst read. This method onl
y needs to supply | 77 * Called by emitCode() when the XP will perform a dst read. This method onl
y needs to supply |
74 * the blending logic. The base class applies coverage. A subclass only need
s to implement this | 78 * the blending logic. The base class applies coverage. A subclass only need
s to implement this |
75 * method if it can construct a GrXferProcessor that reads the dst color. | 79 * method if it can construct a GrXferProcessor that reads the dst color. |
76 */ | 80 */ |
77 virtual void emitBlendCodeForDstRead(GrGLSLXPBuilder*, | 81 virtual void emitBlendCodeForDstRead(GrGLSLXPBuilder*, |
| 82 GrGLSLXPFragmentBuilder*, |
78 const char* srcColor, | 83 const char* srcColor, |
79 const char* dstColor, | 84 const char* dstColor, |
80 const char* outColor, | 85 const char* outColor, |
81 const GrXferProcessor&) { | 86 const GrXferProcessor&) { |
82 SkFAIL("emitBlendCodeForDstRead not implemented."); | 87 SkFAIL("emitBlendCodeForDstRead not implemented."); |
83 } | 88 } |
84 | 89 |
85 virtual void onSetData(const GrGLSLProgramDataManager&, const GrXferProcesso
r&) = 0; | 90 virtual void onSetData(const GrGLSLProgramDataManager&, const GrXferProcesso
r&) = 0; |
86 | 91 |
87 GrGLSLProgramDataManager::UniformHandle fDstTopLeftUni; | 92 GrGLSLProgramDataManager::UniformHandle fDstTopLeftUni; |
88 GrGLSLProgramDataManager::UniformHandle fDstScaleUni; | 93 GrGLSLProgramDataManager::UniformHandle fDstScaleUni; |
89 }; | 94 }; |
90 #endif | 95 #endif |
OLD | NEW |