OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #ifndef GrGeometryBuffer_DEFINED | 10 #ifndef GrGeometryBuffer_DEFINED |
11 #define GrGeometryBuffer_DEFINED | 11 #define GrGeometryBuffer_DEFINED |
12 | 12 |
13 #include "GrResource.h" | 13 #include "GrGpuObject.h" |
14 | 14 |
15 class GrGpu; | 15 class GrGpu; |
16 | 16 |
17 /** | 17 /** |
18 * Parent class for vertex and index buffers | 18 * Parent class for vertex and index buffers |
19 */ | 19 */ |
20 class GrGeometryBuffer : public GrResource { | 20 class GrGeometryBuffer : public GrGpuObject { |
21 public: | 21 public: |
22 SK_DECLARE_INST_COUNT(GrGeometryBuffer); | 22 SK_DECLARE_INST_COUNT(GrGeometryBuffer); |
23 | 23 |
24 /** | 24 /** |
25 *Retrieves whether the buffer was created with the dynamic flag | 25 *Retrieves whether the buffer was created with the dynamic flag |
26 * | 26 * |
27 * @return true if the buffer was created with the dynamic flag | 27 * @return true if the buffer was created with the dynamic flag |
28 */ | 28 */ |
29 bool dynamic() const { return fDynamic; } | 29 bool dynamic() const { return fDynamic; } |
30 | 30 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 * Updates the buffer data. | 75 * Updates the buffer data. |
76 * | 76 * |
77 * The size of the buffer will be preserved. The src data will be | 77 * The size of the buffer will be preserved. The src data will be |
78 * placed at the beginning of the buffer and any remaining contents will | 78 * placed at the beginning of the buffer and any remaining contents will |
79 * be undefined. | 79 * be undefined. |
80 * | 80 * |
81 * @return returns true if the update succeeds, false otherwise. | 81 * @return returns true if the update succeeds, false otherwise. |
82 */ | 82 */ |
83 virtual bool updateData(const void* src, size_t srcSizeInBytes) = 0; | 83 virtual bool updateData(const void* src, size_t srcSizeInBytes) = 0; |
84 | 84 |
85 // GrResource overrides | 85 // GrGpuObject overrides |
86 virtual size_t sizeInBytes() const { return fSizeInBytes; } | 86 virtual size_t gpuMemorySize() const { return fGpuMemorySize; } |
87 | 87 |
88 protected: | 88 protected: |
89 GrGeometryBuffer(GrGpu* gpu, bool isWrapped, size_t sizeInBytes, bool dynami
c, bool cpuBacked) | 89 GrGeometryBuffer(GrGpu* gpu, bool isWrapped, size_t gpuMemorySize, bool dyna
mic, bool cpuBacked) |
90 : INHERITED(gpu, isWrapped) | 90 : INHERITED(gpu, isWrapped) |
91 , fSizeInBytes(sizeInBytes) | 91 , fGpuMemorySize(gpuMemorySize) |
92 , fDynamic(dynamic) | 92 , fDynamic(dynamic) |
93 , fCPUBacked(cpuBacked) {} | 93 , fCPUBacked(cpuBacked) {} |
94 | 94 |
95 private: | 95 private: |
96 size_t fSizeInBytes; | 96 size_t fGpuMemorySize; |
97 bool fDynamic; | 97 bool fDynamic; |
98 bool fCPUBacked; | 98 bool fCPUBacked; |
99 | 99 |
100 typedef GrResource INHERITED; | 100 typedef GrGpuObject INHERITED; |
101 }; | 101 }; |
102 | 102 |
103 #endif | 103 #endif |
OLD | NEW |