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 "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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 fCommands->recordDrawPaths(state, this, pathProc, pathRange, indices, indexT
ype, | 47 fCommands->recordDrawPaths(state, this, pathProc, pathRange, indices, indexT
ype, |
48 transformValues, transformType, count, stencilSet
tings, | 48 transformValues, transformType, count, stencilSet
tings, |
49 opts); | 49 opts); |
50 } | 50 } |
51 | 51 |
52 void GrBufferedDrawTarget::onReset() { | 52 void GrBufferedDrawTarget::onReset() { |
53 fCommands->reset(); | 53 fCommands->reset(); |
54 fPathIndexBuffer.rewind(); | 54 fPathIndexBuffer.rewind(); |
55 fPathTransformBuffer.rewind(); | 55 fPathTransformBuffer.rewind(); |
56 | 56 |
57 fPrevState.reset(NULL); | 57 fPrevState.reset(nullptr); |
58 // Note, fPrevState points into fPipelineBuffer's allocation, so we have to
reset first. | 58 // Note, fPrevState points into fPipelineBuffer's allocation, so we have to
reset first. |
59 // Furthermore, we have to reset fCommands before fPipelineBuffer too. | 59 // Furthermore, we have to reset fCommands before fPipelineBuffer too. |
60 if (fDrawID % kPipelineBufferHighWaterMark) { | 60 if (fDrawID % kPipelineBufferHighWaterMark) { |
61 fPipelineBuffer.rewind(); | 61 fPipelineBuffer.rewind(); |
62 } else { | 62 } else { |
63 fPipelineBuffer.reset(); | 63 fPipelineBuffer.reset(); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 void GrBufferedDrawTarget::onFlush() { | 67 void GrBufferedDrawTarget::onFlush() { |
68 fCommands->flush(this->getGpu(), this->getContext()->resourceProvider()); | 68 fCommands->flush(this->getGpu(), this->getContext()->resourceProvider()); |
69 ++fDrawID; | 69 ++fDrawID; |
70 } | 70 } |
71 | 71 |
72 GrTargetCommands::StateForPathDraw* | 72 GrTargetCommands::StateForPathDraw* |
73 GrBufferedDrawTarget::createStateForPathDraw(const GrPrimitiveProcessor* primPro
c, | 73 GrBufferedDrawTarget::createStateForPathDraw(const GrPrimitiveProcessor* primPro
c, |
74 const GrDrawTarget::PipelineInfo& p
ipelineInfo, | 74 const GrDrawTarget::PipelineInfo& p
ipelineInfo, |
75 GrPipelineOptimizations* opts) { | 75 GrPipelineOptimizations* opts) { |
76 StateForPathDraw* state = this->allocState(primProc); | 76 StateForPathDraw* state = this->allocState(primProc); |
77 if (!GrPipeline::CreateAt(state->pipelineLocation(), pipelineInfo.pipelineCr
eateArgs(), opts)) { | 77 if (!GrPipeline::CreateAt(state->pipelineLocation(), pipelineInfo.pipelineCr
eateArgs(), opts)) { |
78 this->unallocState(state); | 78 this->unallocState(state); |
79 return NULL; | 79 return nullptr; |
80 } | 80 } |
81 | 81 |
82 state->fPrimitiveProcessor->initBatchTracker(&state->fBatchTracker, *opts); | 82 state->fPrimitiveProcessor->initBatchTracker(&state->fBatchTracker, *opts); |
83 | 83 |
84 if (fPrevState && fPrevState->fPrimitiveProcessor.get() && | 84 if (fPrevState && fPrevState->fPrimitiveProcessor.get() && |
85 fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker, | 85 fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker, |
86 *state->fPrimitiveProcesso
r, | 86 *state->fPrimitiveProcesso
r, |
87 state->fBatchTracker) && | 87 state->fBatchTracker) && |
88 GrPipeline::AreEqual(*fPrevState->getPipeline(), *state->getPipeline(),
false)) { | 88 GrPipeline::AreEqual(*fPrevState->getPipeline(), *state->getPipeline(),
false)) { |
89 this->unallocState(state); | 89 this->unallocState(state); |
90 } else { | 90 } else { |
91 fPrevState.reset(state); | 91 fPrevState.reset(state); |
92 } | 92 } |
93 | 93 |
94 return fPrevState; | 94 return fPrevState; |
95 } | 95 } |
OLD | NEW |