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

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

Issue 2298483002: Always add a barrier when old layout was general in vulkan. (Closed)
Patch Set: add more flags for general 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/GrVkImage.cpp ('k') | no next file » | 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 "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
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
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
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkImage.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698