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

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

Issue 1275603002: Expose coord transforms from GrPipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@lccleanup4
Patch Set: feedback inc 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 | « src/gpu/GrPipeline.h ('k') | no next file » | 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 "GrPipeline.h" 8 #include "GrPipeline.h"
9 9
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // GrPipelineBuilder's coverageProcInfo (like color above) to set this initi al information. 80 // GrPipelineBuilder's coverageProcInfo (like color above) to set this initi al information.
81 int firstCoverageStageIdx = 0; 81 int firstCoverageStageIdx = 0;
82 82
83 this->adjustProgramFromOptimizations(pipelineBuilder, optFlags, colorPOI, co veragePOI, 83 this->adjustProgramFromOptimizations(pipelineBuilder, optFlags, colorPOI, co veragePOI,
84 &firstColorStageIdx, &firstCoverageStag eIdx); 84 &firstColorStageIdx, &firstCoverageStag eIdx);
85 85
86 bool usesLocalCoords = false; 86 bool usesLocalCoords = false;
87 87
88 // Copy Stages from PipelineBuilder to Pipeline 88 // Copy Stages from PipelineBuilder to Pipeline
89 for (int i = firstColorStageIdx; i < pipelineBuilder.numColorFragmentStages( ); ++i) { 89 for (int i = firstColorStageIdx; i < pipelineBuilder.numColorFragmentStages( ); ++i) {
90 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, 90 const GrFragmentStage& fps = pipelineBuilder.fColorStages[i];
91 GrPendingFragmentStage, 91 const GrFragmentProcessor* fp = fps.processor();
92 (pipelineBuilder.fColorStages[i])); 92 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fps));
93 usesLocalCoords = usesLocalCoords || 93 usesLocalCoords = usesLocalCoords || fp->usesLocalCoords();
94 pipelineBuilder.fColorStages[i].processor()->usesLocal Coords(); 94 fp->gatherCoordTransforms(&fCoordTransforms);
95 } 95 }
96 96
97 fNumColorStages = fFragmentStages.count(); 97 fNumColorStages = fFragmentStages.count();
98 for (int i = firstCoverageStageIdx; i < pipelineBuilder.numCoverageFragmentS tages(); ++i) { 98 for (int i = firstCoverageStageIdx; i < pipelineBuilder.numCoverageFragmentS tages(); ++i) {
99 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, 99 const GrFragmentStage& fps = pipelineBuilder.fCoverageStages[i];
100 GrPendingFragmentStage, 100 const GrFragmentProcessor* fp = fps.processor();
101 (pipelineBuilder.fCoverageStages[i])); 101 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fps));
102 usesLocalCoords = usesLocalCoords || 102 usesLocalCoords = usesLocalCoords || fp->usesLocalCoords();
103 pipelineBuilder.fCoverageStages[i].processor()->usesLo calCoords(); 103 fp->gatherCoordTransforms(&fCoordTransforms);
104 } 104 }
105 105
106 // Setup info we need to pass to GrPrimitiveProcessors that are used with th is GrPipeline. 106 // Setup info we need to pass to GrPrimitiveProcessors that are used with th is GrPipeline.
107 fInfoForPrimitiveProcessor.fFlags = 0; 107 fInfoForPrimitiveProcessor.fFlags = 0;
108 if (!SkToBool(optFlags & GrXferProcessor::kIgnoreColor_OptFlag)) { 108 if (!SkToBool(optFlags & GrXferProcessor::kIgnoreColor_OptFlag)) {
109 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsColor_GrPipel ineInfoFlag; 109 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kReadsColor_GrPipel ineInfoFlag;
110 } 110 }
111 if (GrColor_ILLEGAL != overrideColor) { 111 if (GrColor_ILLEGAL != overrideColor) {
112 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kUseOverrideColor_G rPipelineInfoFlag; 112 fInfoForPrimitiveProcessor.fFlags |= GrPipelineInfo::kUseOverrideColor_G rPipelineInfoFlag;
113 fInfoForPrimitiveProcessor.fOverrideColor = overrideColor; 113 fInfoForPrimitiveProcessor.fOverrideColor = overrideColor;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 *firstCoverageStageIdx = pipelineBuilder.numCoverageFragmentStages(); 145 *firstCoverageStageIdx = pipelineBuilder.numCoverageFragmentStages();
146 } else { 146 } else {
147 if (coveragePOI.readsFragPosition()) { 147 if (coveragePOI.readsFragPosition()) {
148 fReadsFragPosition = true; 148 fReadsFragPosition = true;
149 } 149 }
150 } 150 }
151 } 151 }
152 152
153 //////////////////////////////////////////////////////////////////////////////// 153 ////////////////////////////////////////////////////////////////////////////////
154 154
155 bool GrPipeline::isEqual(const GrPipeline& that) const { 155 bool GrPipeline::isEqual(const GrPipeline& that, bool ignoreCoordTransforms) con st {
156 // If we point to the same pipeline, then we are necessarily equal 156 // If we point to the same pipeline, then we are necessarily equal
157 if (this == &that) { 157 if (this == &that) {
158 return true; 158 return true;
159 } 159 }
160 160
161 if (this->getRenderTarget() != that.getRenderTarget() || 161 if (this->getRenderTarget() != that.getRenderTarget() ||
162 this->fFragmentStages.count() != that.fFragmentStages.count() || 162 this->fFragmentStages.count() != that.fFragmentStages.count() ||
163 this->fNumColorStages != that.fNumColorStages || 163 this->fNumColorStages != that.fNumColorStages ||
164 this->fScissorState != that.fScissorState || 164 this->fScissorState != that.fScissorState ||
165 this->fFlags != that.fFlags || 165 this->fFlags != that.fFlags ||
166 this->fStencilSettings != that.fStencilSettings || 166 this->fStencilSettings != that.fStencilSettings ||
167 this->fDrawFace != that.fDrawFace) { 167 this->fDrawFace != that.fDrawFace) {
168 return false; 168 return false;
169 } 169 }
170 170
171 if (!this->getXferProcessor()->isEqual(*that.getXferProcessor())) { 171 if (!this->getXferProcessor()->isEqual(*that.getXferProcessor())) {
172 return false; 172 return false;
173 } 173 }
174 174
175 // The program desc comparison should have already assured that the stage co unts match.
176 SkASSERT(this->numFragmentStages() == that.numFragmentStages());
177 for (int i = 0; i < this->numFragmentStages(); i++) { 175 for (int i = 0; i < this->numFragmentStages(); i++) {
178 176 if (!this->getFragmentStage(i).processor()->isEqual(*that.getFragmentSta ge(i).processor(),
179 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { 177 ignoreCoordTransform s)) {
180 return false; 178 return false;
181 } 179 }
182 } 180 }
183 return true; 181 return true;
184 } 182 }
185 183
OLDNEW
« no previous file with comments | « src/gpu/GrPipeline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698