| 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 GrGLSLCaps; |
| 18 class GrGLSLFPBuilder; | 18 class GrGLSLFPBuilder; |
| 19 class GrGLSLFragmentBuilder; | 19 class GrGLSLFPFragmentBuilder; |
| 20 class GrGLSLUniformHandler; | 20 class GrGLSLUniformHandler; |
| 21 | 21 |
| 22 class GrGLSLFragmentProcessor { | 22 class GrGLSLFragmentProcessor { |
| 23 public: | 23 public: |
| 24 GrGLSLFragmentProcessor() {} | 24 GrGLSLFragmentProcessor() {} |
| 25 | 25 |
| 26 virtual ~GrGLSLFragmentProcessor() { | 26 virtual ~GrGLSLFragmentProcessor() { |
| 27 for (int i = 0; i < fChildProcessors.count(); ++i) { | 27 for (int i = 0; i < fChildProcessors.count(); ++i) { |
| 28 delete fChildProcessors[i]; | 28 delete fChildProcessors[i]; |
| 29 } | 29 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 45 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). |
| 46 TODO: Better system for communicating optimization i
nfo (e.g. input | 46 TODO: Better system for communicating optimization i
nfo (e.g. input |
| 47 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 |
| 48 the processor to communicate back similar known info
about its output. | 48 the processor to communicate back similar known info
about its output. |
| 49 @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 |
| 50 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 |
| 51 code. | 51 code. |
| 52 */ | 52 */ |
| 53 | 53 |
| 54 struct EmitArgs { | 54 struct EmitArgs { |
| 55 EmitArgs(GrGLSLFragmentBuilder* fragBuilder, | 55 EmitArgs(GrGLSLFPFragmentBuilder* fragBuilder, |
| 56 GrGLSLUniformHandler* uniformHandler, | 56 GrGLSLUniformHandler* uniformHandler, |
| 57 const GrGLSLCaps* caps, | 57 const GrGLSLCaps* caps, |
| 58 const GrFragmentProcessor& fp, | 58 const GrFragmentProcessor& fp, |
| 59 const char* outputColor, | 59 const char* outputColor, |
| 60 const char* inputColor, | 60 const char* inputColor, |
| 61 const GrGLSLTransformedCoordsArray& coords, | 61 const GrGLSLTransformedCoordsArray& coords, |
| 62 const TextureSamplerArray& samplers) | 62 const TextureSamplerArray& samplers) |
| 63 : fFragBuilder(fragBuilder) | 63 : fFragBuilder(fragBuilder) |
| 64 , fUniformHandler(uniformHandler) | 64 , fUniformHandler(uniformHandler) |
| 65 , fGLSLCaps(caps) | 65 , fGLSLCaps(caps) |
| 66 , fFp(fp) | 66 , fFp(fp) |
| 67 , fOutputColor(outputColor) | 67 , fOutputColor(outputColor) |
| 68 , fInputColor(inputColor) | 68 , fInputColor(inputColor) |
| 69 , fCoords(coords) | 69 , fCoords(coords) |
| 70 , fSamplers(samplers) {} | 70 , fSamplers(samplers) {} |
| 71 GrGLSLFragmentBuilder* fFragBuilder; | 71 GrGLSLFPFragmentBuilder* fFragBuilder; |
| 72 GrGLSLUniformHandler* fUniformHandler; | 72 GrGLSLUniformHandler* fUniformHandler; |
| 73 const GrGLSLCaps* fGLSLCaps; | 73 const GrGLSLCaps* fGLSLCaps; |
| 74 const GrFragmentProcessor& fFp; | 74 const GrFragmentProcessor& fFp; |
| 75 const char* fOutputColor; | 75 const char* fOutputColor; |
| 76 const char* fInputColor; | 76 const char* fInputColor; |
| 77 const GrGLSLTransformedCoordsArray& fCoords; | 77 const GrGLSLTransformedCoordsArray& fCoords; |
| 78 const TextureSamplerArray& fSamplers; | 78 const TextureSamplerArray& fSamplers; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 virtual void emitCode(EmitArgs&) = 0; | 81 virtual void emitCode(EmitArgs&) = 0; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 void internalEmitChild(int, const char*, const char*, EmitArgs&); | 117 void internalEmitChild(int, const char*, const char*, EmitArgs&); |
| 118 | 118 |
| 119 SkTArray<GrGLSLFragmentProcessor*, true> fChildProcessors; | 119 SkTArray<GrGLSLFragmentProcessor*, true> fChildProcessors; |
| 120 | 120 |
| 121 friend class GrFragmentProcessor; | 121 friend class GrFragmentProcessor; |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 #endif | 124 #endif |
| OLD | NEW |