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

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

Issue 1315923004: Convert child FPs from refs to pending executions when parent converts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: working 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
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (this->textureAccess(i) != that.textureAccess(i)) { 124 if (this->textureAccess(i) != that.textureAccess(i)) {
125 return false; 125 return false;
126 } 126 }
127 } 127 }
128 return true; 128 return true;
129 } 129 }
130 130
131 //////////////////////////////////////////////////////////////////////////////// /////////////////// 131 //////////////////////////////////////////////////////////////////////////////// ///////////////////
132 132
133 GrFragmentProcessor::~GrFragmentProcessor() { 133 GrFragmentProcessor::~GrFragmentProcessor() {
134 // If we got here then our ref count must have reached zero, so we will have converted refs
135 // to pending executions for all children.
134 for (int i = 0; i < fChildProcessors.count(); ++i) { 136 for (int i = 0; i < fChildProcessors.count(); ++i) {
135 fChildProcessors[i]->unref(); 137 fChildProcessors[i]->completedExecution();
136 } 138 }
137 } 139 }
138 140
139 bool GrFragmentProcessor::isEqual(const GrFragmentProcessor& that, 141 bool GrFragmentProcessor::isEqual(const GrFragmentProcessor& that,
140 bool ignoreCoordTransforms) const { 142 bool ignoreCoordTransforms) const {
141 if (this->classID() != that.classID() || 143 if (this->classID() != that.classID() ||
142 !this->hasSameTextureAccesses(that)) { 144 !this->hasSameTextureAccesses(that)) {
143 return false; 145 return false;
144 } 146 }
145 if (ignoreCoordTransforms) { 147 if (ignoreCoordTransforms) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 this->setWillReadFragmentPosition(); 213 this->setWillReadFragmentPosition();
212 } 214 }
213 215
214 if (child->usesLocalCoords()) { 216 if (child->usesLocalCoords()) {
215 fUsesLocalCoords = true; 217 fUsesLocalCoords = true;
216 } 218 }
217 219
218 return index; 220 return index;
219 } 221 }
220 222
223 void GrFragmentProcessor::notifyRefCntIsZero() const {
224 for (int i = 0; i < fChildProcessors.count(); ++i) {
225 fChildProcessors[i]->addPendingExecution();
226 fChildProcessors[i]->unref();
227 }
228 }
229
221 bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) con st { 230 bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) con st {
222 if (this->numTransforms() != that.numTransforms()) { 231 if (this->numTransforms() != that.numTransforms()) {
223 return false; 232 return false;
224 } 233 }
225 int count = this->numTransforms(); 234 int count = this->numTransforms();
226 for (int i = 0; i < count; ++i) { 235 for (int i = 0; i < count; ++i) {
227 if (this->coordTransform(i) != that.coordTransform(i)) { 236 if (this->coordTransform(i) != that.coordTransform(i)) {
228 return false; 237 return false;
229 } 238 }
230 } 239 }
(...skipping 13 matching lines...) Expand all
244 //////////////////////////////////////////////////////////////////////////////// /////////////////// 253 //////////////////////////////////////////////////////////////////////////////// ///////////////////
245 254
246 // GrProcessorDataManager lives in the same pool 255 // GrProcessorDataManager lives in the same pool
247 void* GrProcessorDataManager::operator new(size_t size) { 256 void* GrProcessorDataManager::operator new(size_t size) {
248 return MemoryPoolAccessor().pool()->allocate(size); 257 return MemoryPoolAccessor().pool()->allocate(size);
249 } 258 }
250 259
251 void GrProcessorDataManager::operator delete(void* target) { 260 void GrProcessorDataManager::operator delete(void* target) {
252 return MemoryPoolAccessor().pool()->release(target); 261 return MemoryPoolAccessor().pool()->release(target);
253 } 262 }
OLDNEW
« include/gpu/GrProgramElement.h ('K') | « src/gpu/GrPrimitiveProcessor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698