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