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. |
11 // TODO move NVPR to batch so we can reorder | 11 // TODO move NVPR to batch so we can reorder |
12 static inline bool allow_reordering(const GrCaps* caps) { | 12 static inline bool allow_reordering(const GrCaps* caps) { |
13 return caps && caps->shaderCaps() && !caps->shaderCaps()->pathRenderingSuppo
rt(); | 13 return caps && caps->shaderCaps() && !caps->shaderCaps()->pathRenderingSuppo
rt(); |
14 } | 14 } |
15 | 15 |
16 GrBufferedDrawTarget::GrBufferedDrawTarget(GrContext* context) | 16 GrBufferedDrawTarget::GrBufferedDrawTarget(GrContext* context) |
17 : INHERITED(context) | 17 : INHERITED(context) |
18 , fCommands(GrCommandBuilder::Create(context->getGpu(), allow_reordering(con
text->caps()))) | 18 , fCommands(GrCommandBuilder::Create(context->getGpu(), allow_reordering(con
text->caps()))) |
19 , fPathIndexBuffer(kPathIdxBufferMinReserve * sizeof(char)/4) | 19 , fPathIndexBuffer(kPathIdxBufferMinReserve * sizeof(char)/4) |
20 , fPathTransformBuffer(kPathXformBufferMinReserve * sizeof(float)/4) | 20 , fPathTransformBuffer(kPathXformBufferMinReserve * sizeof(float)/4) |
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(GrDrawBatch* batch) { |
30 fCommands->recordDrawBatch(batch, *this->caps()); | 30 fCommands->recordDrawBatch(batch, *this->caps()); |
31 } | 31 } |
32 | 32 |
33 void GrBufferedDrawTarget::onStencilPath(const GrPipelineBuilder& pipelineBuilde
r, | 33 void GrBufferedDrawTarget::onStencilPath(const GrPipelineBuilder& pipelineBuilde
r, |
34 const GrPathProcessor* pathProc, | 34 const GrPathProcessor* pathProc, |
35 const GrPath* path, | 35 const GrPath* path, |
36 const GrScissorState& scissorState, | 36 const GrScissorState& scissorState, |
37 const GrStencilSettings& stencilSetting
s) { | 37 const GrStencilSettings& stencilSetting
s) { |
38 fCommands->recordStencilPath(pipelineBuilder, pathProc, path, scissorState,
stencilSettings); | 38 fCommands->recordStencilPath(pipelineBuilder, pathProc, path, scissorState,
stencilSettings); |
39 } | 39 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 *state->fPrimitiveProcesso
r, | 131 *state->fPrimitiveProcesso
r, |
132 state->fBatchTracker) && | 132 state->fBatchTracker) && |
133 GrPipeline::AreEqual(*fPrevState->getPipeline(), *state->getPipeline(),
false)) { | 133 GrPipeline::AreEqual(*fPrevState->getPipeline(), *state->getPipeline(),
false)) { |
134 this->unallocState(state); | 134 this->unallocState(state); |
135 } else { | 135 } else { |
136 fPrevState.reset(state); | 136 fPrevState.reset(state); |
137 } | 137 } |
138 | 138 |
139 return fPrevState; | 139 return fPrevState; |
140 } | 140 } |
OLD | NEW |