| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 VALIDATE(); | 175 VALIDATE(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void GrVkBuffer::internalUnmap(GrVkGpu* gpu, size_t size) { | 178 void GrVkBuffer::internalUnmap(GrVkGpu* gpu, size_t size) { |
| 179 VALIDATE(); | 179 VALIDATE(); |
| 180 SkASSERT(this->vkIsMapped()); | 180 SkASSERT(this->vkIsMapped()); |
| 181 | 181 |
| 182 if (fDesc.fDynamic) { | 182 if (fDesc.fDynamic) { |
| 183 GrVkMemory::FlushMappedAlloc(gpu, this->alloc()); |
| 183 VK_CALL(gpu, UnmapMemory(gpu->device(), this->alloc().fMemory)); | 184 VK_CALL(gpu, UnmapMemory(gpu->device(), this->alloc().fMemory)); |
| 184 fMapPtr = nullptr; | 185 fMapPtr = nullptr; |
| 185 } else { | 186 } else { |
| 186 gpu->updateBuffer(this, fMapPtr, this->offset(), size); | 187 gpu->updateBuffer(this, fMapPtr, this->offset(), size); |
| 187 this->addMemoryBarrier(gpu, | 188 this->addMemoryBarrier(gpu, |
| 188 VK_ACCESS_TRANSFER_WRITE_BIT, | 189 VK_ACCESS_TRANSFER_WRITE_BIT, |
| 189 buffer_type_to_access_flags(fDesc.fType), | 190 buffer_type_to_access_flags(fDesc.fType), |
| 190 VK_PIPELINE_STAGE_TRANSFER_BIT, | 191 VK_PIPELINE_STAGE_TRANSFER_BIT, |
| 191 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, | 192 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, |
| 192 false); | 193 false); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 214 this->internalUnmap(gpu, srcSizeInBytes); | 215 this->internalUnmap(gpu, srcSizeInBytes); |
| 215 | 216 |
| 216 return true; | 217 return true; |
| 217 } | 218 } |
| 218 | 219 |
| 219 void GrVkBuffer::validate() const { | 220 void GrVkBuffer::validate() const { |
| 220 SkASSERT(!fResource || kVertex_Type == fDesc.fType || kIndex_Type == fDesc.f
Type | 221 SkASSERT(!fResource || kVertex_Type == fDesc.fType || kIndex_Type == fDesc.f
Type |
| 221 || kCopyRead_Type == fDesc.fType || kCopyWrite_Type == fDesc.fType | 222 || kCopyRead_Type == fDesc.fType || kCopyWrite_Type == fDesc.fType |
| 222 || kUniform_Type == fDesc.fType); | 223 || kUniform_Type == fDesc.fType); |
| 223 } | 224 } |
| OLD | NEW |