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

Side by Side Diff: src/gpu/vk/GrVkImage.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 | « no previous file | src/gpu/vk/GrVkMemory.cpp » ('j') | 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 "GrVkGpu.h" 8 #include "GrVkGpu.h"
9 #include "GrVkImage.h" 9 #include "GrVkImage.h"
10 #include "GrVkMemory.h" 10 #include "GrVkMemory.h"
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 } 26 }
27 27
28 void GrVkImage::setImageLayout(const GrVkGpu* gpu, VkImageLayout newLayout, 28 void GrVkImage::setImageLayout(const GrVkGpu* gpu, VkImageLayout newLayout,
29 VkAccessFlags dstAccessMask, 29 VkAccessFlags dstAccessMask,
30 VkPipelineStageFlags dstStageMask, 30 VkPipelineStageFlags dstStageMask,
31 bool byRegion) { 31 bool byRegion) {
32 SkASSERT(VK_IMAGE_LAYOUT_UNDEFINED != newLayout && 32 SkASSERT(VK_IMAGE_LAYOUT_UNDEFINED != newLayout &&
33 VK_IMAGE_LAYOUT_PREINITIALIZED != newLayout); 33 VK_IMAGE_LAYOUT_PREINITIALIZED != newLayout);
34 VkImageLayout currentLayout = this->currentLayout(); 34 VkImageLayout currentLayout = this->currentLayout();
35 // Is this reasonable? Could someone want to keep the same layout but use th e masks to force 35
36 // a barrier on certain things? 36 // If the old and new layout are the same, there is no reason to put in a ba rrier since the
37 if (newLayout == currentLayout) { 37 // operations used for each layout are implicitly synchronized with eachothe r. The one exception
38 // is if the layout is GENERAL. In this case the image could have been used for any operation so
39 // we must respect the barrier.
40 if (newLayout == currentLayout && VK_IMAGE_LAYOUT_GENERAL != currentLayout) {
38 return; 41 return;
39 } 42 }
40 43
41 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(currentLayou t); 44 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(currentLayou t);
42 VkPipelineStageFlags srcStageMask = GrVkMemory::LayoutToPipelineStageFlags(c urrentLayout); 45 VkPipelineStageFlags srcStageMask = GrVkMemory::LayoutToPipelineStageFlags(c urrentLayout);
43 46
44 VkImageAspectFlags aspectFlags = vk_format_to_aspect_flags(fInfo.fFormat); 47 VkImageAspectFlags aspectFlags = vk_format_to_aspect_flags(fInfo.fFormat);
45 VkImageMemoryBarrier imageMemoryBarrier = { 48 VkImageMemoryBarrier imageMemoryBarrier = {
46 VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // sType 49 VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // sType
47 nullptr, // pNext 50 nullptr, // pNext
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 152 }
150 153
151 void GrVkImage::Resource::freeGPUData(const GrVkGpu* gpu) const { 154 void GrVkImage::Resource::freeGPUData(const GrVkGpu* gpu) const {
152 VK_CALL(gpu, DestroyImage(gpu->device(), fImage, nullptr)); 155 VK_CALL(gpu, DestroyImage(gpu->device(), fImage, nullptr));
153 bool isLinear = (VK_IMAGE_TILING_LINEAR == fImageTiling); 156 bool isLinear = (VK_IMAGE_TILING_LINEAR == fImageTiling);
154 GrVkMemory::FreeImageMemory(gpu, isLinear, fAlloc); 157 GrVkMemory::FreeImageMemory(gpu, isLinear, fAlloc);
155 } 158 }
156 159
157 void GrVkImage::BorrowedResource::freeGPUData(const GrVkGpu* gpu) const { 160 void GrVkImage::BorrowedResource::freeGPUData(const GrVkGpu* gpu) const {
158 } 161 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/vk/GrVkMemory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698