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

Side by Side Diff: src/gpu/vk/GrVkGpu.cpp

Issue 2344323002: Refactor vulkan buffer mapping and unmapping (Closed)
Patch Set: inner->internal Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/gpu/vk/GrVkBuffer.cpp ('k') | src/gpu/vk/GrVkUniformBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrVkGpu.h" 8 #include "GrVkGpu.h"
9 9
10 #include "GrContextOptions.h" 10 #include "GrContextOptions.h"
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 region.imageSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, SkToU32(currentMi pLevel), 0, 1 }; 594 region.imageSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, SkToU32(currentMi pLevel), 0, 1 };
595 region.imageOffset = { left, flipY ? tex->height() - top - currentHeight : top, 0 }; 595 region.imageOffset = { left, flipY ? tex->height() - top - currentHeight : top, 0 };
596 region.imageExtent = { (uint32_t)currentWidth, (uint32_t)currentHeight, 1 }; 596 region.imageExtent = { (uint32_t)currentWidth, (uint32_t)currentHeight, 1 };
597 597
598 currentWidth = SkTMax(1, currentWidth/2); 598 currentWidth = SkTMax(1, currentWidth/2);
599 currentHeight = SkTMax(1, currentHeight/2); 599 currentHeight = SkTMax(1, currentHeight/2);
600 } 600 }
601 601
602 transferBuffer->unmap(); 602 transferBuffer->unmap();
603 603
604 // make sure the unmap has finished
605 transferBuffer->addMemoryBarrier(this,
606 VK_ACCESS_HOST_WRITE_BIT,
607 VK_ACCESS_TRANSFER_READ_BIT,
608 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
609 VK_PIPELINE_STAGE_TRANSFER_BIT,
610 false);
611
612 // Change layout of our target so it can be copied to 604 // Change layout of our target so it can be copied to
613 tex->setImageLayout(this, 605 tex->setImageLayout(this,
614 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 606 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
615 VK_ACCESS_TRANSFER_WRITE_BIT, 607 VK_ACCESS_TRANSFER_WRITE_BIT,
616 VK_PIPELINE_STAGE_TRANSFER_BIT, 608 VK_PIPELINE_STAGE_TRANSFER_BIT,
617 false); 609 false);
618 610
619 // Copy the buffer to the image 611 // Copy the buffer to the image
620 fCurrentCmdBuffer->copyBufferToImage(this, 612 fCurrentCmdBuffer->copyBufferToImage(this,
621 transferBuffer, 613 transferBuffer,
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 // Currently it is fine for us to always pass in 1 for the clear count even if no attachment 1841 // Currently it is fine for us to always pass in 1 for the clear count even if no attachment
1850 // uses it. In the current state, we also only use the LOAD_OP_CLEAR for the color attachment 1842 // uses it. In the current state, we also only use the LOAD_OP_CLEAR for the color attachment
1851 // which is always at the first attachment. 1843 // which is always at the first attachment.
1852 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target, *pBounds, true); 1844 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target, *pBounds, true);
1853 fCurrentCmdBuffer->executeCommands(this, buffer); 1845 fCurrentCmdBuffer->executeCommands(this, buffer);
1854 fCurrentCmdBuffer->endRenderPass(this); 1846 fCurrentCmdBuffer->endRenderPass(this);
1855 1847
1856 this->didWriteToSurface(target, &bounds); 1848 this->didWriteToSurface(target, &bounds);
1857 } 1849 }
1858 1850
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkBuffer.cpp ('k') | src/gpu/vk/GrVkUniformBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698