| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 * 4 after the start of A's transforms. | 74 * 4 after the start of A's transforms. |
| 75 * Textures work the same way as transforms. | 75 * Textures work the same way as transforms. |
| 76 */ | 76 */ |
| 77 int firstCoordAt = args.fFp.numTransformsExclChildren(); | 77 int firstCoordAt = args.fFp.numTransformsExclChildren(); |
| 78 int firstSamplerAt = args.fFp.numTexturesExclChildren(); | 78 int firstSamplerAt = args.fFp.numTexturesExclChildren(); |
| 79 for (int i = 0; i < childIndex; ++i) { | 79 for (int i = 0; i < childIndex; ++i) { |
| 80 firstCoordAt += args.fFp.childProcessor(i).numTransforms(); | 80 firstCoordAt += args.fFp.childProcessor(i).numTransforms(); |
| 81 firstSamplerAt += args.fFp.childProcessor(i).numTextures(); | 81 firstSamplerAt += args.fFp.childProcessor(i).numTextures(); |
| 82 } | 82 } |
| 83 GrGLSLTransformedCoordsArray childCoords; | 83 GrGLSLTransformedCoordsArray childCoords; |
| 84 TextureSamplerArray childSamplers; | 84 SamplerArray childTexSamplers; |
| 85 if (childProc.numTransforms() > 0) { | 85 if (childProc.numTransforms() > 0) { |
| 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 childTexSamplers.push_back_n(childProc.numTextures(), &args.fTexSamplers
[firstSamplerAt]); |
| 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(fragBuilder, | 96 EmitArgs childArgs(fragBuilder, |
| 97 args.fUniformHandler, | 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 childTexSamplers); |
| 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 |