| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #include "GrGLSLFragmentProcessor.h" | 8 #include "GrGLSLFragmentProcessor.h" |
| 9 #include "GrFragmentProcessor.h" | 9 #include "GrFragmentProcessor.h" |
| 10 #include "GrProcessor.h" | 10 #include "GrProcessor.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 } | 21 } |
| 22 | 22 |
| 23 void GrGLSLFragmentProcessor::emitChild(int childIndex, const char* inputColor,
EmitArgs& args) { | 23 void GrGLSLFragmentProcessor::emitChild(int childIndex, const char* inputColor,
EmitArgs& args) { |
| 24 this->internalEmitChild(childIndex, inputColor, args.fOutputColor, args); | 24 this->internalEmitChild(childIndex, inputColor, args.fOutputColor, args); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void GrGLSLFragmentProcessor::emitChild(int childIndex, const char* inputColor, | 27 void GrGLSLFragmentProcessor::emitChild(int childIndex, const char* inputColor, |
| 28 SkString* outputColor, EmitArgs& args) { | 28 SkString* outputColor, EmitArgs& args) { |
| 29 | 29 |
| 30 SkASSERT(outputColor); | 30 SkASSERT(outputColor); |
| 31 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; | 31 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; |
| 32 outputColor->append(fragBuilder->getMangleString()); | 32 outputColor->append(fragBuilder->getMangleString()); |
| 33 fragBuilder->codeAppendf("vec4 %s;", outputColor->c_str()); | 33 fragBuilder->codeAppendf("vec4 %s;", outputColor->c_str()); |
| 34 this->internalEmitChild(childIndex, inputColor, outputColor->c_str(), args); | 34 this->internalEmitChild(childIndex, inputColor, outputColor->c_str(), args); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void GrGLSLFragmentProcessor::internalEmitChild(int childIndex, const char* inpu
tColor, | 37 void GrGLSLFragmentProcessor::internalEmitChild(int childIndex, const char* inpu
tColor, |
| 38 const char* outputColor, EmitArg
s& args) { | 38 const char* outputColor, EmitArg
s& args) { |
| 39 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; | 39 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; |
| 40 | 40 |
| 41 fragBuilder->onBeforeChildProcEmitCode(); // call first so mangleString is
updated | 41 fragBuilder->onBeforeChildProcEmitCode(); // call first so mangleString is
updated |
| 42 | 42 |
| 43 const GrFragmentProcessor& childProc = args.fFp.childProcessor(childIndex); | 43 const GrFragmentProcessor& childProc = args.fFp.childProcessor(childIndex); |
| 44 | 44 |
| 45 /* | 45 /* |
| 46 * We now want to find the subset of coords and samplers that belong to the
child and its | 46 * We now want to find the subset of coords and samplers that belong to the
child and its |
| 47 * descendants and put that into childCoords and childSamplers. To do so, we
'll do a forwards | 47 * descendants and put that into childCoords and childSamplers. To do so, we
'll do a forwards |
| 48 * linear search. | 48 * linear search. |
| 49 * | 49 * |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 childProc, | 99 childProc, |
| 100 outputColor, | 100 outputColor, |
| 101 inputColor, | 101 inputColor, |
| 102 childCoords, | 102 childCoords, |
| 103 childSamplers); | 103 childSamplers); |
| 104 this->childProcessor(childIndex)->emitCode(childArgs); | 104 this->childProcessor(childIndex)->emitCode(childArgs); |
| 105 fragBuilder->codeAppend("}\n"); | 105 fragBuilder->codeAppend("}\n"); |
| 106 | 106 |
| 107 fragBuilder->onAfterChildProcEmitCode(); | 107 fragBuilder->onAfterChildProcEmitCode(); |
| 108 } | 108 } |
| OLD | NEW |