OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 static const int INDEX_POOL_IB_COUNT = 4; | 23 static const int INDEX_POOL_IB_COUNT = 4; |
24 | 24 |
25 //////////////////////////////////////////////////////////////////////////////// | 25 //////////////////////////////////////////////////////////////////////////////// |
26 | 26 |
27 #define DEBUG_INVAL_BUFFER 0xdeadcafe | 27 #define DEBUG_INVAL_BUFFER 0xdeadcafe |
28 #define DEBUG_INVAL_START_IDX -1 | 28 #define DEBUG_INVAL_START_IDX -1 |
29 | 29 |
30 GrGpu::GrGpu(GrContext* context) | 30 GrGpu::GrGpu(GrContext* context) |
31 : GrDrawTarget(context) | 31 : GrDrawTarget(context) |
32 , fResetTimestamp(kExpiredTimestamp+1) | 32 , fResetTimestamp(kExpiredTimestamp+1) |
| 33 , fResetBits(kAll_GrBackendState) |
33 , fVertexPool(NULL) | 34 , fVertexPool(NULL) |
34 , fIndexPool(NULL) | 35 , fIndexPool(NULL) |
35 , fVertexPoolUseCnt(0) | 36 , fVertexPoolUseCnt(0) |
36 , fIndexPoolUseCnt(0) | 37 , fIndexPoolUseCnt(0) |
37 , fQuadIndexBuffer(NULL) | 38 , fQuadIndexBuffer(NULL) { |
38 , fContextIsDirty(true) { | |
39 | 39 |
40 fClipMaskManager.setGpu(this); | 40 fClipMaskManager.setGpu(this); |
41 | 41 |
42 fGeomPoolStateStack.push_back(); | 42 fGeomPoolStateStack.push_back(); |
43 #if GR_DEBUG | 43 #if GR_DEBUG |
44 GeometryPoolState& poolState = fGeomPoolStateStack.back(); | 44 GeometryPoolState& poolState = fGeomPoolStateStack.back(); |
45 poolState.fPoolVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER; | 45 poolState.fPoolVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER; |
46 poolState.fPoolStartVertex = DEBUG_INVAL_START_IDX; | 46 poolState.fPoolStartVertex = DEBUG_INVAL_START_IDX; |
47 poolState.fPoolIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER; | 47 poolState.fPoolIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER; |
48 poolState.fPoolStartIndex = DEBUG_INVAL_START_IDX; | 48 poolState.fPoolStartIndex = DEBUG_INVAL_START_IDX; |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 } | 490 } |
491 | 491 |
492 void GrGpu::releaseIndexArray() { | 492 void GrGpu::releaseIndexArray() { |
493 // if index source was array, we stowed data in the pool | 493 // if index source was array, we stowed data in the pool |
494 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 494 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
495 GrAssert(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 495 GrAssert(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
496 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 496 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
497 fIndexPool->putBack(bytes); | 497 fIndexPool->putBack(bytes); |
498 --fIndexPoolUseCnt; | 498 --fIndexPoolUseCnt; |
499 } | 499 } |
OLD | NEW |