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

Side by Side Diff: src/gpu/GrProcessor.cpp

Issue 1298233002: Added fNumTransformsExclChildren and fNumTexturesExclChildren; changed emitChild() to forward search (Closed) Base URL: https://skia.googlesource.com/skia@cs3_emitchild
Patch Set: Created 5 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "GrProcessor.h" 8 #include "GrProcessor.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrCoordTransform.h" 10 #include "GrCoordTransform.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 GrGLFragmentProcessor* GrFragmentProcessor::createGLInstance() const { 160 GrGLFragmentProcessor* GrFragmentProcessor::createGLInstance() const {
161 GrGLFragmentProcessor* glFragProc = this->onCreateGLInstance(); 161 GrGLFragmentProcessor* glFragProc = this->onCreateGLInstance();
162 glFragProc->fChildProcessors.push_back_n(fChildProcessors.count()); 162 glFragProc->fChildProcessors.push_back_n(fChildProcessors.count());
163 for (int i = 0; i < fChildProcessors.count(); ++i) { 163 for (int i = 0; i < fChildProcessors.count(); ++i) {
164 glFragProc->fChildProcessors[i] = fChildProcessors[i].processor()->creat eGLInstance(); 164 glFragProc->fChildProcessors[i] = fChildProcessors[i].processor()->creat eGLInstance();
165 } 165 }
166 return glFragProc; 166 return glFragProc;
167 } 167 }
168 168
169 void GrFragmentProcessor::addTextureAccess(const GrTextureAccess* textureAccess) {
170 // Can't add texture accesses after registering any children since their tex ture accesses have
171 // already been bubbled up into our fTextureAccesses array
172 SkASSERT(fChildProcessors.empty());
173
174 INHERITED::addTextureAccess(textureAccess);
175 fNumTexturesExclChildren++;
176 }
177
169 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { 178 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) {
179 // Can't add transforms after registering any children since their transform s have already been
180 // bubbled up into our fCoordTransforms array
181 SkASSERT(fChildProcessors.empty());
182
170 fCoordTransforms.push_back(transform); 183 fCoordTransforms.push_back(transform);
171 fUsesLocalCoords = fUsesLocalCoords || transform->sourceCoords() == kLocal_G rCoordSet; 184 fUsesLocalCoords = fUsesLocalCoords || transform->sourceCoords() == kLocal_G rCoordSet;
172 SkDEBUGCODE(transform->setInProcessor();) 185 SkDEBUGCODE(transform->setInProcessor();)
186 fNumTransformsExclChildren++;
173 } 187 }
174 188
175 int GrFragmentProcessor::registerChildProcessor(const GrFragmentProcessor* child ) { 189 int GrFragmentProcessor::registerChildProcessor(const GrFragmentProcessor* child ) {
176 // Append the child's transforms to our transforms array and the child's tex tures array to our 190 // Append the child's transforms to our transforms array and the child's tex tures array to our
177 // textures array 191 // textures array
178 if (!child->fCoordTransforms.empty()) { 192 if (!child->fCoordTransforms.empty()) {
179 fCoordTransforms.push_back_n(child->fCoordTransforms.count(), 193 fCoordTransforms.push_back_n(child->fCoordTransforms.count(),
180 child->fCoordTransforms.begin()); 194 child->fCoordTransforms.begin());
181 } 195 }
182 if (!child->fTextureAccesses.empty()) { 196 if (!child->fTextureAccesses.empty()) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 //////////////////////////////////////////////////////////////////////////////// /////////////////// 234 //////////////////////////////////////////////////////////////////////////////// ///////////////////
221 235
222 // GrProcessorDataManager lives in the same pool 236 // GrProcessorDataManager lives in the same pool
223 void* GrProcessorDataManager::operator new(size_t size) { 237 void* GrProcessorDataManager::operator new(size_t size) {
224 return MemoryPoolAccessor().pool()->allocate(size); 238 return MemoryPoolAccessor().pool()->allocate(size);
225 } 239 }
226 240
227 void GrProcessorDataManager::operator delete(void* target) { 241 void GrProcessorDataManager::operator delete(void* target) {
228 return MemoryPoolAccessor().pool()->release(target); 242 return MemoryPoolAccessor().pool()->release(target);
229 } 243 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698