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 GrGLFragmentProcessor_DEFINED | 8 #ifndef GrGLFragmentProcessor_DEFINED |
9 #define GrGLFragmentProcessor_DEFINED | 9 #define GrGLFragmentProcessor_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 GrGLFPBuilder; | 17 class GrGLSLFPBuilder; |
18 class GrGLSLCaps; | 18 class GrGLSLCaps; |
19 | 19 |
20 class GrGLFragmentProcessor { | 20 class GrGLFragmentProcessor { |
21 public: | 21 public: |
22 GrGLFragmentProcessor() {} | 22 GrGLFragmentProcessor() {} |
23 | 23 |
24 virtual ~GrGLFragmentProcessor() { | 24 virtual ~GrGLFragmentProcessor() { |
25 for (int i = 0; i < fChildProcessors.count(); ++i) { | 25 for (int i = 0; i < fChildProcessors.count(); ++i) { |
26 delete fChildProcessors[i]; | 26 delete fChildProcessors[i]; |
27 } | 27 } |
(...skipping 15 matching lines...) Expand all Loading... |
43 nullptr in which case the implied input is solid whi
te (all ones). | 43 nullptr in which case the implied input is solid whi
te (all ones). |
44 TODO: Better system for communicating optimization i
nfo (e.g. input | 44 TODO: Better system for communicating optimization i
nfo (e.g. input |
45 color is solid white, trans black, known to be opaqu
e, etc.) that allows | 45 color is solid white, trans black, known to be opaqu
e, etc.) that allows |
46 the processor to communicate back similar known info
about its output. | 46 the processor to communicate back similar known info
about its output. |
47 @param samplers Contains one entry for each GrTextureAccess of the G
rProcessor. These | 47 @param samplers Contains one entry for each GrTextureAccess of the G
rProcessor. These |
48 can be passed to the builder to emit texture reads i
n the generated | 48 can be passed to the builder to emit texture reads i
n the generated |
49 code. | 49 code. |
50 */ | 50 */ |
51 | 51 |
52 struct EmitArgs { | 52 struct EmitArgs { |
53 EmitArgs(GrGLFPBuilder* builder, | 53 EmitArgs(GrGLSLFPBuilder* builder, |
54 const GrFragmentProcessor& fp, | 54 const GrFragmentProcessor& fp, |
55 const char* outputColor, | 55 const char* outputColor, |
56 const char* inputColor, | 56 const char* inputColor, |
57 const GrGLSLTransformedCoordsArray& coords, | 57 const GrGLSLTransformedCoordsArray& coords, |
58 const TextureSamplerArray& samplers) | 58 const TextureSamplerArray& samplers) |
59 : fBuilder(builder) | 59 : fBuilder(builder) |
60 , fFp(fp) | 60 , fFp(fp) |
61 , fOutputColor(outputColor) | 61 , fOutputColor(outputColor) |
62 , fInputColor(inputColor) | 62 , fInputColor(inputColor) |
63 , fCoords(coords) | 63 , fCoords(coords) |
64 , fSamplers(samplers) {} | 64 , fSamplers(samplers) {} |
65 GrGLFPBuilder* fBuilder; | 65 GrGLSLFPBuilder* fBuilder; |
66 const GrFragmentProcessor& fFp; | 66 const GrFragmentProcessor& fFp; |
67 const char* fOutputColor; | 67 const char* fOutputColor; |
68 const char* fInputColor; | 68 const char* fInputColor; |
69 const GrGLSLTransformedCoordsArray& fCoords; | 69 const GrGLSLTransformedCoordsArray& fCoords; |
70 const TextureSamplerArray& fSamplers; | 70 const TextureSamplerArray& fSamplers; |
71 }; | 71 }; |
72 | 72 |
73 virtual void emitCode(EmitArgs&) = 0; | 73 virtual void emitCode(EmitArgs&) = 0; |
74 | 74 |
75 void setData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcesso
r& processor); | 75 void setData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcesso
r& processor); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 private: | 108 private: |
109 void internalEmitChild(int, const char*, const char*, EmitArgs&); | 109 void internalEmitChild(int, const char*, const char*, EmitArgs&); |
110 | 110 |
111 SkTArray<GrGLFragmentProcessor*, true> fChildProcessors; | 111 SkTArray<GrGLFragmentProcessor*, true> fChildProcessors; |
112 | 112 |
113 friend class GrFragmentProcessor; | 113 friend class GrFragmentProcessor; |
114 }; | 114 }; |
115 | 115 |
116 #endif | 116 #endif |
OLD | NEW |