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

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

Issue 1885863004: Refactor how we store and use samplers in Ganesh (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unneeded assert Created 4 years, 8 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/glsl/GrGLSLFragmentProcessor.h ('k') | src/gpu/glsl/GrGLSLPrimitiveProcessor.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 "GrGLSLFragmentProcessor.h" 8 #include "GrGLSLFragmentProcessor.h"
9 #include "GrFragmentProcessor.h" 9 #include "GrFragmentProcessor.h"
10 #include "GrProcessor.h" 10 #include "GrProcessor.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 */ 76 */
77 int firstCoordAt = args.fFp.numTransformsExclChildren(); 77 int firstCoordAt = args.fFp.numTransformsExclChildren();
78 int firstTextureAt = args.fFp.numTexturesExclChildren(); 78 int firstTextureAt = args.fFp.numTexturesExclChildren();
79 int firstBufferAt = args.fFp.numBuffersExclChildren(); 79 int firstBufferAt = args.fFp.numBuffersExclChildren();
80 for (int i = 0; i < childIndex; ++i) { 80 for (int i = 0; i < childIndex; ++i) {
81 firstCoordAt += args.fFp.childProcessor(i).numTransforms(); 81 firstCoordAt += args.fFp.childProcessor(i).numTransforms();
82 firstTextureAt += args.fFp.childProcessor(i).numTextures(); 82 firstTextureAt += args.fFp.childProcessor(i).numTextures();
83 firstBufferAt += args.fFp.childProcessor(i).numBuffers(); 83 firstBufferAt += args.fFp.childProcessor(i).numBuffers();
84 } 84 }
85 GrGLSLTransformedCoordsArray childCoords; 85 GrGLSLTransformedCoordsArray childCoords;
86 SamplerArray childTexSamplers; 86 const SamplerHandle* childTexSamplers = nullptr;
87 SamplerArray childBufferSamplers; 87 const SamplerHandle* childBufferSamplers = nullptr;
88 if (childProc.numTransforms() > 0) { 88 if (childProc.numTransforms() > 0) {
89 childCoords.push_back_n(childProc.numTransforms(), &args.fCoords[firstCo ordAt]); 89 childCoords.push_back_n(childProc.numTransforms(), &args.fCoords[firstCo ordAt]);
90 } 90 }
91 if (childProc.numTextures() > 0) { 91 if (childProc.numTextures() > 0) {
92 childTexSamplers.push_back_n(childProc.numTextures(), &args.fTexSamplers [firstTextureAt]); 92 childTexSamplers = &args.fTexSamplers[firstTextureAt];
93 } 93 }
94 if (childProc.numBuffers() > 0) { 94 if (childProc.numBuffers() > 0) {
95 childBufferSamplers.push_back_n(childProc.numBuffers(), 95 childBufferSamplers = &args.fBufferSamplers[firstBufferAt];
96 &args.fBufferSamplers[firstBufferAt]);
97 } 96 }
98 97
99 // emit the code for the child in its own scope 98 // emit the code for the child in its own scope
100 fragBuilder->codeAppend("{\n"); 99 fragBuilder->codeAppend("{\n");
101 fragBuilder->codeAppendf("// Child Index %d (mangle: %s): %s\n", childIndex, 100 fragBuilder->codeAppendf("// Child Index %d (mangle: %s): %s\n", childIndex,
102 fragBuilder->getMangleString().c_str(), childProc.n ame()); 101 fragBuilder->getMangleString().c_str(), childProc.n ame());
103 EmitArgs childArgs(fragBuilder, 102 EmitArgs childArgs(fragBuilder,
104 args.fUniformHandler, 103 args.fUniformHandler,
105 args.fGLSLCaps, 104 args.fGLSLCaps,
106 childProc, 105 childProc,
107 outputColor, 106 outputColor,
108 inputColor, 107 inputColor,
109 childCoords, 108 childCoords,
110 childTexSamplers, 109 childTexSamplers,
111 childBufferSamplers); 110 childBufferSamplers);
112 this->childProcessor(childIndex)->emitCode(childArgs); 111 this->childProcessor(childIndex)->emitCode(childArgs);
113 fragBuilder->codeAppend("}\n"); 112 fragBuilder->codeAppend("}\n");
114 113
115 fragBuilder->onAfterChildProcEmitCode(); 114 fragBuilder->onAfterChildProcEmitCode();
116 } 115 }
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLFragmentProcessor.h ('k') | src/gpu/glsl/GrGLSLPrimitiveProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698