| 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 GrGLSLFPBuilder; | 17 class GrGLSLFPBuilder; |
| 18 class GrGLSLFragmentBuilder; |
| 18 class GrGLSLCaps; | 19 class GrGLSLCaps; |
| 19 | 20 |
| 20 class GrGLSLFragmentProcessor { | 21 class GrGLSLFragmentProcessor { |
| 21 public: | 22 public: |
| 22 GrGLSLFragmentProcessor() {} | 23 GrGLSLFragmentProcessor() {} |
| 23 | 24 |
| 24 virtual ~GrGLSLFragmentProcessor() { | 25 virtual ~GrGLSLFragmentProcessor() { |
| 25 for (int i = 0; i < fChildProcessors.count(); ++i) { | 26 for (int i = 0; i < fChildProcessors.count(); ++i) { |
| 26 delete fChildProcessors[i]; | 27 delete fChildProcessors[i]; |
| 27 } | 28 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 44 TODO: Better system for communicating optimization i
nfo (e.g. input | 45 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 | 46 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. | 47 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 | 48 @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 | 49 can be passed to the builder to emit texture reads i
n the generated |
| 49 code. | 50 code. |
| 50 */ | 51 */ |
| 51 | 52 |
| 52 struct EmitArgs { | 53 struct EmitArgs { |
| 53 EmitArgs(GrGLSLFPBuilder* builder, | 54 EmitArgs(GrGLSLFPBuilder* builder, |
| 55 GrGLSLFragmentBuilder* fragBuilder, |
| 54 const GrFragmentProcessor& fp, | 56 const GrFragmentProcessor& fp, |
| 55 const char* outputColor, | 57 const char* outputColor, |
| 56 const char* inputColor, | 58 const char* inputColor, |
| 57 const GrGLSLTransformedCoordsArray& coords, | 59 const GrGLSLTransformedCoordsArray& coords, |
| 58 const TextureSamplerArray& samplers) | 60 const TextureSamplerArray& samplers) |
| 59 : fBuilder(builder) | 61 : fBuilder(builder) |
| 62 , fFragBuilder(fragBuilder) |
| 60 , fFp(fp) | 63 , fFp(fp) |
| 61 , fOutputColor(outputColor) | 64 , fOutputColor(outputColor) |
| 62 , fInputColor(inputColor) | 65 , fInputColor(inputColor) |
| 63 , fCoords(coords) | 66 , fCoords(coords) |
| 64 , fSamplers(samplers) {} | 67 , fSamplers(samplers) {} |
| 65 GrGLSLFPBuilder* fBuilder; | 68 GrGLSLFPBuilder* fBuilder; |
| 69 GrGLSLFragmentBuilder* fFragBuilder; |
| 66 const GrFragmentProcessor& fFp; | 70 const GrFragmentProcessor& fFp; |
| 67 const char* fOutputColor; | 71 const char* fOutputColor; |
| 68 const char* fInputColor; | 72 const char* fInputColor; |
| 69 const GrGLSLTransformedCoordsArray& fCoords; | 73 const GrGLSLTransformedCoordsArray& fCoords; |
| 70 const TextureSamplerArray& fSamplers; | 74 const TextureSamplerArray& fSamplers; |
| 71 }; | 75 }; |
| 72 | 76 |
| 73 virtual void emitCode(EmitArgs&) = 0; | 77 virtual void emitCode(EmitArgs&) = 0; |
| 74 | 78 |
| 75 void setData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcesso
r& processor); | 79 void setData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcesso
r& processor); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 111 |
| 108 private: | 112 private: |
| 109 void internalEmitChild(int, const char*, const char*, EmitArgs&); | 113 void internalEmitChild(int, const char*, const char*, EmitArgs&); |
| 110 | 114 |
| 111 SkTArray<GrGLSLFragmentProcessor*, true> fChildProcessors; | 115 SkTArray<GrGLSLFragmentProcessor*, true> fChildProcessors; |
| 112 | 116 |
| 113 friend class GrFragmentProcessor; | 117 friend class GrFragmentProcessor; |
| 114 }; | 118 }; |
| 115 | 119 |
| 116 #endif | 120 #endif |
| OLD | NEW |