OLD | NEW |
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 "GrInOrderDrawBuffer.h" | 8 #include "GrInOrderDrawBuffer.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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 GrInOrderDrawBuffer::setupPipelineAndShouldDraw(const GrPrimitiveProcessor* prim
Proc, | 150 GrInOrderDrawBuffer::setupPipelineAndShouldDraw(const GrPrimitiveProcessor* prim
Proc, |
151 const GrDrawTarget::PipelineInfo
& pipelineInfo) { | 151 const GrDrawTarget::PipelineInfo
& pipelineInfo) { |
152 State* state = this->allocState(primProc); | 152 State* state = this->allocState(primProc); |
153 this->setupPipeline(pipelineInfo, state->pipelineLocation()); | 153 this->setupPipeline(pipelineInfo, state->pipelineLocation()); |
154 | 154 |
155 if (state->getPipeline()->mustSkip()) { | 155 if (state->getPipeline()->mustSkip()) { |
156 this->unallocState(state); | 156 this->unallocState(state); |
157 return NULL; | 157 return NULL; |
158 } | 158 } |
159 | 159 |
160 state->fPrimitiveProcessor->initBatchTracker(&state->fBatchTracker, | 160 state->fPrimitiveProcessor->initBatchTracker( |
161 state->getPipeline()->getInitBa
tchTracker()); | 161 &state->fBatchTracker, state->getPipeline()->infoForPrimitiveProcessor()
); |
162 | 162 |
163 if (fPrevState && fPrevState->fPrimitiveProcessor.get() && | 163 if (fPrevState && fPrevState->fPrimitiveProcessor.get() && |
164 fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker, | 164 fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker, |
165 *state->fPrimitiveProcesso
r, | 165 *state->fPrimitiveProcesso
r, |
166 state->fBatchTracker) && | 166 state->fBatchTracker) && |
167 fPrevState->getPipeline()->isEqual(*state->getPipeline())) { | 167 fPrevState->getPipeline()->isEqual(*state->getPipeline())) { |
168 this->unallocState(state); | 168 this->unallocState(state); |
169 } else { | 169 } else { |
170 fPrevState.reset(state); | 170 fPrevState.reset(state); |
171 } | 171 } |
172 | 172 |
173 this->recordTraceMarkersIfNecessary( | 173 this->recordTraceMarkersIfNecessary( |
174 fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(),
*this->caps())); | 174 fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(),
*this->caps())); |
175 return fPrevState; | 175 return fPrevState; |
176 } | 176 } |
177 | 177 |
178 GrTargetCommands::State* | 178 GrTargetCommands::State* |
179 GrInOrderDrawBuffer::setupPipelineAndShouldDraw(GrBatch* batch, | 179 GrInOrderDrawBuffer::setupPipelineAndShouldDraw(GrBatch* batch, |
180 const GrDrawTarget::PipelineInfo
& pipelineInfo) { | 180 const GrDrawTarget::PipelineInfo
& pipelineInfo) { |
181 State* state = this->allocState(); | 181 State* state = this->allocState(); |
182 this->setupPipeline(pipelineInfo, state->pipelineLocation()); | 182 this->setupPipeline(pipelineInfo, state->pipelineLocation()); |
183 | 183 |
184 if (state->getPipeline()->mustSkip()) { | 184 if (state->getPipeline()->mustSkip()) { |
185 this->unallocState(state); | 185 this->unallocState(state); |
186 return NULL; | 186 return NULL; |
187 } | 187 } |
188 | 188 |
189 batch->initBatchTracker(state->getPipeline()->getInitBatchTracker()); | 189 batch->initBatchTracker(state->getPipeline()->infoForPrimitiveProcessor()); |
190 | 190 |
191 if (fPrevState && !fPrevState->fPrimitiveProcessor.get() && | 191 if (fPrevState && !fPrevState->fPrimitiveProcessor.get() && |
192 fPrevState->getPipeline()->isEqual(*state->getPipeline())) { | 192 fPrevState->getPipeline()->isEqual(*state->getPipeline())) { |
193 this->unallocState(state); | 193 this->unallocState(state); |
194 } else { | 194 } else { |
195 fPrevState.reset(state); | 195 fPrevState.reset(state); |
196 } | 196 } |
197 | 197 |
198 this->recordTraceMarkersIfNecessary( | 198 this->recordTraceMarkersIfNecessary( |
199 fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(),
*this->caps())); | 199 fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(),
*this->caps())); |
200 return fPrevState; | 200 return fPrevState; |
201 } | 201 } |
OLD | NEW |