OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #ifndef GrVkBuffer_DEFINED | 8 #ifndef GrVkBuffer_DEFINED |
9 #define GrVkBuffer_DEFINED | 9 #define GrVkBuffer_DEFINED |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // convenience routine for raw buffer creation | 66 // convenience routine for raw buffer creation |
67 static const Resource* Create(const GrVkGpu* gpu, | 67 static const Resource* Create(const GrVkGpu* gpu, |
68 const Desc& descriptor); | 68 const Desc& descriptor); |
69 | 69 |
70 GrVkBuffer(const Desc& desc, const GrVkBuffer::Resource* resource) | 70 GrVkBuffer(const Desc& desc, const GrVkBuffer::Resource* resource) |
71 : fDesc(desc), fResource(resource), fMapPtr(nullptr) { | 71 : fDesc(desc), fResource(resource), fMapPtr(nullptr) { |
72 } | 72 } |
73 | 73 |
74 void* vkMap(const GrVkGpu* gpu); | 74 void* vkMap(const GrVkGpu* gpu); |
75 void vkUnmap(const GrVkGpu* gpu); | 75 void vkUnmap(const GrVkGpu* gpu); |
76 bool vkUpdateData(const GrVkGpu* gpu, const void* src, size_t srcSizeInBytes
); | 76 // If the caller passes in a non null createdNewBuffer, this function will s
et the bool to true |
| 77 // if it creates a new VkBuffer to upload the data to. |
| 78 bool vkUpdateData(const GrVkGpu* gpu, const void* src, size_t srcSizeInBytes
, |
| 79 bool* createdNewBuffer = nullptr); |
77 | 80 |
78 void vkAbandon(); | 81 void vkAbandon(); |
79 void vkRelease(const GrVkGpu* gpu); | 82 void vkRelease(const GrVkGpu* gpu); |
80 | 83 |
81 private: | 84 private: |
82 void validate() const; | 85 void validate() const; |
83 bool vkIsMapped() const; | 86 bool vkIsMapped() const; |
84 | 87 |
85 Desc fDesc; | 88 Desc fDesc; |
86 const Resource* fResource; | 89 const Resource* fResource; |
87 void* fMapPtr; | 90 void* fMapPtr; |
88 | 91 |
89 typedef SkNoncopyable INHERITED; | 92 typedef SkNoncopyable INHERITED; |
90 }; | 93 }; |
91 | 94 |
92 #endif | 95 #endif |
OLD | NEW |