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

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

Issue 1414903002: Dependencies are now added between the drawTargets in GrPipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@mdb-adddeps
Patch Set: Fix leak on abandon issue Created 5 years, 1 month 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/GrRenderTarget.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 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"
11 #include "GrDrawTarget.h"
11 #include "GrGpu.h" 12 #include "GrGpu.h"
12 #include "GrPipelineBuilder.h" 13 #include "GrPipelineBuilder.h"
13 #include "GrProcOptInfo.h" 14 #include "GrProcOptInfo.h"
14 #include "GrXferProcessor.h" 15 #include "GrXferProcessor.h"
15 16
16 #include "batches/GrBatch.h" 17 #include "batches/GrBatch.h"
17 18
18 GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args, 19 GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
19 GrPipelineOptimizations* opts) { 20 GrPipelineOptimizations* opts) {
20 const GrPipelineBuilder& builder = *args.fPipelineBuilder; 21 const GrPipelineBuilder& builder = *args.fPipelineBuilder;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 124
124 GrXPFactory::InvariantBlendedColor blendedColor; 125 GrXPFactory::InvariantBlendedColor blendedColor;
125 builder.fXPFactory->getInvariantBlendedColor(args.fColorPOI, &blendedColor); 126 builder.fXPFactory->getInvariantBlendedColor(args.fColorPOI, &blendedColor);
126 if (blendedColor.fWillBlendWithDst) { 127 if (blendedColor.fWillBlendWithDst) {
127 opts->fFlags |= GrPipelineOptimizations::kWillColorBlendWithDst_Flag; 128 opts->fFlags |= GrPipelineOptimizations::kWillColorBlendWithDst_Flag;
128 } 129 }
129 130
130 return pipeline; 131 return pipeline;
131 } 132 }
132 133
134 static void add_dependencies_for_processor(const GrFragmentProcessor* proc, GrRe nderTarget* rt) {
135 for (int i = 0; i < proc->numChildProcessors(); ++i) {
136 // need to recurse
137 add_dependencies_for_processor(&proc->childProcessor(i), rt);
138 }
139
140 for (int i = 0; i < proc->numTextures(); ++i) {
141 GrTexture* texture = proc->textureAccess(i).getTexture();
142 SkASSERT(rt->getLastDrawTarget());
143 rt->getLastDrawTarget()->addDependency(texture);
144 }
145 }
146
147 void GrPipeline::addDependenciesTo(GrRenderTarget* rt) const {
148 for (int i = 0; i < fFragmentProcessors.count(); ++i) {
149 add_dependencies_for_processor(fFragmentProcessors[i].get(), rt);
150 }
151
152 if (fXferProcessor.get()) {
153 const GrXferProcessor* xfer = fXferProcessor.get();
154
155 for (int i = 0; i < xfer->numTextures(); ++i) {
156 GrTexture* texture = xfer->textureAccess(i).getTexture();
157 SkASSERT(rt->getLastDrawTarget());
158 rt->getLastDrawTarget()->addDependency(texture);
159 }
160 }
161 }
162
133 void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelin eBuilder, 163 void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelin eBuilder,
134 GrXferProcessor::OptFlags flags, 164 GrXferProcessor::OptFlags flags,
135 const GrProcOptInfo& colorPOI, 165 const GrProcOptInfo& colorPOI,
136 const GrProcOptInfo& coveragePOI , 166 const GrProcOptInfo& coveragePOI ,
137 int* firstColorProcessorIdx, 167 int* firstColorProcessorIdx,
138 int* firstCoverageProcessorIdx) { 168 int* firstCoverageProcessorIdx) {
139 fReadsFragPosition = fXferProcessor->willReadFragmentPosition(); 169 fReadsFragPosition = fXferProcessor->willReadFragmentPosition();
140 170
141 if ((flags & GrXferProcessor::kIgnoreColor_OptFlag) || 171 if ((flags & GrXferProcessor::kIgnoreColor_OptFlag) ||
142 (flags & GrXferProcessor::kOverrideColor_OptFlag)) { 172 (flags & GrXferProcessor::kOverrideColor_OptFlag)) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 207 }
178 208
179 for (int i = 0; i < a.numFragmentProcessors(); i++) { 209 for (int i = 0; i < a.numFragmentProcessors(); i++) {
180 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore CoordTransforms)) { 210 if (!a.getFragmentProcessor(i).isEqual(b.getFragmentProcessor(i), ignore CoordTransforms)) {
181 return false; 211 return false;
182 } 212 }
183 } 213 }
184 return true; 214 return true;
185 } 215 }
186 216
OLDNEW
« no previous file with comments | « src/gpu/GrPipeline.h ('k') | src/gpu/GrRenderTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698