Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: src/gpu/gl/GrGLFragmentProcessor.cpp

Issue 1362873002: Mangle output var in GrGLFragmentProcessor::emitChild (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLFragmentProcessor.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrGLFragmentProcessor.h" 8 #include "GrGLFragmentProcessor.h"
9 #include "GrFragmentProcessor.h" 9 #include "GrFragmentProcessor.h"
10 #include "builders/GrGLFragmentShaderBuilder.h" 10 #include "builders/GrGLFragmentShaderBuilder.h"
11 #include "builders/GrGLProgramBuilder.h" 11 #include "builders/GrGLProgramBuilder.h"
12 12
13 void GrGLFragmentProcessor::setData(const GrGLProgramDataManager& pdman, 13 void GrGLFragmentProcessor::setData(const GrGLProgramDataManager& pdman,
14 const GrFragmentProcessor& processor) { 14 const GrFragmentProcessor& processor) {
15 this->onSetData(pdman, processor); 15 this->onSetData(pdman, processor);
16 SkASSERT(fChildProcessors.count() == processor.numChildProcessors()); 16 SkASSERT(fChildProcessors.count() == processor.numChildProcessors());
17 for (int i = 0; i < fChildProcessors.count(); ++i) { 17 for (int i = 0; i < fChildProcessors.count(); ++i) {
18 fChildProcessors[i]->setData(pdman, processor.childProcessor(i)); 18 fChildProcessors[i]->setData(pdman, processor.childProcessor(i));
19 } 19 }
20 } 20 }
21 21
22 void GrGLFragmentProcessor::emitChild(int childIndex, const char* inputColor, Em itArgs& args) {
23 this->internalEmitChild(childIndex, inputColor, args.fOutputColor, args);
24 }
25
22 void GrGLFragmentProcessor::emitChild(int childIndex, const char* inputColor, 26 void GrGLFragmentProcessor::emitChild(int childIndex, const char* inputColor,
23 const char* outputColor, EmitArgs& args) { 27 SkString* outputColor, EmitArgs& args) {
28
29 SkASSERT(outputColor);
24 GrGLFragmentBuilder* fb = args.fBuilder->getFragmentShaderBuilder(); 30 GrGLFragmentBuilder* fb = args.fBuilder->getFragmentShaderBuilder();
31 outputColor->append(fb->getMangleString());
32 fb->codeAppendf("vec4 %s;", outputColor->c_str());
33 this->internalEmitChild(childIndex, inputColor, outputColor->c_str(), args);
34 }
35
36 void GrGLFragmentProcessor::internalEmitChild(int childIndex, const char* inputC olor,
37 const char* outputColor, EmitArgs & args) {
38 GrGLFragmentBuilder* fb = args.fBuilder->getFragmentShaderBuilder();
39
25 fb->onBeforeChildProcEmitCode(); // call first so mangleString is updated 40 fb->onBeforeChildProcEmitCode(); // call first so mangleString is updated
26 41
27 const GrFragmentProcessor& childProc = args.fFp.childProcessor(childIndex); 42 const GrFragmentProcessor& childProc = args.fFp.childProcessor(childIndex);
28 43
29 /* 44 /*
30 * We now want to find the subset of coords and samplers that belong to the child and its 45 * We now want to find the subset of coords and samplers that belong to the child and its
31 * descendants and put that into childCoords and childSamplers. To do so, we 'll do a forwards 46 * descendants and put that into childCoords and childSamplers. To do so, we 'll do a forwards
32 * linear search. 47 * linear search.
33 * 48 *
34 * Explanation: 49 * Explanation:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 childProc, 96 childProc,
82 outputColor, 97 outputColor,
83 inputColor, 98 inputColor,
84 childCoords, 99 childCoords,
85 childSamplers); 100 childSamplers);
86 this->childProcessor(childIndex)->emitCode(childArgs); 101 this->childProcessor(childIndex)->emitCode(childArgs);
87 fb->codeAppend("}\n"); 102 fb->codeAppend("}\n");
88 103
89 fb->onAfterChildProcEmitCode(); 104 fb->onAfterChildProcEmitCode();
90 } 105 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLFragmentProcessor.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698