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 GrXferProcessor; | 14 class GrXferProcessor; |
| 15 class GrGLSLCaps; |
| 16 class GrGLSLUniformHandler; |
15 class GrGLSLXPBuilder; | 17 class GrGLSLXPBuilder; |
16 class GrGLSLXPFragmentBuilder; | 18 class GrGLSLXPFragmentBuilder; |
17 class GrGLSLCaps; | |
18 | 19 |
19 class GrGLSLXferProcessor { | 20 class GrGLSLXferProcessor { |
20 public: | 21 public: |
21 GrGLSLXferProcessor() {} | 22 GrGLSLXferProcessor() {} |
22 virtual ~GrGLSLXferProcessor() {} | 23 virtual ~GrGLSLXferProcessor() {} |
23 | 24 |
24 typedef GrGLSLTextureSampler::TextureSamplerArray TextureSamplerArray; | 25 typedef GrGLSLTextureSampler::TextureSamplerArray TextureSamplerArray; |
25 struct EmitArgs { | 26 struct EmitArgs { |
26 EmitArgs(GrGLSLXPBuilder* pb, | 27 EmitArgs(GrGLSLXPFragmentBuilder* fragBuilder, |
27 GrGLSLXPFragmentBuilder* fragBuilder, | 28 GrGLSLUniformHandler* uniformHandler, |
28 const GrGLSLCaps* caps, | 29 const GrGLSLCaps* caps, |
29 const GrXferProcessor& xp, | 30 const GrXferProcessor& xp, |
30 const char* inputColor, | 31 const char* inputColor, |
31 const char* inputCoverage, | 32 const char* inputCoverage, |
32 const char* outputPrimary, | 33 const char* outputPrimary, |
33 const char* outputSecondary, | 34 const char* outputSecondary, |
34 const TextureSamplerArray& samplers) | 35 const TextureSamplerArray& samplers) |
35 : fPB(pb) | 36 : fXPFragBuilder(fragBuilder) |
36 , fXPFragBuilder(fragBuilder) | 37 , fUniformHandler(uniformHandler) |
37 , fGLSLCaps(caps) | 38 , fGLSLCaps(caps) |
38 , fXP(xp) | 39 , fXP(xp) |
39 , fInputColor(inputColor) | 40 , fInputColor(inputColor) |
40 , fInputCoverage(inputCoverage) | 41 , fInputCoverage(inputCoverage) |
41 , fOutputPrimary(outputPrimary) | 42 , fOutputPrimary(outputPrimary) |
42 , fOutputSecondary(outputSecondary) | 43 , fOutputSecondary(outputSecondary) |
43 , fSamplers(samplers) {} | 44 , fSamplers(samplers) {} |
44 | 45 |
45 GrGLSLXPBuilder* fPB; | |
46 GrGLSLXPFragmentBuilder* fXPFragBuilder; | 46 GrGLSLXPFragmentBuilder* fXPFragBuilder; |
| 47 GrGLSLUniformHandler* fUniformHandler; |
47 const GrGLSLCaps* fGLSLCaps; | 48 const GrGLSLCaps* fGLSLCaps; |
48 const GrXferProcessor& fXP; | 49 const GrXferProcessor& fXP; |
49 const char* fInputColor; | 50 const char* fInputColor; |
50 const char* fInputCoverage; | 51 const char* fInputCoverage; |
51 const char* fOutputPrimary; | 52 const char* fOutputPrimary; |
52 const char* fOutputSecondary; | 53 const char* fOutputSecondary; |
53 const TextureSamplerArray& fSamplers; | 54 const TextureSamplerArray& fSamplers; |
54 }; | 55 }; |
55 /** | 56 /** |
56 * This is similar to emitCode() in the base class, except it takes a full s
hader builder. | 57 * This is similar to emitCode() in the base class, except it takes a full s
hader builder. |
(...skipping 18 matching lines...) Expand all Loading... |
75 */ | 76 */ |
76 virtual void emitOutputsForBlendState(const EmitArgs&) { | 77 virtual void emitOutputsForBlendState(const EmitArgs&) { |
77 SkFAIL("emitOutputsForBlendState not implemented."); | 78 SkFAIL("emitOutputsForBlendState not implemented."); |
78 } | 79 } |
79 | 80 |
80 /** | 81 /** |
81 * Called by emitCode() when the XP will perform a dst read. This method onl
y needs to supply | 82 * Called by emitCode() when the XP will perform a dst read. This method onl
y needs to supply |
82 * the blending logic. The base class applies coverage. A subclass only need
s to implement this | 83 * the blending logic. The base class applies coverage. A subclass only need
s to implement this |
83 * method if it can construct a GrXferProcessor that reads the dst color. | 84 * method if it can construct a GrXferProcessor that reads the dst color. |
84 */ | 85 */ |
85 virtual void emitBlendCodeForDstRead(GrGLSLXPBuilder*, | 86 virtual void emitBlendCodeForDstRead(GrGLSLXPFragmentBuilder*, |
86 GrGLSLXPFragmentBuilder*, | 87 GrGLSLUniformHandler*, |
87 const char* srcColor, | 88 const char* srcColor, |
88 const char* srcCoverage, | 89 const char* srcCoverage, |
89 const char* dstColor, | 90 const char* dstColor, |
90 const char* outColor, | 91 const char* outColor, |
91 const char* outColorSecondary, | 92 const char* outColorSecondary, |
92 const GrXferProcessor&) { | 93 const GrXferProcessor&) { |
93 SkFAIL("emitBlendCodeForDstRead not implemented."); | 94 SkFAIL("emitBlendCodeForDstRead not implemented."); |
94 } | 95 } |
95 | 96 |
96 virtual void onSetData(const GrGLSLProgramDataManager&, const GrXferProcesso
r&) = 0; | 97 virtual void onSetData(const GrGLSLProgramDataManager&, const GrXferProcesso
r&) = 0; |
97 | 98 |
98 GrGLSLProgramDataManager::UniformHandle fDstTopLeftUni; | 99 GrGLSLProgramDataManager::UniformHandle fDstTopLeftUni; |
99 GrGLSLProgramDataManager::UniformHandle fDstScaleUni; | 100 GrGLSLProgramDataManager::UniformHandle fDstScaleUni; |
100 }; | 101 }; |
101 #endif | 102 #endif |
OLD | NEW |