Index: src/gpu/vk/GrVkBuffer.cpp |
diff --git a/src/gpu/vk/GrVkBuffer.cpp b/src/gpu/vk/GrVkBuffer.cpp |
index 0228cd8b2b896580ba6ba3e16bb659afa0d46423..0718fa5e929af16a232dcf9685bb7bf74c32734c 100644 |
--- a/src/gpu/vk/GrVkBuffer.cpp |
+++ b/src/gpu/vk/GrVkBuffer.cpp |
@@ -125,8 +125,11 @@ void* GrVkBuffer::vkMap(const GrVkGpu* gpu) { |
VALIDATE(); |
SkASSERT(!this->vkIsMapped()); |
- // we should be the only owner |
- SkASSERT(fResource->unique()); |
+ if (!fResource->unique()) { |
+ // in use by the command buffer, so we need to create a new one |
+ fResource->unref(gpu); |
+ fResource = Create(gpu, fDesc); |
+ } |
VkResult err = VK_CALL(gpu, MapMemory(gpu->device(), alloc(), 0, VK_WHOLE_SIZE, 0, &fMapPtr)); |
if (err) { |