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

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

Issue 2127183002: Add offsets to GrVkBuffer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/GrVkCommandBuffer.h » ('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 85d6de8b01394b198f61fd810f2054213d314bf8..3b9cbc735c5c8f6fbe7f64e052a3a49a087eea88 100644
--- a/src/gpu/vk/GrVkBuffer.cpp
+++ b/src/gpu/vk/GrVkBuffer.cpp
@@ -132,8 +132,9 @@ void* GrVkBuffer::vkMap(const GrVkGpu* gpu) {
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));
+ VkResult err = VK_CALL(gpu, MapMemory(gpu->device(), alloc.fMemory,
+ alloc.fOffset + fOffset,
+ fDesc.fSizeInBytes, 0, &fMapPtr));
if (err) {
fMapPtr = nullptr;
}
@@ -152,7 +153,7 @@ void GrVkBuffer::vkUnmap(GrVkGpu* gpu) {
if (fDesc.fDynamic) {
VK_CALL(gpu, UnmapMemory(gpu->device(), this->alloc().fMemory));
} else {
- gpu->updateBuffer(this, fMapPtr, this->size());
+ gpu->updateBuffer(this, fMapPtr, this->offset(), this->size());
delete [] (unsigned char*)fMapPtr;
}
@@ -172,8 +173,9 @@ bool GrVkBuffer::vkUpdateData(GrVkGpu* gpu, const void* src, size_t srcSizeInByt
return false;
}
+ // TODO: update data based on buffer offset
if (!fDesc.fDynamic) {
- return gpu->updateBuffer(this, src, srcSizeInBytes);
+ return gpu->updateBuffer(this, src, fOffset, srcSizeInBytes);
}
if (!fResource->unique()) {
@@ -187,7 +189,8 @@ bool GrVkBuffer::vkUpdateData(GrVkGpu* gpu, const void* src, size_t srcSizeInByt
void* mapPtr;
const GrVkAlloc& alloc = this->alloc();
- VkResult err = VK_CALL(gpu, MapMemory(gpu->device(), alloc.fMemory, alloc.fOffset,
+ VkResult err = VK_CALL(gpu, MapMemory(gpu->device(), alloc.fMemory,
+ alloc.fOffset + fOffset,
srcSizeInBytes, 0, &mapPtr));
if (VK_SUCCESS != err) {
« no previous file with comments | « src/gpu/vk/GrVkBuffer.h ('k') | src/gpu/vk/GrVkCommandBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698