| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 // Create Image | 71 // Create Image |
| 72 VkSampleCountFlagBits vkSamples; | 72 VkSampleCountFlagBits vkSamples; |
| 73 if (!GrSampleCountToVkSampleCount(imageDesc.fSamples, &vkSamples)) { | 73 if (!GrSampleCountToVkSampleCount(imageDesc.fSamples, &vkSamples)) { |
| 74 return false; | 74 return false; |
| 75 } | 75 } |
| 76 | 76 |
| 77 SkASSERT(VK_IMAGE_TILING_OPTIMAL == imageDesc.fImageTiling || | 77 SkASSERT(VK_IMAGE_TILING_OPTIMAL == imageDesc.fImageTiling || |
| 78 VK_SAMPLE_COUNT_1_BIT == vkSamples); | 78 VK_SAMPLE_COUNT_1_BIT == vkSamples); |
| 79 | 79 |
| 80 // sRGB format images may need to be aliased to linear for various reasons (
legacy mode): |
| 81 VkImageCreateFlags createFlags = GrVkFormatIsSRGB(imageDesc.fFormat, nullptr
) |
| 82 ? VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT : 0; |
| 83 |
| 80 const VkImageCreateInfo imageCreateInfo = { | 84 const VkImageCreateInfo imageCreateInfo = { |
| 81 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // sType | 85 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // sType |
| 82 NULL, // pNext | 86 NULL, // pNext |
| 83 0, // VkImageCreateFlags | 87 createFlags, // VkImageCreateFlags |
| 84 imageDesc.fImageType, // VkImageType | 88 imageDesc.fImageType, // VkImageType |
| 85 imageDesc.fFormat, // VkFormat | 89 imageDesc.fFormat, // VkFormat |
| 86 { imageDesc.fWidth, imageDesc.fHeight, 1 }, // VkExtent3D | 90 { imageDesc.fWidth, imageDesc.fHeight, 1 }, // VkExtent3D |
| 87 imageDesc.fLevels, // mipLevels | 91 imageDesc.fLevels, // mipLevels |
| 88 1, // arrayLayers | 92 1, // arrayLayers |
| 89 vkSamples, // samples | 93 vkSamples, // samples |
| 90 imageDesc.fImageTiling, // VkImageTiling | 94 imageDesc.fImageTiling, // VkImageTiling |
| 91 imageDesc.fUsageFlags, // VkImageUsageFlags | 95 imageDesc.fUsageFlags, // VkImageUsageFlags |
| 92 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode | 96 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode |
| 93 0, // queueFamilyCount | 97 0, // queueFamilyCount |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 144 } |
| 141 } | 145 } |
| 142 | 146 |
| 143 void GrVkImage::Resource::freeGPUData(const GrVkGpu* gpu) const { | 147 void GrVkImage::Resource::freeGPUData(const GrVkGpu* gpu) const { |
| 144 VK_CALL(gpu, DestroyImage(gpu->device(), fImage, nullptr)); | 148 VK_CALL(gpu, DestroyImage(gpu->device(), fImage, nullptr)); |
| 145 VK_CALL(gpu, FreeMemory(gpu->device(), fAlloc, nullptr)); | 149 VK_CALL(gpu, FreeMemory(gpu->device(), fAlloc, nullptr)); |
| 146 } | 150 } |
| 147 | 151 |
| 148 void GrVkImage::BorrowedResource::freeGPUData(const GrVkGpu* gpu) const { | 152 void GrVkImage::BorrowedResource::freeGPUData(const GrVkGpu* gpu) const { |
| 149 } | 153 } |
| OLD | NEW |