OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrGLSLFragmentProcessor_DEFINED | 8 #ifndef GrGLSLFragmentProcessor_DEFINED |
9 #define GrGLSLFragmentProcessor_DEFINED | 9 #define GrGLSLFragmentProcessor_DEFINED |
10 | 10 |
11 #include "glsl/GrGLSLProcessorTypes.h" | 11 #include "glsl/GrGLSLProcessorTypes.h" |
12 #include "glsl/GrGLSLProgramDataManager.h" | 12 #include "glsl/GrGLSLProgramDataManager.h" |
13 #include "glsl/GrGLSLTextureSampler.h" | 13 #include "glsl/GrGLSLTextureSampler.h" |
14 | 14 |
15 class GrProcessor; | 15 class GrProcessor; |
16 class GrProcessorKeyBuilder; | 16 class GrProcessorKeyBuilder; |
| 17 class GrGLSLCaps; |
17 class GrGLSLFPBuilder; | 18 class GrGLSLFPBuilder; |
18 class GrGLSLFragmentBuilder; | 19 class GrGLSLFragmentBuilder; |
19 class GrGLSLCaps; | 20 class GrGLSLUniformHandler; |
20 | 21 |
21 class GrGLSLFragmentProcessor { | 22 class GrGLSLFragmentProcessor { |
22 public: | 23 public: |
23 GrGLSLFragmentProcessor() {} | 24 GrGLSLFragmentProcessor() {} |
24 | 25 |
25 virtual ~GrGLSLFragmentProcessor() { | 26 virtual ~GrGLSLFragmentProcessor() { |
26 for (int i = 0; i < fChildProcessors.count(); ++i) { | 27 for (int i = 0; i < fChildProcessors.count(); ++i) { |
27 delete fChildProcessors[i]; | 28 delete fChildProcessors[i]; |
28 } | 29 } |
29 } | 30 } |
(...skipping 14 matching lines...) Expand all Loading... |
44 nullptr in which case the implied input is solid whi
te (all ones). | 45 nullptr in which case the implied input is solid whi
te (all ones). |
45 TODO: Better system for communicating optimization i
nfo (e.g. input | 46 TODO: Better system for communicating optimization i
nfo (e.g. input |
46 color is solid white, trans black, known to be opaqu
e, etc.) that allows | 47 color is solid white, trans black, known to be opaqu
e, etc.) that allows |
47 the processor to communicate back similar known info
about its output. | 48 the processor to communicate back similar known info
about its output. |
48 @param samplers Contains one entry for each GrTextureAccess of the G
rProcessor. These | 49 @param samplers Contains one entry for each GrTextureAccess of the G
rProcessor. These |
49 can be passed to the builder to emit texture reads i
n the generated | 50 can be passed to the builder to emit texture reads i
n the generated |
50 code. | 51 code. |
51 */ | 52 */ |
52 | 53 |
53 struct EmitArgs { | 54 struct EmitArgs { |
54 EmitArgs(GrGLSLFPBuilder* builder, | 55 EmitArgs(GrGLSLFragmentBuilder* fragBuilder, |
55 GrGLSLFragmentBuilder* fragBuilder, | 56 GrGLSLUniformHandler* uniformHandler, |
56 const GrGLSLCaps* caps, | 57 const GrGLSLCaps* caps, |
57 const GrFragmentProcessor& fp, | 58 const GrFragmentProcessor& fp, |
58 const char* outputColor, | 59 const char* outputColor, |
59 const char* inputColor, | 60 const char* inputColor, |
60 const GrGLSLTransformedCoordsArray& coords, | 61 const GrGLSLTransformedCoordsArray& coords, |
61 const TextureSamplerArray& samplers) | 62 const TextureSamplerArray& samplers) |
62 : fBuilder(builder) | 63 : fFragBuilder(fragBuilder) |
63 , fFragBuilder(fragBuilder) | 64 , fUniformHandler(uniformHandler) |
64 , fGLSLCaps(caps) | 65 , fGLSLCaps(caps) |
65 , fFp(fp) | 66 , fFp(fp) |
66 , fOutputColor(outputColor) | 67 , fOutputColor(outputColor) |
67 , fInputColor(inputColor) | 68 , fInputColor(inputColor) |
68 , fCoords(coords) | 69 , fCoords(coords) |
69 , fSamplers(samplers) {} | 70 , fSamplers(samplers) {} |
70 GrGLSLFPBuilder* fBuilder; | |
71 GrGLSLFragmentBuilder* fFragBuilder; | 71 GrGLSLFragmentBuilder* fFragBuilder; |
| 72 GrGLSLUniformHandler* fUniformHandler; |
72 const GrGLSLCaps* fGLSLCaps; | 73 const GrGLSLCaps* fGLSLCaps; |
73 const GrFragmentProcessor& fFp; | 74 const GrFragmentProcessor& fFp; |
74 const char* fOutputColor; | 75 const char* fOutputColor; |
75 const char* fInputColor; | 76 const char* fInputColor; |
76 const GrGLSLTransformedCoordsArray& fCoords; | 77 const GrGLSLTransformedCoordsArray& fCoords; |
77 const TextureSamplerArray& fSamplers; | 78 const TextureSamplerArray& fSamplers; |
78 }; | 79 }; |
79 | 80 |
80 virtual void emitCode(EmitArgs&) = 0; | 81 virtual void emitCode(EmitArgs&) = 0; |
81 | 82 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 115 |
115 private: | 116 private: |
116 void internalEmitChild(int, const char*, const char*, EmitArgs&); | 117 void internalEmitChild(int, const char*, const char*, EmitArgs&); |
117 | 118 |
118 SkTArray<GrGLSLFragmentProcessor*, true> fChildProcessors; | 119 SkTArray<GrGLSLFragmentProcessor*, true> fChildProcessors; |
119 | 120 |
120 friend class GrFragmentProcessor; | 121 friend class GrFragmentProcessor; |
121 }; | 122 }; |
122 | 123 |
123 #endif | 124 #endif |
OLD | NEW |