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

Unified Diff: src/gpu/vk/GrVkGpu.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/GrVkGpu.h ('k') | src/gpu/vk/GrVkPipelineState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkGpu.cpp
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index fdec8610765383b1abfd3a380643958c9de6a858..fcbe6eeb58c8b5f21d1553895410da3b95eeca7b 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -533,7 +533,7 @@ bool GrVkGpu::uploadTexDataOptimal(GrVkTexture* tex,
VkBufferImageCopy& region = regions.push_back();
memset(&region, 0, sizeof(VkBufferImageCopy));
- region.bufferOffset = individualMipOffsets[currentMipLevel];
+ region.bufferOffset = transferBuffer->offset() + individualMipOffsets[currentMipLevel];
region.bufferRowLength = currentWidth;
region.bufferImageHeight = currentHeight;
region.imageSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, SkToU32(currentMipLevel), 0, 1 };
@@ -670,10 +670,11 @@ GrTexture* GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budget
////////////////////////////////////////////////////////////////////////////////
-bool GrVkGpu::updateBuffer(GrVkBuffer* buffer, const void* src, size_t srcSizeInBytes) {
+bool GrVkGpu::updateBuffer(GrVkBuffer* buffer, const void* src,
+ VkDeviceSize offset, VkDeviceSize size) {
// Update the buffer
- fCurrentCmdBuffer->updateBuffer(this, buffer, 0, srcSizeInBytes, src);
+ fCurrentCmdBuffer->updateBuffer(this, buffer, offset, size, src);
return true;
}
@@ -1445,7 +1446,7 @@ bool GrVkGpu::onReadPixels(GrSurface* surface,
// Copy the image to a buffer so we can map it to cpu memory
VkBufferImageCopy region;
memset(&region, 0, sizeof(VkBufferImageCopy));
- region.bufferOffset = 0;
+ region.bufferOffset = transferBuffer->offset();
region.bufferRowLength = 0; // Forces RowLength to be width. We handle the rowBytes below.
region.bufferImageHeight = 0; // Forces height to be tightly packed. Only useful for 3d images.
region.imageSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 };
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | src/gpu/vk/GrVkPipelineState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698