| 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 #include "GrVkImage.h" | 9 #include "GrVkImage.h" |
| 10 #include "GrVkMemory.h" | 10 #include "GrVkMemory.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 fInfo.fImage, // image | 54 fInfo.fImage, // image |
| 55 { aspectFlags, 0, fInfo.fLevelCount, 0, 1 } // subresourceRange | 55 { aspectFlags, 0, fInfo.fLevelCount, 0, 1 } // subresourceRange |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 gpu->addImageMemoryBarrier(srcStageMask, dstStageMask, byRegion, &imageMemor
yBarrier); | 58 gpu->addImageMemoryBarrier(srcStageMask, dstStageMask, byRegion, &imageMemor
yBarrier); |
| 59 | 59 |
| 60 fInfo.fImageLayout = newLayout; | 60 fInfo.fImageLayout = newLayout; |
| 61 } | 61 } |
| 62 | 62 |
| 63 bool GrVkImage::InitImageInfo(const GrVkGpu* gpu, const ImageDesc& imageDesc, Gr
VkImageInfo* info) { | 63 bool GrVkImage::InitImageInfo(const GrVkGpu* gpu, const ImageDesc& imageDesc, Gr
VkImageInfo* info) { |
| 64 if (0 == imageDesc.fWidth || 0 == imageDesc.fHeight) { |
| 65 return false; |
| 66 } |
| 64 VkImage image = 0; | 67 VkImage image = 0; |
| 65 GrVkAlloc alloc; | 68 GrVkAlloc alloc; |
| 66 | 69 |
| 67 bool isLinear = VK_IMAGE_TILING_LINEAR == imageDesc.fImageTiling; | 70 bool isLinear = VK_IMAGE_TILING_LINEAR == imageDesc.fImageTiling; |
| 68 VkImageLayout initialLayout = isLinear ? VK_IMAGE_LAYOUT_PREINITIALIZED | 71 VkImageLayout initialLayout = isLinear ? VK_IMAGE_LAYOUT_PREINITIALIZED |
| 69 : VK_IMAGE_LAYOUT_UNDEFINED; | 72 : VK_IMAGE_LAYOUT_UNDEFINED; |
| 70 | 73 |
| 71 // Create Image | 74 // Create Image |
| 72 VkSampleCountFlagBits vkSamples; | 75 VkSampleCountFlagBits vkSamples; |
| 73 if (!GrSampleCountToVkSampleCount(imageDesc.fSamples, &vkSamples)) { | 76 if (!GrSampleCountToVkSampleCount(imageDesc.fSamples, &vkSamples)) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } | 149 } |
| 147 | 150 |
| 148 void GrVkImage::Resource::freeGPUData(const GrVkGpu* gpu) const { | 151 void GrVkImage::Resource::freeGPUData(const GrVkGpu* gpu) const { |
| 149 VK_CALL(gpu, DestroyImage(gpu->device(), fImage, nullptr)); | 152 VK_CALL(gpu, DestroyImage(gpu->device(), fImage, nullptr)); |
| 150 bool isLinear = (VK_IMAGE_TILING_LINEAR == fImageTiling); | 153 bool isLinear = (VK_IMAGE_TILING_LINEAR == fImageTiling); |
| 151 GrVkMemory::FreeImageMemory(gpu, isLinear, fAlloc); | 154 GrVkMemory::FreeImageMemory(gpu, isLinear, fAlloc); |
| 152 } | 155 } |
| 153 | 156 |
| 154 void GrVkImage::BorrowedResource::freeGPUData(const GrVkGpu* gpu) const { | 157 void GrVkImage::BorrowedResource::freeGPUData(const GrVkGpu* gpu) const { |
| 155 } | 158 } |
| OLD | NEW |