| 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 "GrVkMemory.h" | 8 #include "GrVkMemory.h" |
| 9 | 9 |
| 10 #include "GrVkGpu.h" | 10 #include "GrVkGpu.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // color attachment or depth/stencil writes). So we will ignore the | 216 // color attachment or depth/stencil writes). So we will ignore the |
| 217 // VK_MEMORY_OUTPUT_SHADER_WRITE_BIT. | 217 // VK_MEMORY_OUTPUT_SHADER_WRITE_BIT. |
| 218 | 218 |
| 219 // We can only directly access the host memory if we are in preinitialized o
r general layout, | 219 // We can only directly access the host memory if we are in preinitialized o
r general layout, |
| 220 // and the image is linear. | 220 // and the image is linear. |
| 221 // TODO: Add check for linear here so we are not always adding host to gener
al, and we should | 221 // TODO: Add check for linear here so we are not always adding host to gener
al, and we should |
| 222 // only be in preinitialized if we are linear | 222 // only be in preinitialized if we are linear |
| 223 VkAccessFlags flags = 0;; | 223 VkAccessFlags flags = 0;; |
| 224 if (VK_IMAGE_LAYOUT_GENERAL == layout) { | 224 if (VK_IMAGE_LAYOUT_GENERAL == layout) { |
| 225 flags = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | | 225 flags = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | |
| 226 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | | 226 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | |
| 227 VK_ACCESS_TRANSFER_WRITE_BIT | | 227 VK_ACCESS_TRANSFER_WRITE_BIT | |
| 228 VK_ACCESS_HOST_WRITE_BIT | VK_ACCESS_HOST_READ_BIT; | 228 VK_ACCESS_TRANSFER_READ_BIT | |
| 229 VK_ACCESS_SHADER_READ_BIT | |
| 230 VK_ACCESS_HOST_WRITE_BIT | VK_ACCESS_HOST_READ_BIT; |
| 229 } else if (VK_IMAGE_LAYOUT_PREINITIALIZED == layout) { | 231 } else if (VK_IMAGE_LAYOUT_PREINITIALIZED == layout) { |
| 230 flags = VK_ACCESS_HOST_WRITE_BIT; | 232 flags = VK_ACCESS_HOST_WRITE_BIT; |
| 231 } else if (VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL == layout) { | 233 } else if (VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL == layout) { |
| 232 flags = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; | 234 flags = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; |
| 233 } else if (VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL == layout) { | 235 } else if (VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL == layout) { |
| 234 flags = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; | 236 flags = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; |
| 235 } else if (VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL == layout) { | 237 } else if (VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL == layout) { |
| 236 flags = VK_ACCESS_TRANSFER_WRITE_BIT; | 238 flags = VK_ACCESS_TRANSFER_WRITE_BIT; |
| 237 } else if (VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL == layout) { | 239 } else if (VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL == layout) { |
| 238 flags = VK_ACCESS_TRANSFER_READ_BIT; | 240 flags = VK_ACCESS_TRANSFER_READ_BIT; |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 fSubHeaps[i]->free(alloc); | 553 fSubHeaps[i]->free(alloc); |
| 552 fUsedSize -= alloc.fSize; | 554 fUsedSize -= alloc.fSize; |
| 553 return true; | 555 return true; |
| 554 } | 556 } |
| 555 } | 557 } |
| 556 | 558 |
| 557 return false; | 559 return false; |
| 558 } | 560 } |
| 559 | 561 |
| 560 | 562 |
| OLD | NEW |