| OLD | NEW |
| 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 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 | 1146 |
| 1147 VK_CALL(CmdPipelineBarrier(cmdBuffer, | 1147 VK_CALL(CmdPipelineBarrier(cmdBuffer, |
| 1148 GrVkMemory::LayoutToPipelineStageFlags(in
itialLayout), | 1148 GrVkMemory::LayoutToPipelineStageFlags(in
itialLayout), |
| 1149 VK_PIPELINE_STAGE_TRANSFER_BIT, | 1149 VK_PIPELINE_STAGE_TRANSFER_BIT, |
| 1150 0, | 1150 0, |
| 1151 0, nullptr, | 1151 0, nullptr, |
| 1152 0, nullptr, | 1152 0, nullptr, |
| 1153 1, &barrier)); | 1153 1, &barrier)); |
| 1154 initialLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; | 1154 initialLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; |
| 1155 | 1155 |
| 1156 // Make sure buffer has finished the unmap | |
| 1157 VkBufferMemoryBarrier bufBarrier; | |
| 1158 memset(&barrier, 0, sizeof(VkImageMemoryBarrier)); | |
| 1159 bufBarrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER; | |
| 1160 bufBarrier.pNext = nullptr; | |
| 1161 bufBarrier.srcAccessMask = VK_ACCESS_HOST_WRITE_BIT; | |
| 1162 bufBarrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; | |
| 1163 bufBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; | |
| 1164 bufBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; | |
| 1165 bufBarrier.buffer = buffer; | |
| 1166 bufBarrier.offset = 0; | |
| 1167 bufBarrier.size = bufInfo.size; | |
| 1168 | |
| 1169 VK_CALL(CmdPipelineBarrier(cmdBuffer, | |
| 1170 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, | |
| 1171 VK_PIPELINE_STAGE_TRANSFER_BIT, | |
| 1172 0, | |
| 1173 0, nullptr, | |
| 1174 1, &bufBarrier, | |
| 1175 0, nullptr)); | |
| 1176 | |
| 1177 // Submit copy command | 1156 // Submit copy command |
| 1178 VkBufferImageCopy region; | 1157 VkBufferImageCopy region; |
| 1179 memset(®ion, 0, sizeof(VkBufferImageCopy)); | 1158 memset(®ion, 0, sizeof(VkBufferImageCopy)); |
| 1180 region.bufferOffset = 0; | 1159 region.bufferOffset = 0; |
| 1181 region.bufferRowLength = w; | 1160 region.bufferRowLength = w; |
| 1182 region.bufferImageHeight = h; | 1161 region.bufferImageHeight = h; |
| 1183 region.imageSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 }; | 1162 region.imageSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 }; |
| 1184 region.imageOffset = { 0, 0, 0 }; | 1163 region.imageOffset = { 0, 0, 0 }; |
| 1185 region.imageExtent = { (uint32_t)w, (uint32_t)h, 1 }; | 1164 region.imageExtent = { (uint32_t)w, (uint32_t)h, 1 }; |
| 1186 | 1165 |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1796 // Currently it is fine for us to always pass in 1 for the clear count even
if no attachment | 1775 // Currently it is fine for us to always pass in 1 for the clear count even
if no attachment |
| 1797 // uses it. In the current state, we also only use the LOAD_OP_CLEAR for the
color attachment | 1776 // uses it. In the current state, we also only use the LOAD_OP_CLEAR for the
color attachment |
| 1798 // which is always at the first attachment. | 1777 // which is always at the first attachment. |
| 1799 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target,
*pBounds, true); | 1778 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target,
*pBounds, true); |
| 1800 fCurrentCmdBuffer->executeCommands(this, buffer); | 1779 fCurrentCmdBuffer->executeCommands(this, buffer); |
| 1801 fCurrentCmdBuffer->endRenderPass(this); | 1780 fCurrentCmdBuffer->endRenderPass(this); |
| 1802 | 1781 |
| 1803 this->didWriteToSurface(target, &bounds); | 1782 this->didWriteToSurface(target, &bounds); |
| 1804 } | 1783 } |
| 1805 | 1784 |
| OLD | NEW |