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 #include "GrVkBuffer.h" | 8 #include "GrVkBuffer.h" |
9 #include "GrVkGpu.h" | 9 #include "GrVkGpu.h" |
10 #include "GrVkMemory.h" | 10 #include "GrVkMemory.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 void GrVkBuffer::vkRelease(const GrVkGpu* gpu) { | 119 void GrVkBuffer::vkRelease(const GrVkGpu* gpu) { |
120 VALIDATE(); | 120 VALIDATE(); |
121 fResource->unref(gpu); | 121 fResource->unref(gpu); |
122 fResource = nullptr; | 122 fResource = nullptr; |
123 fMapPtr = nullptr; | 123 fMapPtr = nullptr; |
124 VALIDATE(); | 124 VALIDATE(); |
125 } | 125 } |
126 | 126 |
127 void GrVkBuffer::vkAbandon() { | 127 void GrVkBuffer::vkAbandon() { |
128 fResource->unrefAndAbandon(); | 128 fResource->unrefAndAbandon(); |
| 129 fResource = nullptr; |
129 fMapPtr = nullptr; | 130 fMapPtr = nullptr; |
130 VALIDATE(); | 131 VALIDATE(); |
131 } | 132 } |
132 | 133 |
133 void* GrVkBuffer::vkMap(const GrVkGpu* gpu) { | 134 void* GrVkBuffer::vkMap(const GrVkGpu* gpu) { |
134 VALIDATE(); | 135 VALIDATE(); |
135 SkASSERT(!this->vkIsMapped()); | 136 SkASSERT(!this->vkIsMapped()); |
136 | 137 |
137 if (!fResource->unique()) { | 138 if (!fResource->unique()) { |
138 // in use by the command buffer, so we need to create a new one | 139 // in use by the command buffer, so we need to create a new one |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 VK_CALL(gpu, UnmapMemory(gpu->device(), alloc())); | 193 VK_CALL(gpu, UnmapMemory(gpu->device(), alloc())); |
193 | 194 |
194 return true; | 195 return true; |
195 } | 196 } |
196 | 197 |
197 void GrVkBuffer::validate() const { | 198 void GrVkBuffer::validate() const { |
198 SkASSERT(!fResource || kVertex_Type == fDesc.fType || kIndex_Type == fDesc.f
Type | 199 SkASSERT(!fResource || kVertex_Type == fDesc.fType || kIndex_Type == fDesc.f
Type |
199 || kCopyRead_Type == fDesc.fType || kCopyWrite_Type == fDesc.fType | 200 || kCopyRead_Type == fDesc.fType || kCopyWrite_Type == fDesc.fType |
200 || kUniform_Type == fDesc.fType); | 201 || kUniform_Type == fDesc.fType); |
201 } | 202 } |
OLD | NEW |