| 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" |
| 11 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 11 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
| 12 #include "glsl/GrGLSLProgramBuilder.h" | 12 #include "glsl/GrGLSLUniformHandler.h" |
| 13 | 13 |
| 14 void GrGLSLFragmentProcessor::setData(const GrGLSLProgramDataManager& pdman, | 14 void GrGLSLFragmentProcessor::setData(const GrGLSLProgramDataManager& pdman, |
| 15 const GrFragmentProcessor& processor) { | 15 const GrFragmentProcessor& processor) { |
| 16 this->onSetData(pdman, processor); | 16 this->onSetData(pdman, processor); |
| 17 SkASSERT(fChildProcessors.count() == processor.numChildProcessors()); | 17 SkASSERT(fChildProcessors.count() == processor.numChildProcessors()); |
| 18 for (int i = 0; i < fChildProcessors.count(); ++i) { | 18 for (int i = 0; i < fChildProcessors.count(); ++i) { |
| 19 fChildProcessors[i]->setData(pdman, processor.childProcessor(i)); | 19 fChildProcessors[i]->setData(pdman, processor.childProcessor(i)); |
| 20 } | 20 } |
| 21 } | 21 } |
| 22 | 22 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 childCoords.push_back_n(childProc.numTransforms(), &args.fCoords[firstCo
ordAt]); | 86 childCoords.push_back_n(childProc.numTransforms(), &args.fCoords[firstCo
ordAt]); |
| 87 } | 87 } |
| 88 if (childProc.numTextures() > 0) { | 88 if (childProc.numTextures() > 0) { |
| 89 childSamplers.push_back_n(childProc.numTextures(), &args.fSamplers[first
SamplerAt]); | 89 childSamplers.push_back_n(childProc.numTextures(), &args.fSamplers[first
SamplerAt]); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // emit the code for the child in its own scope | 92 // emit the code for the child in its own scope |
| 93 fragBuilder->codeAppend("{\n"); | 93 fragBuilder->codeAppend("{\n"); |
| 94 fragBuilder->codeAppendf("// Child Index %d (mangle: %s): %s\n", childIndex, | 94 fragBuilder->codeAppendf("// Child Index %d (mangle: %s): %s\n", childIndex, |
| 95 fragBuilder->getMangleString().c_str(), childProc.n
ame()); | 95 fragBuilder->getMangleString().c_str(), childProc.n
ame()); |
| 96 EmitArgs childArgs(args.fBuilder, | 96 EmitArgs childArgs(fragBuilder, |
| 97 fragBuilder, | 97 args.fUniformHandler, |
| 98 args.fGLSLCaps, | 98 args.fGLSLCaps, |
| 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 |