Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: src/gpu/vk/GrVkBuffer.cpp

Issue 2123323002: Vulkan fixes for TesselatingPathRenderer test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix void* delete Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkBuffer.h ('k') | src/gpu/vk/GrVkResourceProvider.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkBuffer.cpp
diff --git a/src/gpu/vk/GrVkBuffer.cpp b/src/gpu/vk/GrVkBuffer.cpp
index d28a8ccbf1e1cfaf542dd0293a47e13a21ed9ee2..e8fe619a435fa1052c09f3b9dcb7fc94a30d1980 100644
--- a/src/gpu/vk/GrVkBuffer.cpp
+++ b/src/gpu/vk/GrVkBuffer.cpp
@@ -124,33 +124,37 @@ void GrVkBuffer::vkAbandon() {
void* GrVkBuffer::vkMap(const GrVkGpu* gpu) {
VALIDATE();
SkASSERT(!this->vkIsMapped());
- if (!fDesc.fDynamic) {
- return nullptr;
- }
-
if (!fResource->unique()) {
// in use by the command buffer, so we need to create a new one
fResource->unref(gpu);
fResource = Create(gpu, fDesc);
}
- const GrVkAlloc& alloc = this->alloc();
- VkResult err = VK_CALL(gpu, MapMemory(gpu->device(), alloc.fMemory, alloc.fOffset,
- VK_WHOLE_SIZE, 0, &fMapPtr));
- if (err) {
- fMapPtr = nullptr;
+ if (fDesc.fDynamic) {
+ const GrVkAlloc& alloc = this->alloc();
+ VkResult err = VK_CALL(gpu, MapMemory(gpu->device(), alloc.fMemory, alloc.fOffset,
+ VK_WHOLE_SIZE, 0, &fMapPtr));
+ if (err) {
+ fMapPtr = nullptr;
+ }
+ } else {
+ fMapPtr = new unsigned char[this->size()];
}
VALIDATE();
return fMapPtr;
}
-void GrVkBuffer::vkUnmap(const GrVkGpu* gpu) {
+void GrVkBuffer::vkUnmap(GrVkGpu* gpu) {
VALIDATE();
SkASSERT(this->vkIsMapped());
- SkASSERT(fDesc.fDynamic);
- VK_CALL(gpu, UnmapMemory(gpu->device(), this->alloc().fMemory));
+ if (fDesc.fDynamic) {
+ VK_CALL(gpu, UnmapMemory(gpu->device(), this->alloc().fMemory));
+ } else {
+ gpu->updateBuffer(this, fMapPtr, this->size());
+ delete (unsigned char*) fMapPtr;
+ }
fMapPtr = nullptr;
}
« no previous file with comments | « src/gpu/vk/GrVkBuffer.h ('k') | src/gpu/vk/GrVkResourceProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698