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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 // Release old command buffer and create a new one | 166 // Release old command buffer and create a new one |
167 fCurrentCmdBuffer->unref(this); | 167 fCurrentCmdBuffer->unref(this); |
168 fCurrentCmdBuffer = fResourceProvider.createCommandBuffer(); | 168 fCurrentCmdBuffer = fResourceProvider.createCommandBuffer(); |
169 SkASSERT(fCurrentCmdBuffer); | 169 SkASSERT(fCurrentCmdBuffer); |
170 | 170 |
171 fCurrentCmdBuffer->begin(this); | 171 fCurrentCmdBuffer->begin(this); |
172 } | 172 } |
173 | 173 |
174 /////////////////////////////////////////////////////////////////////////////// | 174 /////////////////////////////////////////////////////////////////////////////// |
175 GrBuffer* GrVkGpu::onCreateBuffer(GrBufferType type, size_t size, GrAccessPatter
n accessPattern) { | 175 GrBuffer* GrVkGpu::onCreateBuffer(size_t size, GrBufferType type, GrAccessPatter
n accessPattern) { |
176 switch (type) { | 176 switch (type) { |
177 case kVertex_GrBufferType: | 177 case kVertex_GrBufferType: |
178 SkASSERT(kDynamic_GrAccessPattern == accessPattern || | 178 SkASSERT(kDynamic_GrAccessPattern == accessPattern || |
179 kStatic_GrAccessPattern == accessPattern); | 179 kStatic_GrAccessPattern == accessPattern); |
180 return GrVkVertexBuffer::Create(this, size, kDynamic_GrAccessPattern
== accessPattern); | 180 return GrVkVertexBuffer::Create(this, size, kDynamic_GrAccessPattern
== accessPattern); |
181 case kIndex_GrBufferType: | 181 case kIndex_GrBufferType: |
182 SkASSERT(kDynamic_GrAccessPattern == accessPattern || | 182 SkASSERT(kDynamic_GrAccessPattern == accessPattern || |
183 kStatic_GrAccessPattern == accessPattern); | 183 kStatic_GrAccessPattern == accessPattern); |
184 return GrVkIndexBuffer::Create(this, size, kDynamic_GrAccessPattern
== accessPattern); | 184 return GrVkIndexBuffer::Create(this, size, kDynamic_GrAccessPattern
== accessPattern); |
185 case kXferCpuToGpu_GrBufferType: | 185 case kXferCpuToGpu_GrBufferType: |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 VkAccessFlags dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; | 1349 VkAccessFlags dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; |
1350 tgt->setImageLayout(this, | 1350 tgt->setImageLayout(this, |
1351 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, | 1351 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, |
1352 srcAccessMask, | 1352 srcAccessMask, |
1353 dstAccessMask, | 1353 dstAccessMask, |
1354 srcStageMask, | 1354 srcStageMask, |
1355 dstStageMask, | 1355 dstStageMask, |
1356 false); | 1356 false); |
1357 | 1357 |
1358 GrVkTransferBuffer* transferBuffer = | 1358 GrVkTransferBuffer* transferBuffer = |
1359 static_cast<GrVkTransferBuffer*>(this->createBuffer(kXferGpuToCpu_GrBuff
erType, | 1359 static_cast<GrVkTransferBuffer*>(this->createBuffer(rowBytes * height, |
1360 rowBytes * height, | 1360 kXferGpuToCpu_GrBuff
erType, |
1361 kStream_GrAccessPatt
ern)); | 1361 kStream_GrAccessPatt
ern)); |
1362 | 1362 |
1363 bool flipY = kBottomLeft_GrSurfaceOrigin == surface->origin(); | 1363 bool flipY = kBottomLeft_GrSurfaceOrigin == surface->origin(); |
1364 VkOffset3D offset = { | 1364 VkOffset3D offset = { |
1365 left, | 1365 left, |
1366 flipY ? surface->height() - top - height : top, | 1366 flipY ? surface->height() - top - height : top, |
1367 0 | 1367 0 |
1368 }; | 1368 }; |
1369 | 1369 |
1370 // Copy the image to a buffer so we can map it to cpu memory | 1370 // Copy the image to a buffer so we can map it to cpu memory |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 aglSwapBuffers(aglGetCurrentContext()); | 1564 aglSwapBuffers(aglGetCurrentContext()); |
1565 int set_a_break_pt_here = 9; | 1565 int set_a_break_pt_here = 9; |
1566 aglSwapBuffers(aglGetCurrentContext()); | 1566 aglSwapBuffers(aglGetCurrentContext()); |
1567 #elif defined(SK_BUILD_FOR_WIN32) | 1567 #elif defined(SK_BUILD_FOR_WIN32) |
1568 SwapBuf(); | 1568 SwapBuf(); |
1569 int set_a_break_pt_here = 9; | 1569 int set_a_break_pt_here = 9; |
1570 SwapBuf(); | 1570 SwapBuf(); |
1571 #endif | 1571 #endif |
1572 #endif | 1572 #endif |
1573 } | 1573 } |
OLD | NEW |