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

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

Issue 1945823002: Set barriers and image layout changes between mipmap blits. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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.h ('k') | src/gpu/vk/GrVkTextureRenderTarget.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 12 matching lines...) Expand all
23 SkASSERT(GrVkFormatToPixelConfig(format, nullptr)); 23 SkASSERT(GrVkFormatToPixelConfig(format, nullptr));
24 return VK_IMAGE_ASPECT_COLOR_BIT; 24 return VK_IMAGE_ASPECT_COLOR_BIT;
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 srcAccessMask, 29 VkAccessFlags srcAccessMask,
30 VkAccessFlags dstAccessMask, 30 VkAccessFlags dstAccessMask,
31 VkPipelineStageFlags srcStageMask, 31 VkPipelineStageFlags srcStageMask,
32 VkPipelineStageFlags dstStageMask, 32 VkPipelineStageFlags dstStageMask,
33 uint32_t baseMipLevel,
34 uint32_t levelCount,
33 bool byRegion) { 35 bool byRegion) {
34 SkASSERT(VK_IMAGE_LAYOUT_UNDEFINED != newLayout && 36 SkASSERT(VK_IMAGE_LAYOUT_UNDEFINED != newLayout &&
35 VK_IMAGE_LAYOUT_PREINITIALIZED != newLayout); 37 VK_IMAGE_LAYOUT_PREINITIALIZED != newLayout);
36 // Is this reasonable? Could someone want to keep the same layout but use th e masks to force 38 // Is this reasonable? Could someone want to keep the same layout but use th e masks to force
37 // a barrier on certain things? 39 // a barrier on certain things?
38 if (newLayout == fCurrentLayout) { 40 if (newLayout == fCurrentLayout) {
39 return; 41 return;
40 } 42 }
41 VkImageAspectFlags aspectFlags = vk_format_to_aspect_flags(fResource->fForma t); 43 VkImageAspectFlags aspectFlags = vk_format_to_aspect_flags(fResource->fForma t);
42 VkImageMemoryBarrier imageMemoryBarrier = { 44 VkImageMemoryBarrier imageMemoryBarrier = {
43 VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // sType 45 VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // sType
44 NULL, // pNext 46 NULL, // pNext
45 srcAccessMask, // outputMask 47 srcAccessMask, // outputMask
46 dstAccessMask, // inputMask 48 dstAccessMask, // inputMask
47 fCurrentLayout, // oldLayout 49 fCurrentLayout, // oldLayout
48 newLayout, // newLayout 50 newLayout, // newLayout
49 VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex 51 VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex
50 VK_QUEUE_FAMILY_IGNORED, // dstQueueFamilyIndex 52 VK_QUEUE_FAMILY_IGNORED, // dstQueueFamilyIndex
51 fResource->fImage, // image 53 fResource->fImage, // image
52 { aspectFlags, 0, fResource->fLevelCount, 0, 1 } // subresourceRange 54 { aspectFlags, baseMipLevel, levelCount, 0, 1 } // subresourceRange
53 }; 55 };
54 56
55 // TODO: restrict to area of image we're interested in 57 // TODO: restrict to area of image we're interested in
56 gpu->addImageMemoryBarrier(srcStageMask, dstStageMask, byRegion, &imageMemor yBarrier); 58 gpu->addImageMemoryBarrier(srcStageMask, dstStageMask, byRegion, &imageMemor yBarrier);
57 59
58 fCurrentLayout = newLayout; 60 fCurrentLayout = newLayout;
59 } 61 }
60 62
61 const GrVkImage::Resource* GrVkImage::CreateResource(const GrVkGpu* gpu, 63 const GrVkImage::Resource* GrVkImage::CreateResource(const GrVkGpu* gpu,
62 const ImageDesc& imageDesc) { 64 const ImageDesc& imageDesc) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 129 }
128 } 130 }
129 131
130 void GrVkImage::Resource::freeGPUData(const GrVkGpu* gpu) const { 132 void GrVkImage::Resource::freeGPUData(const GrVkGpu* gpu) const {
131 VK_CALL(gpu, DestroyImage(gpu->device(), fImage, nullptr)); 133 VK_CALL(gpu, DestroyImage(gpu->device(), fImage, nullptr));
132 VK_CALL(gpu, FreeMemory(gpu->device(), fAlloc, nullptr)); 134 VK_CALL(gpu, FreeMemory(gpu->device(), fAlloc, nullptr));
133 } 135 }
134 136
135 void GrVkImage::BorrowedResource::freeGPUData(const GrVkGpu* gpu) const { 137 void GrVkImage::BorrowedResource::freeGPUData(const GrVkGpu* gpu) const {
136 } 138 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkImage.h ('k') | src/gpu/vk/GrVkTextureRenderTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698