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

Side by Side Diff: src/gpu/glsl/GrGLSLFragmentProcessor.cpp

Issue 1434313002: Make all GrFragmentProcessors GL independent. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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/glsl/GrGLSLFragmentProcessor.h ('k') | src/gpu/glsl/GrGLSLUtil.h » ('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 "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/GrGLSLProgramBuilder.h"
13 13
14 void GrGLFragmentProcessor::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
23 void GrGLFragmentProcessor::emitChild(int childIndex, const char* inputColor, Em itArgs& 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 GrGLFragmentProcessor::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* fb = args.fBuilder->getFragmentShaderBuilder(); 31 GrGLSLFragmentBuilder* fb = args.fBuilder->getFragmentShaderBuilder();
32 outputColor->append(fb->getMangleString()); 32 outputColor->append(fb->getMangleString());
33 fb->codeAppendf("vec4 %s;", outputColor->c_str()); 33 fb->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 GrGLFragmentProcessor::internalEmitChild(int childIndex, const char* inputC olor, 37 void GrGLSLFragmentProcessor::internalEmitChild(int childIndex, const char* inpu tColor,
38 const char* outputColor, EmitArgs & args) { 38 const char* outputColor, EmitArg s& args) {
39 GrGLSLFragmentBuilder* fb = args.fBuilder->getFragmentShaderBuilder(); 39 GrGLSLFragmentBuilder* fb = args.fBuilder->getFragmentShaderBuilder();
40 40
41 fb->onBeforeChildProcEmitCode(); // call first so mangleString is updated 41 fb->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.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 childProc, 97 childProc,
98 outputColor, 98 outputColor,
99 inputColor, 99 inputColor,
100 childCoords, 100 childCoords,
101 childSamplers); 101 childSamplers);
102 this->childProcessor(childIndex)->emitCode(childArgs); 102 this->childProcessor(childIndex)->emitCode(childArgs);
103 fb->codeAppend("}\n"); 103 fb->codeAppend("}\n");
104 104
105 fb->onAfterChildProcEmitCode(); 105 fb->onAfterChildProcEmitCode();
106 } 106 }
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLFragmentProcessor.h ('k') | src/gpu/glsl/GrGLSLUtil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698