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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 VkImageLayout initialLayout = (VK_IMAGE_TILING_LINEAR == imageDesc.fImageTil
ing) | 52 VkImageLayout initialLayout = (VK_IMAGE_TILING_LINEAR == imageDesc.fImageTil
ing) |
53 ? VK_IMAGE_LAYOUT_PREINITIALIZED | 53 ? VK_IMAGE_LAYOUT_PREINITIALIZED |
54 : VK_IMAGE_LAYOUT_UNDEFINED; | 54 : VK_IMAGE_LAYOUT_UNDEFINED; |
55 | 55 |
56 // Create Image | 56 // Create Image |
57 VkSampleCountFlagBits vkSamples; | 57 VkSampleCountFlagBits vkSamples; |
58 if (!GrSampleCountToVkSampleCount(imageDesc.fSamples, &vkSamples)) { | 58 if (!GrSampleCountToVkSampleCount(imageDesc.fSamples, &vkSamples)) { |
59 return nullptr; | 59 return nullptr; |
60 } | 60 } |
| 61 |
| 62 SkASSERT(VK_IMAGE_TILING_OPTIMAL == imageDesc.fImageTiling || |
| 63 VK_SAMPLE_COUNT_1_BIT == vkSamples); |
| 64 |
61 const VkImageCreateInfo imageCreateInfo = { | 65 const VkImageCreateInfo imageCreateInfo = { |
62 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // sType | 66 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // sType |
63 NULL, // pNext | 67 NULL, // pNext |
64 0, // VkImageCreateFlags | 68 0, // VkImageCreateFlags |
65 imageDesc.fImageType, // VkImageType | 69 imageDesc.fImageType, // VkImageType |
66 imageDesc.fFormat, // VkFormat | 70 imageDesc.fFormat, // VkFormat |
67 { imageDesc.fWidth, imageDesc.fHeight, 1 }, // VkExtent3D | 71 { imageDesc.fWidth, imageDesc.fHeight, 1 }, // VkExtent3D |
68 imageDesc.fLevels, // mipLevels | 72 imageDesc.fLevels, // mipLevels |
69 1, // arrayLayers | 73 1, // arrayLayers |
70 vkSamples, // samples | 74 vkSamples, // samples |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 113 } |
110 } | 114 } |
111 | 115 |
112 void GrVkImage::Resource::freeGPUData(const GrVkGpu* gpu) const { | 116 void GrVkImage::Resource::freeGPUData(const GrVkGpu* gpu) const { |
113 VK_CALL(gpu, DestroyImage(gpu->device(), fImage, nullptr)); | 117 VK_CALL(gpu, DestroyImage(gpu->device(), fImage, nullptr)); |
114 VK_CALL(gpu, FreeMemory(gpu->device(), fAlloc, nullptr)); | 118 VK_CALL(gpu, FreeMemory(gpu->device(), fAlloc, nullptr)); |
115 } | 119 } |
116 | 120 |
117 void GrVkImage::BorrowedResource::freeGPUData(const GrVkGpu* gpu) const { | 121 void GrVkImage::BorrowedResource::freeGPUData(const GrVkGpu* gpu) const { |
118 } | 122 } |
OLD | NEW |