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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 // convenience routine for raw buffer creation | 75 // convenience routine for raw buffer creation |
76 static const Resource* Create(const GrVkGpu* gpu, | 76 static const Resource* Create(const GrVkGpu* gpu, |
77 const Desc& descriptor); | 77 const Desc& descriptor); |
78 | 78 |
79 GrVkBuffer(const Desc& desc, const GrVkBuffer::Resource* resource) | 79 GrVkBuffer(const Desc& desc, const GrVkBuffer::Resource* resource) |
80 : fDesc(desc), fResource(resource), fMapPtr(nullptr) { | 80 : fDesc(desc), fResource(resource), fMapPtr(nullptr) { |
81 } | 81 } |
82 | 82 |
83 void* vkMap(const GrVkGpu* gpu); | 83 void* vkMap(const GrVkGpu* gpu); |
84 void vkUnmap(const GrVkGpu* gpu); | 84 void vkUnmap(GrVkGpu* gpu); |
85 // If the caller passes in a non null createdNewBuffer, this function will s
et the bool to true | 85 // If the caller passes in a non null createdNewBuffer, this function will s
et the bool to true |
86 // if it creates a new VkBuffer to upload the data to. | 86 // if it creates a new VkBuffer to upload the data to. |
87 bool vkUpdateData(GrVkGpu* gpu, const void* src, size_t srcSizeInBytes, | 87 bool vkUpdateData(GrVkGpu* gpu, const void* src, size_t srcSizeInBytes, |
88 bool* createdNewBuffer = nullptr); | 88 bool* createdNewBuffer = nullptr); |
89 | 89 |
90 void vkAbandon(); | 90 void vkAbandon(); |
91 void vkRelease(const GrVkGpu* gpu); | 91 void vkRelease(const GrVkGpu* gpu); |
92 | 92 |
93 private: | 93 private: |
94 void validate() const; | 94 void validate() const; |
95 bool vkIsMapped() const; | 95 bool vkIsMapped() const; |
96 | 96 |
97 Desc fDesc; | 97 Desc fDesc; |
98 const Resource* fResource; | 98 const Resource* fResource; |
99 void* fMapPtr; | 99 void* fMapPtr; |
100 | 100 |
101 typedef SkNoncopyable INHERITED; | 101 typedef SkNoncopyable INHERITED; |
102 }; | 102 }; |
103 | 103 |
104 #endif | 104 #endif |
OLD | NEW |