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 "GrBufferAllocPool.h" | 10 #include "GrBufferAllocPool.h" |
11 #include "GrCaps.h" | 11 #include "GrCaps.h" |
12 #include "GrGpu.h" | 12 #include "GrGpu.h" |
13 #include "GrIndexBuffer.h" | 13 #include "GrIndexBuffer.h" |
14 #include "GrTypes.h" | 14 #include "GrTypes.h" |
15 #include "GrVertexBuffer.h" | 15 #include "GrVertexBuffer.h" |
16 | 16 |
17 #include "SkTraceEvent.h" | 17 #include "SkTraceEvent.h" |
18 | 18 |
19 #ifdef SK_DEBUG | 19 #ifdef SK_DEBUG |
20 #define VALIDATE validate | 20 #define VALIDATE validate |
21 #else | 21 #else |
22 static void VALIDATE(bool = false) {} | 22 static void VALIDATE(bool = false) {} |
23 #endif | 23 #endif |
24 | 24 |
25 // page size | 25 // page size |
26 #define GrBufferAllocPool_MIN_BLOCK_SIZE ((size_t)1 << 12) | 26 #define GrBufferAllocPool_MIN_BLOCK_SIZE ((size_t)1 << 15) |
27 | 27 |
28 #define UNMAP_BUFFER(block)
\ | 28 #define UNMAP_BUFFER(block)
\ |
29 do {
\ | 29 do {
\ |
30 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("skia.gpu"),
\ | 30 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("skia.gpu"),
\ |
31 "GrBufferAllocPool Unmapping Buffer",
\ | 31 "GrBufferAllocPool Unmapping Buffer",
\ |
32 TRACE_EVENT_SCOPE_THREAD,
\ | 32 TRACE_EVENT_SCOPE_THREAD,
\ |
33 "percent_unwritten",
\ | 33 "percent_unwritten",
\ |
34 (float)((block).fBytesFree) / (block).fBuffer->gpuMemor
ySize()); \ | 34 (float)((block).fBytesFree) / (block).fBuffer->gpuMemor
ySize()); \ |
35 (block).fBuffer->unmap();
\ | 35 (block).fBuffer->unmap();
\ |
36 } while (false) | 36 } while (false) |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 &geomBuffer, | 413 &geomBuffer, |
414 &offset); | 414 &offset); |
415 | 415 |
416 *buffer = (const GrIndexBuffer*) geomBuffer; | 416 *buffer = (const GrIndexBuffer*) geomBuffer; |
417 SkASSERT(0 == offset % sizeof(uint16_t)); | 417 SkASSERT(0 == offset % sizeof(uint16_t)); |
418 *startIndex = static_cast<int>(offset / sizeof(uint16_t)); | 418 *startIndex = static_cast<int>(offset / sizeof(uint16_t)); |
419 return ptr; | 419 return ptr; |
420 } | 420 } |
421 | 421 |
422 | 422 |
OLD | NEW |