| 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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 VkAccessFlags dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; | 1218 VkAccessFlags dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; |
| 1219 tgt->setImageLayout(this, | 1219 tgt->setImageLayout(this, |
| 1220 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, | 1220 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, |
| 1221 srcAccessMask, | 1221 srcAccessMask, |
| 1222 dstAccessMask, | 1222 dstAccessMask, |
| 1223 srcStageMask, | 1223 srcStageMask, |
| 1224 dstStageMask, | 1224 dstStageMask, |
| 1225 false); | 1225 false); |
| 1226 | 1226 |
| 1227 GrVkTransferBuffer* transferBuffer = | 1227 GrVkTransferBuffer* transferBuffer = |
| 1228 static_cast<GrVkTransferBuffer*>(this->createBuffer(kXferGpuToCpu_GrBuff
erType, | 1228 static_cast<GrVkTransferBuffer*>(this->createBuffer(rowBytes * height, |
| 1229 rowBytes * height, | 1229 kXferGpuToCpu_GrBuff
erType, |
| 1230 kStream_GrAccessPatt
ern)); | 1230 kStream_GrAccessPatt
ern)); |
| 1231 | 1231 |
| 1232 bool flipY = kBottomLeft_GrSurfaceOrigin == surface->origin(); | 1232 bool flipY = kBottomLeft_GrSurfaceOrigin == surface->origin(); |
| 1233 VkOffset3D offset = { | 1233 VkOffset3D offset = { |
| 1234 left, | 1234 left, |
| 1235 flipY ? surface->height() - top - height : top, | 1235 flipY ? surface->height() - top - height : top, |
| 1236 0 | 1236 0 |
| 1237 }; | 1237 }; |
| 1238 | 1238 |
| 1239 // Copy the image to a buffer so we can map it to cpu memory | 1239 // 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... |
| 1433 aglSwapBuffers(aglGetCurrentContext()); | 1433 aglSwapBuffers(aglGetCurrentContext()); |
| 1434 int set_a_break_pt_here = 9; | 1434 int set_a_break_pt_here = 9; |
| 1435 aglSwapBuffers(aglGetCurrentContext()); | 1435 aglSwapBuffers(aglGetCurrentContext()); |
| 1436 #elif defined(SK_BUILD_FOR_WIN32) | 1436 #elif defined(SK_BUILD_FOR_WIN32) |
| 1437 SwapBuf(); | 1437 SwapBuf(); |
| 1438 int set_a_break_pt_here = 9; | 1438 int set_a_break_pt_here = 9; |
| 1439 SwapBuf(); | 1439 SwapBuf(); |
| 1440 #endif | 1440 #endif |
| 1441 #endif | 1441 #endif |
| 1442 } | 1442 } |
| OLD | NEW |