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

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

Issue 1275853005: All child GrFragmentProcs' transforms and textures will be stored in the root GrFragmentProc in pre… (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: child procs keep copy of their arrays 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
« no previous file with comments | « include/gpu/GrStagedProcessor.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.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 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 129
130 //////////////////////////////////////////////////////////////////////////////// /////////////////// 130 //////////////////////////////////////////////////////////////////////////////// ///////////////////
131 131
132 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { 132 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) {
133 fCoordTransforms.push_back(transform); 133 fCoordTransforms.push_back(transform);
134 fUsesLocalCoords = fUsesLocalCoords || transform->sourceCoords() == kLocal_G rCoordSet; 134 fUsesLocalCoords = fUsesLocalCoords || transform->sourceCoords() == kLocal_G rCoordSet;
135 SkDEBUGCODE(transform->setInProcessor();) 135 SkDEBUGCODE(transform->setInProcessor();)
136 } 136 }
137 137
138 void GrFragmentProcessor::registerChildProcessor(GrFragmentProcessor* child) { 138 int GrFragmentProcessor::registerChildProcessor(const GrFragmentProcessor* child ) {
139 fChildProcessors.push_back(child); 139 // Append the child's transforms to our transforms array and the child's tex tures array to our
140 // textures array
141 if (!child->fCoordTransforms.empty()) {
142 fCoordTransforms.push_back_n(child->fCoordTransforms.count(),
143 child->fCoordTransforms.begin());
144 }
145 if (!child->fTextureAccesses.empty()) {
146 fTextureAccesses.push_back_n(child->fTextureAccesses.count(),
147 child->fTextureAccesses.begin());
148 }
149
150 int index = fChildProcessors.count();
151 fChildProcessors.push_back(GrFragmentStage(child));
152
153 if (child->willReadFragmentPosition())
154 this->setWillReadFragmentPosition();
155
156 return index;
140 } 157 }
141 158
142 bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) con st { 159 bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) con st {
143 if (fCoordTransforms.count() != that.fCoordTransforms.count()) { 160 if (this->numTransforms() != that.numTransforms()) {
144 return false; 161 return false;
145 } 162 }
146 int count = fCoordTransforms.count(); 163 int count = this->numTransforms();
147 for (int i = 0; i < count; ++i) { 164 for (int i = 0; i < count; ++i) {
148 if (*fCoordTransforms[i] != *that.fCoordTransforms[i]) { 165 if (this->coordTransform(i) != that.coordTransform(i)) {
149 return false; 166 return false;
150 } 167 }
151 } 168 }
152 return true; 169 return true;
153 } 170 }
154 171
155 void GrFragmentProcessor::computeInvariantOutput(GrInvariantOutput* inout) const { 172 void GrFragmentProcessor::computeInvariantOutput(GrInvariantOutput* inout) const {
156 this->onComputeInvariantOutput(inout); 173 this->onComputeInvariantOutput(inout);
157 } 174 }
158 175
159 //////////////////////////////////////////////////////////////////////////////// /////////////////// 176 //////////////////////////////////////////////////////////////////////////////// ///////////////////
160 177
161 // Initial static variable from GrXPFactory 178 // Initial static variable from GrXPFactory
162 int32_t GrXPFactory::gCurrXPFClassID = 179 int32_t GrXPFactory::gCurrXPFClassID =
163 GrXPFactory::kIllegalXPFClassID; 180 GrXPFactory::kIllegalXPFClassID;
164 181
165 //////////////////////////////////////////////////////////////////////////////// /////////////////// 182 //////////////////////////////////////////////////////////////////////////////// ///////////////////
166 183
167 // GrProcessorDataManager lives in the same pool 184 // GrProcessorDataManager lives in the same pool
168 void* GrProcessorDataManager::operator new(size_t size) { 185 void* GrProcessorDataManager::operator new(size_t size) {
169 return MemoryPoolAccessor().pool()->allocate(size); 186 return MemoryPoolAccessor().pool()->allocate(size);
170 } 187 }
171 188
172 void GrProcessorDataManager::operator delete(void* target) { 189 void GrProcessorDataManager::operator delete(void* target) {
173 return MemoryPoolAccessor().pool()->release(target); 190 return MemoryPoolAccessor().pool()->release(target);
174 } 191 }
OLDNEW
« no previous file with comments | « include/gpu/GrStagedProcessor.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698