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 "GrGLProcessor.h" | 11 #include "GrGLProcessor.h" |
12 | 12 |
13 class GrGLXPBuilder; | 13 class GrGLXPBuilder; |
| 14 class GrXferProcessor; |
14 | 15 |
15 class GrGLXferProcessor { | 16 class GrGLXferProcessor { |
16 public: | 17 public: |
17 GrGLXferProcessor() {} | 18 GrGLXferProcessor() {} |
18 virtual ~GrGLXferProcessor() {} | 19 virtual ~GrGLXferProcessor() {} |
19 | 20 |
20 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; | 21 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; |
21 struct EmitArgs { | 22 struct EmitArgs { |
22 EmitArgs(GrGLXPBuilder* pb, | 23 EmitArgs(GrGLXPBuilder* pb, |
23 const GrXferProcessor& xp, | 24 const GrXferProcessor& xp, |
(...skipping 15 matching lines...) Expand all Loading... |
39 const char* fInputColor; | 40 const char* fInputColor; |
40 const char* fInputCoverage; | 41 const char* fInputCoverage; |
41 const char* fOutputPrimary; | 42 const char* fOutputPrimary; |
42 const char* fOutputSecondary; | 43 const char* fOutputSecondary; |
43 const TextureSamplerArray& fSamplers; | 44 const TextureSamplerArray& fSamplers; |
44 }; | 45 }; |
45 /** | 46 /** |
46 * This is similar to emitCode() in the base class, except it takes a full s
hader builder. | 47 * This is similar to emitCode() in the base class, except it takes a full s
hader builder. |
47 * This allows the effect subclass to emit vertex code. | 48 * This allows the effect subclass to emit vertex code. |
48 */ | 49 */ |
49 virtual void emitCode(const EmitArgs&) = 0; | 50 void emitCode(const EmitArgs&); |
50 | 51 |
51 /** 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 |
52 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 |
53 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 |
54 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 |
55 to have an identical processor key as the one that created this GrGLXfer
Processor. */ | 56 to have an identical processor key as the one that created this GrGLXfer
Processor. This |
56 virtual void setData(const GrGLProgramDataManager&, | 57 function calls onSetData on the subclass of GrGLXferProcessor |
57 const GrXferProcessor&) = 0; | 58 */ |
| 59 void setData(const GrGLProgramDataManager& pdm, const GrXferProcessor& xp); |
| 60 |
58 private: | 61 private: |
| 62 virtual void onEmitCode(const EmitArgs&) = 0; |
| 63 |
| 64 virtual void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&
) = 0; |
| 65 |
| 66 GrGLProgramDataManager::UniformHandle fDstCopyTopLeftUni; |
| 67 GrGLProgramDataManager::UniformHandle fDstCopyScaleUni; |
| 68 |
59 typedef GrGLProcessor INHERITED; | 69 typedef GrGLProcessor INHERITED; |
60 }; | 70 }; |
61 #endif | 71 #endif |
OLD | NEW |