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

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

Issue 885923002: Move DstCopy on gpu into the GrXferProcessor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Back to bool Created 5 years, 10 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') | src/gpu/GrPipelineBuilder.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 "GrPipeline.h" 8 #include "GrPipeline.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 42
43 void GrPipeline::internalConstructor(const GrPipelineBuilder& pipelineBuilder, 43 void GrPipeline::internalConstructor(const GrPipelineBuilder& pipelineBuilder,
44 const GrProcOptInfo& colorPOI, 44 const GrProcOptInfo& colorPOI,
45 const GrProcOptInfo& coveragePOI, 45 const GrProcOptInfo& coveragePOI,
46 const GrDrawTargetCaps& caps, 46 const GrDrawTargetCaps& caps,
47 const GrScissorState& scissorState, 47 const GrScissorState& scissorState,
48 const GrDeviceCoordTexture* dstCopy) { 48 const GrDeviceCoordTexture* dstCopy) {
49 // Create XferProcessor from DS's XPFactory 49 // Create XferProcessor from DS's XPFactory
50 SkAutoTUnref<GrXferProcessor> xferProcessor( 50 SkAutoTUnref<GrXferProcessor> xferProcessor(
51 pipelineBuilder.getXPFactory()->createXferProcessor(colorPOI, coveragePO I)); 51 pipelineBuilder.getXPFactory()->createXferProcessor(colorPOI, coveragePO I, dstCopy, caps));
52 52
53 GrColor overrideColor = GrColor_ILLEGAL; 53 GrColor overrideColor = GrColor_ILLEGAL;
54 if (colorPOI.firstEffectiveStageIndex() != 0) { 54 if (colorPOI.firstEffectiveStageIndex() != 0) {
55 overrideColor = colorPOI.inputColorToEffectiveStage(); 55 overrideColor = colorPOI.inputColorToEffectiveStage();
56 } 56 }
57 57
58 GrXferProcessor::OptFlags optFlags; 58 GrXferProcessor::OptFlags optFlags;
59 if (xferProcessor) { 59 if (xferProcessor) {
60 fXferProcessor.reset(xferProcessor.get()); 60 fXferProcessor.reset(xferProcessor.get());
61 61
(...skipping 13 matching lines...) Expand all
75 fFlags = 0; 75 fFlags = 0;
76 fDrawFace = GrPipelineBuilder::kInvalid_DrawFace; 76 fDrawFace = GrPipelineBuilder::kInvalid_DrawFace;
77 return; 77 return;
78 } 78 }
79 79
80 fRenderTarget.reset(pipelineBuilder.fRenderTarget.get()); 80 fRenderTarget.reset(pipelineBuilder.fRenderTarget.get());
81 SkASSERT(fRenderTarget); 81 SkASSERT(fRenderTarget);
82 fScissorState = scissorState; 82 fScissorState = scissorState;
83 fStencilSettings = pipelineBuilder.getStencil(); 83 fStencilSettings = pipelineBuilder.getStencil();
84 fDrawFace = pipelineBuilder.getDrawFace(); 84 fDrawFace = pipelineBuilder.getDrawFace();
85 // TODO move this out of GrPipeline
86 if (dstCopy) {
87 fDstCopy = *dstCopy;
88 }
89 85
90 fFlags = 0; 86 fFlags = 0;
91 if (pipelineBuilder.isHWAntialias()) { 87 if (pipelineBuilder.isHWAntialias()) {
92 fFlags |= kHWAA_Flag; 88 fFlags |= kHWAA_Flag;
93 } 89 }
94 if (pipelineBuilder.isDither()) { 90 if (pipelineBuilder.isDither()) {
95 fFlags |= kDither_Flag; 91 fFlags |= kDither_Flag;
96 } 92 }
97 93
98 int firstColorStageIdx = colorPOI.firstEffectiveStageIndex(); 94 int firstColorStageIdx = colorPOI.firstEffectiveStageIndex();
99 95
100 // TODO: Once we can handle single or four channel input into coverage stage s then we can use 96 // TODO: Once we can handle single or four channel input into coverage stage s then we can use
101 // GrPipelineBuilder's coverageProcInfo (like color above) to set this initi al information. 97 // GrPipelineBuilder's coverageProcInfo (like color above) to set this initi al information.
102 int firstCoverageStageIdx = 0; 98 int firstCoverageStageIdx = 0;
103 99
104 GrXferProcessor::BlendInfo blendInfo; 100 GrXferProcessor::BlendInfo blendInfo;
105 fXferProcessor->getBlendInfo(&blendInfo); 101 fXferProcessor->getBlendInfo(&blendInfo);
106 102
107 this->adjustProgramFromOptimizations(pipelineBuilder, optFlags, colorPOI, co veragePOI, 103 this->adjustProgramFromOptimizations(pipelineBuilder, optFlags, colorPOI, co veragePOI,
108 &firstColorStageIdx, &firstCoverageStag eIdx); 104 &firstColorStageIdx, &firstCoverageStag eIdx);
109 105
110 fDescInfo.fReadsDst = fXferProcessor->willReadDstColor();
111
112 bool usesLocalCoords = false; 106 bool usesLocalCoords = false;
113 107
114 // Copy Stages from PipelineBuilder to Pipeline 108 // Copy Stages from PipelineBuilder to Pipeline
115 for (int i = firstColorStageIdx; i < pipelineBuilder.numColorStages(); ++i) { 109 for (int i = firstColorStageIdx; i < pipelineBuilder.numColorStages(); ++i) {
116 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, 110 SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
117 GrPendingFragmentStage, 111 GrPendingFragmentStage,
118 (pipelineBuilder.fColorStages[i])); 112 (pipelineBuilder.fColorStages[i]));
119 usesLocalCoords = usesLocalCoords || 113 usesLocalCoords = usesLocalCoords ||
120 pipelineBuilder.fColorStages[i].processor()->usesLocal Coords(); 114 pipelineBuilder.fColorStages[i].processor()->usesLocal Coords();
121 } 115 }
(...skipping 13 matching lines...) Expand all
135 fInitBT.fCoverageIgnored = SkToBool(optFlags & GrXferProcessor::kIgnoreCover age_OptFlag); 129 fInitBT.fCoverageIgnored = SkToBool(optFlags & GrXferProcessor::kIgnoreCover age_OptFlag);
136 fInitBT.fUsesLocalCoords = usesLocalCoords; 130 fInitBT.fUsesLocalCoords = usesLocalCoords;
137 } 131 }
138 132
139 void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelin eBuilder, 133 void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelin eBuilder,
140 GrXferProcessor::OptFlags flags, 134 GrXferProcessor::OptFlags flags,
141 const GrProcOptInfo& colorPOI, 135 const GrProcOptInfo& colorPOI,
142 const GrProcOptInfo& coveragePOI , 136 const GrProcOptInfo& coveragePOI ,
143 int* firstColorStageIdx, 137 int* firstColorStageIdx,
144 int* firstCoverageStageIdx) { 138 int* firstCoverageStageIdx) {
145 fDescInfo.fReadsFragPosition = false; 139 fReadsFragPosition = false;
146 140
147 if ((flags & GrXferProcessor::kIgnoreColor_OptFlag) || 141 if ((flags & GrXferProcessor::kIgnoreColor_OptFlag) ||
148 (flags & GrXferProcessor::kOverrideColor_OptFlag)) { 142 (flags & GrXferProcessor::kOverrideColor_OptFlag)) {
149 *firstColorStageIdx = pipelineBuilder.numColorStages(); 143 *firstColorStageIdx = pipelineBuilder.numColorStages();
150 } else { 144 } else {
151 fDescInfo.fReadsFragPosition = colorPOI.readsFragPosition(); 145 fReadsFragPosition = colorPOI.readsFragPosition();
152 } 146 }
153 147
154 if (flags & GrXferProcessor::kIgnoreCoverage_OptFlag) { 148 if (flags & GrXferProcessor::kIgnoreCoverage_OptFlag) {
155 *firstCoverageStageIdx = pipelineBuilder.numCoverageStages(); 149 *firstCoverageStageIdx = pipelineBuilder.numCoverageStages();
156 } else { 150 } else {
157 if (coveragePOI.readsFragPosition()) { 151 if (coveragePOI.readsFragPosition()) {
158 fDescInfo.fReadsFragPosition = true; 152 fReadsFragPosition = true;
159 } 153 }
160 } 154 }
161 } 155 }
162 156
163 //////////////////////////////////////////////////////////////////////////////// 157 ////////////////////////////////////////////////////////////////////////////////
164 158
165 bool GrPipeline::isEqual(const GrPipeline& that) const { 159 bool GrPipeline::isEqual(const GrPipeline& that) const {
166 if (this->getRenderTarget() != that.getRenderTarget() || 160 if (this->getRenderTarget() != that.getRenderTarget() ||
167 this->fFragmentStages.count() != that.fFragmentStages.count() || 161 this->fFragmentStages.count() != that.fFragmentStages.count() ||
168 this->fNumColorStages != that.fNumColorStages || 162 this->fNumColorStages != that.fNumColorStages ||
169 this->fScissorState != that.fScissorState || 163 this->fScissorState != that.fScissorState ||
170 this->fFlags != that.fFlags || 164 this->fFlags != that.fFlags ||
171 this->fStencilSettings != that.fStencilSettings || 165 this->fStencilSettings != that.fStencilSettings ||
172 this->fDrawFace != that.fDrawFace || 166 this->fDrawFace != that.fDrawFace) {
173 this->fDstCopy.texture() != that.fDstCopy.texture()) {
174 return false; 167 return false;
175 } 168 }
176 169
177 if (!this->getXferProcessor()->isEqual(*that.getXferProcessor())) { 170 if (!this->getXferProcessor()->isEqual(*that.getXferProcessor())) {
178 return false; 171 return false;
179 } 172 }
180 173
181 // The program desc comparison should have already assured that the stage co unts match. 174 // The program desc comparison should have already assured that the stage co unts match.
182 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); 175 SkASSERT(this->numFragmentStages() == that.numFragmentStages());
183 for (int i = 0; i < this->numFragmentStages(); i++) { 176 for (int i = 0; i < this->numFragmentStages(); i++) {
184 177
185 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { 178 if (this->getFragmentStage(i) != that.getFragmentStage(i)) {
186 return false; 179 return false;
187 } 180 }
188 } 181 }
189 return true; 182 return true;
190 } 183 }
191 184
OLDNEW
« no previous file with comments | « src/gpu/GrPipeline.h ('k') | src/gpu/GrPipelineBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698