| 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; | |
| 130 fMapPtr = nullptr; | 129 fMapPtr = nullptr; |
| 131 VALIDATE(); | 130 VALIDATE(); |
| 132 } | 131 } |
| 133 | 132 |
| 134 void* GrVkBuffer::vkMap(const GrVkGpu* gpu) { | 133 void* GrVkBuffer::vkMap(const GrVkGpu* gpu) { |
| 135 VALIDATE(); | 134 VALIDATE(); |
| 136 SkASSERT(!this->vkIsMapped()); | 135 SkASSERT(!this->vkIsMapped()); |
| 137 | 136 |
| 138 if (!fResource->unique()) { | 137 if (!fResource->unique()) { |
| 139 // in use by the command buffer, so we need to create a new one | 138 // 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... |
| 193 VK_CALL(gpu, UnmapMemory(gpu->device(), alloc())); | 192 VK_CALL(gpu, UnmapMemory(gpu->device(), alloc())); |
| 194 | 193 |
| 195 return true; | 194 return true; |
| 196 } | 195 } |
| 197 | 196 |
| 198 void GrVkBuffer::validate() const { | 197 void GrVkBuffer::validate() const { |
| 199 SkASSERT(!fResource || kVertex_Type == fDesc.fType || kIndex_Type == fDesc.f
Type | 198 SkASSERT(!fResource || kVertex_Type == fDesc.fType || kIndex_Type == fDesc.f
Type |
| 200 || kCopyRead_Type == fDesc.fType || kCopyWrite_Type == fDesc.fType | 199 || kCopyRead_Type == fDesc.fType || kCopyWrite_Type == fDesc.fType |
| 201 || kUniform_Type == fDesc.fType); | 200 || kUniform_Type == fDesc.fType); |
| 202 } | 201 } |
| OLD | NEW |