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 static const bool kEnableReordering = true; |
11 // TODO move NVPR to batch so we can reorder | |
12 static inline bool allow_reordering(const GrShaderCaps* caps) { | |
13 return !caps->pathRenderingSupport(); | |
14 } | |
15 | 11 |
16 GrInOrderDrawBuffer::GrInOrderDrawBuffer(GrContext* context) | 12 GrInOrderDrawBuffer::GrInOrderDrawBuffer(GrContext* context) |
17 : INHERITED(context) | 13 : INHERITED(context) |
18 , fCommands(GrCommandBuilder::Create(context->getGpu(), | 14 , fCommands(GrCommandBuilder::Create(context->getGpu(), kEnableReordering)) |
19 allow_reordering(context->getGpu()->cap
s()->shaderCaps()))) | |
20 , fPathIndexBuffer(kPathIdxBufferMinReserve * sizeof(char)/4) | 15 , fPathIndexBuffer(kPathIdxBufferMinReserve * sizeof(char)/4) |
21 , fPathTransformBuffer(kPathXformBufferMinReserve * sizeof(float)/4) | 16 , fPathTransformBuffer(kPathXformBufferMinReserve * sizeof(float)/4) |
22 , fPipelineBuffer(kPipelineBufferMinReserve) | 17 , fPipelineBuffer(kPipelineBufferMinReserve) |
23 , fDrawID(0) { | 18 , fDrawID(0) { |
24 } | 19 } |
25 | 20 |
26 GrInOrderDrawBuffer::~GrInOrderDrawBuffer() { | 21 GrInOrderDrawBuffer::~GrInOrderDrawBuffer() { |
27 this->reset(); | 22 this->reset(); |
28 } | 23 } |
29 | 24 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 fPrevState->getPipeline()->isEqual(*state->getPipeline())) { | 189 fPrevState->getPipeline()->isEqual(*state->getPipeline())) { |
195 this->unallocState(state); | 190 this->unallocState(state); |
196 } else { | 191 } else { |
197 fPrevState.reset(state); | 192 fPrevState.reset(state); |
198 } | 193 } |
199 | 194 |
200 this->recordTraceMarkersIfNecessary( | 195 this->recordTraceMarkersIfNecessary( |
201 fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(),
*this->caps())); | 196 fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(),
*this->caps())); |
202 return fPrevState; | 197 return fPrevState; |
203 } | 198 } |
OLD | NEW |