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

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

Issue 1275003004: Remove GrPipelineOptimizations member from GrPipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@opt
Patch Set: rebase 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/GrBufferedDrawTarget.h ('k') | src/gpu/GrDrawTarget.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 2011 Google Inc. 2 * Copyright 2011 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 "GrBufferedDrawTarget.h" 8 #include "GrBufferedDrawTarget.h"
9 9
10 // We will use the reordering buffer, unless we have NVPR. 10 // We will use the reordering buffer, unless we have NVPR.
(...skipping 10 matching lines...) Expand all
21 , fPipelineBuffer(kPipelineBufferMinReserve) 21 , fPipelineBuffer(kPipelineBufferMinReserve)
22 , fDrawID(0) { 22 , fDrawID(0) {
23 } 23 }
24 24
25 GrBufferedDrawTarget::~GrBufferedDrawTarget() { 25 GrBufferedDrawTarget::~GrBufferedDrawTarget() {
26 this->reset(); 26 this->reset();
27 } 27 }
28 28
29 void GrBufferedDrawTarget::onDrawBatch(GrBatch* batch, 29 void GrBufferedDrawTarget::onDrawBatch(GrBatch* batch,
30 const PipelineInfo& pipelineInfo) { 30 const PipelineInfo& pipelineInfo) {
31 State* state = this->setupPipelineAndShouldDraw(batch, pipelineInfo); 31 GrPipelineOptimizations opts;
32 State* state = this->setupPipelineAndShouldDraw(batch, pipelineInfo, &opts);
32 if (!state) { 33 if (!state) {
33 return; 34 return;
34 } 35 }
35 36
36 GrTargetCommands::Cmd* cmd = fCommands->recordDrawBatch(state, batch); 37 GrTargetCommands::Cmd* cmd = fCommands->recordDrawBatch(state, batch);
37 this->recordTraceMarkersIfNecessary(cmd); 38 this->recordTraceMarkersIfNecessary(cmd);
38 } 39 }
39 40
40 void GrBufferedDrawTarget::onStencilPath(const GrPipelineBuilder& pipelineBuilde r, 41 void GrBufferedDrawTarget::onStencilPath(const GrPipelineBuilder& pipelineBuilde r,
41 const GrPathProcessor* pathProc, 42 const GrPathProcessor* pathProc,
42 const GrPath* path, 43 const GrPath* path,
43 const GrScissorState& scissorState, 44 const GrScissorState& scissorState,
44 const GrStencilSettings& stencilSetting s) { 45 const GrStencilSettings& stencilSetting s) {
45 GrTargetCommands::Cmd* cmd = fCommands->recordStencilPath(pipelineBuilder, 46 GrTargetCommands::Cmd* cmd = fCommands->recordStencilPath(pipelineBuilder,
46 pathProc, path, sc issorState, 47 pathProc, path, sc issorState,
47 stencilSettings); 48 stencilSettings);
48 this->recordTraceMarkersIfNecessary(cmd); 49 this->recordTraceMarkersIfNecessary(cmd);
49 } 50 }
50 51
51 void GrBufferedDrawTarget::onDrawPath(const GrPathProcessor* pathProc, 52 void GrBufferedDrawTarget::onDrawPath(const GrPathProcessor* pathProc,
52 const GrPath* path, 53 const GrPath* path,
53 const GrStencilSettings& stencilSettings, 54 const GrStencilSettings& stencilSettings,
54 const PipelineInfo& pipelineInfo) { 55 const PipelineInfo& pipelineInfo) {
55 State* state = this->setupPipelineAndShouldDraw(pathProc, pipelineInfo); 56 GrPipelineOptimizations opts;
57 State* state = this->setupPipelineAndShouldDraw(pathProc, pipelineInfo, &opt s);
56 if (!state) { 58 if (!state) {
57 return; 59 return;
58 } 60 }
59 GrTargetCommands::Cmd* cmd = fCommands->recordDrawPath(state, pathProc, path , stencilSettings); 61 GrTargetCommands::Cmd* cmd = fCommands->recordDrawPath(state, pathProc, path , stencilSettings);
60 this->recordTraceMarkersIfNecessary(cmd); 62 this->recordTraceMarkersIfNecessary(cmd);
61 } 63 }
62 64
63 void GrBufferedDrawTarget::onDrawPaths(const GrPathProcessor* pathProc, 65 void GrBufferedDrawTarget::onDrawPaths(const GrPathProcessor* pathProc,
64 const GrPathRange* pathRange, 66 const GrPathRange* pathRange,
65 const void* indices, 67 const void* indices,
66 PathIndexType indexType, 68 PathIndexType indexType,
67 const float transformValues[], 69 const float transformValues[],
68 PathTransformType transformType, 70 PathTransformType transformType,
69 int count, 71 int count,
70 const GrStencilSettings& stencilSettings, 72 const GrStencilSettings& stencilSettings,
71 const PipelineInfo& pipelineInfo) { 73 const PipelineInfo& pipelineInfo) {
72 State* state = this->setupPipelineAndShouldDraw(pathProc, pipelineInfo); 74 GrPipelineOptimizations opts;
75 State* state = this->setupPipelineAndShouldDraw(pathProc, pipelineInfo, &opt s);
73 if (!state) { 76 if (!state) {
74 return; 77 return;
75 } 78 }
76 GrTargetCommands::Cmd* cmd = fCommands->recordDrawPaths(state, this, pathPro c, pathRange, 79 GrTargetCommands::Cmd* cmd = fCommands->recordDrawPaths(state, this, pathPro c, pathRange,
77 indices, indexType, transformValues, 80 indices, indexType, transformValues,
78 transformType, count , 81 transformType, count ,
79 stencilSettings, pip elineInfo); 82 stencilSettings, pip elineInfo);
80 this->recordTraceMarkersIfNecessary(cmd); 83 this->recordTraceMarkersIfNecessary(cmd);
81 } 84 }
82 85
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 fGpuCmdMarkers[cmd->markerID()].addSet(activeTraceMarkers); 144 fGpuCmdMarkers[cmd->markerID()].addSet(activeTraceMarkers);
142 } else { 145 } else {
143 cmd->setMarkerID(fGpuCmdMarkers.count()); 146 cmd->setMarkerID(fGpuCmdMarkers.count());
144 fGpuCmdMarkers.push_back(activeTraceMarkers); 147 fGpuCmdMarkers.push_back(activeTraceMarkers);
145 } 148 }
146 } 149 }
147 } 150 }
148 151
149 GrTargetCommands::State* 152 GrTargetCommands::State*
150 GrBufferedDrawTarget::setupPipelineAndShouldDraw(const GrPrimitiveProcessor* pri mProc, 153 GrBufferedDrawTarget::setupPipelineAndShouldDraw(const GrPrimitiveProcessor* pri mProc,
151 const GrDrawTarget::PipelineInf o& pipelineInfo) { 154 const GrDrawTarget::PipelineInf o& pipelineInfo,
155 GrPipelineOptimizations* opts) {
152 State* state = this->allocState(primProc); 156 State* state = this->allocState(primProc);
153 this->setupPipeline(pipelineInfo, state->pipelineLocation()); 157 this->setupPipeline(pipelineInfo, state->pipelineLocation(), opts);
154 158
155 if (state->getPipeline()->mustSkip()) { 159 if (state->getPipeline()->mustSkip()) {
156 this->unallocState(state); 160 this->unallocState(state);
157 return NULL; 161 return NULL;
158 } 162 }
159 163
160 state->fPrimitiveProcessor->initBatchTracker( 164 state->fPrimitiveProcessor->initBatchTracker(&state->fBatchTracker, *opts);
161 &state->fBatchTracker, state->getPipeline()->infoForPrimitiveProcessor() );
162 165
163 if (fPrevState && fPrevState->fPrimitiveProcessor.get() && 166 if (fPrevState && fPrevState->fPrimitiveProcessor.get() &&
164 fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker, 167 fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker,
165 *state->fPrimitiveProcesso r, 168 *state->fPrimitiveProcesso r,
166 state->fBatchTracker) && 169 state->fBatchTracker) &&
167 fPrevState->getPipeline()->isEqual(*state->getPipeline())) { 170 fPrevState->getPipeline()->isEqual(*state->getPipeline())) {
168 this->unallocState(state); 171 this->unallocState(state);
169 } else { 172 } else {
170 fPrevState.reset(state); 173 fPrevState.reset(state);
171 } 174 }
172 175
173 this->recordTraceMarkersIfNecessary( 176 this->recordTraceMarkersIfNecessary(
174 fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(), *this->caps())); 177 fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(), *this->caps()));
175 return fPrevState; 178 return fPrevState;
176 } 179 }
177 180
178 GrTargetCommands::State* 181 GrTargetCommands::State*
179 GrBufferedDrawTarget::setupPipelineAndShouldDraw(GrBatch* batch, 182 GrBufferedDrawTarget::setupPipelineAndShouldDraw(GrBatch* batch,
180 const GrDrawTarget::PipelineInf o& pipelineInfo) { 183 const GrDrawTarget::PipelineInf o& pipelineInfo,
184 GrPipelineOptimizations* opts) {
181 State* state = this->allocState(); 185 State* state = this->allocState();
182 this->setupPipeline(pipelineInfo, state->pipelineLocation()); 186 this->setupPipeline(pipelineInfo, state->pipelineLocation(), opts);
183 187
184 if (state->getPipeline()->mustSkip()) { 188 if (state->getPipeline()->mustSkip()) {
185 this->unallocState(state); 189 this->unallocState(state);
186 return NULL; 190 return NULL;
187 } 191 }
188 192
189 batch->initBatchTracker(state->getPipeline()->infoForPrimitiveProcessor()); 193 batch->initBatchTracker(*opts);
190 194
191 if (fPrevState && !fPrevState->fPrimitiveProcessor.get() && 195 if (fPrevState && !fPrevState->fPrimitiveProcessor.get() &&
192 fPrevState->getPipeline()->isEqual(*state->getPipeline())) { 196 fPrevState->getPipeline()->isEqual(*state->getPipeline())) {
193 this->unallocState(state); 197 this->unallocState(state);
194 } else { 198 } else {
195 fPrevState.reset(state); 199 fPrevState.reset(state);
196 } 200 }
197 201
198 this->recordTraceMarkersIfNecessary( 202 this->recordTraceMarkersIfNecessary(
199 fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(), *this->caps())); 203 fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(), *this->caps()));
200 return fPrevState; 204 return fPrevState;
201 } 205 }
OLDNEW
« no previous file with comments | « src/gpu/GrBufferedDrawTarget.h ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698