OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "vk/GrVkExtensions.h" | 8 #include "vk/GrVkExtensions.h" |
9 #include "vk/GrVkUtil.h" | 9 #include "vk/GrVkUtil.h" |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 84 } |
85 delete [] extensions; | 85 delete [] extensions; |
86 // sort so we can search | 86 // sort so we can search |
87 if (!fInstanceExtensionStrings->empty()) { | 87 if (!fInstanceExtensionStrings->empty()) { |
88 SkTQSort(&fInstanceExtensionStrings->front(), &fInstanceExtensionStrings
->back(), cmp); | 88 SkTQSort(&fInstanceExtensionStrings->front(), &fInstanceExtensionStrings
->back(), cmp); |
89 } | 89 } |
90 // via explicitly enabled layers | 90 // via explicitly enabled layers |
91 layerCount = fInstanceLayerStrings->count(); | 91 layerCount = fInstanceLayerStrings->count(); |
92 for (uint32_t layerIndex = 0; layerIndex < layerCount; ++layerIndex) { | 92 for (uint32_t layerIndex = 0; layerIndex < layerCount; ++layerIndex) { |
93 uint32_t extensionCount = 0; | 93 uint32_t extensionCount = 0; |
94 res = EnumerateInstanceExtensionProperties((*fInstanceLayerStrings)[laye
rIndex].c_str(), | 94 res = EnumerateInstanceExtensionProperties((*fInstanceLayerStrings)[laye
rIndex].c_str(), |
95 &extensionCount, nullptr); | 95 &extensionCount, nullptr); |
96 if (VK_SUCCESS != res) { | 96 if (VK_SUCCESS != res) { |
97 return false; | 97 return false; |
98 } | 98 } |
99 VkExtensionProperties* extensions = new VkExtensionProperties[extensionC
ount]; | 99 VkExtensionProperties* extensions = new VkExtensionProperties[extensionC
ount]; |
100 res = EnumerateInstanceExtensionProperties((*fInstanceLayerStrings)[laye
rIndex].c_str(), | 100 res = EnumerateInstanceExtensionProperties((*fInstanceLayerStrings)[laye
rIndex].c_str(), |
101 &extensionCount, extensions); | 101 &extensionCount, extensions); |
102 if (VK_SUCCESS != res) { | 102 if (VK_SUCCESS != res) { |
103 return false; | 103 return false; |
104 } | 104 } |
105 for (uint32_t i = 0; i < extensionCount; ++i) { | 105 for (uint32_t i = 0; i < extensionCount; ++i) { |
106 // if not already in the list, add it | 106 // if not already in the list, add it |
107 if (specVersion >= extensions[i].specVersion && | 107 if (specVersion >= extensions[i].specVersion && |
108 find_string(*fInstanceExtensionStrings, extensions[i].extensionN
ame) < 0) { | 108 find_string(*fInstanceExtensionStrings, extensions[i].extensionN
ame) < 0) { |
109 fInstanceExtensionStrings->push_back() = extensions[i].extension
Name; | 109 fInstanceExtensionStrings->push_back() = extensions[i].extension
Name; |
110 SkTQSort(&fInstanceExtensionStrings->front(), &fInstanceExtensio
nStrings->back(), | 110 SkTQSort(&fInstanceExtensionStrings->front(), &fInstanceExtensio
nStrings->back(), |
111 cmp); | 111 cmp); |
112 } | 112 } |
113 } | 113 } |
114 delete[] extensions; | 114 delete[] extensions; |
115 } | 115 } |
116 | 116 |
117 return true; | 117 return true; |
118 } | 118 } |
119 | 119 |
120 bool GrVkExtensions::initDevice(uint32_t specVersion, VkInstance inst, VkPhysica
lDevice physDev) { | 120 bool GrVkExtensions::initDevice(uint32_t specVersion, VkInstance inst, VkPhysica
lDevice physDev) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 SkDebugf("\nInstance Layers: "); | 238 SkDebugf("\nInstance Layers: "); |
239 for (int i = 0; i < cnt; ++i) { | 239 for (int i = 0; i < cnt; ++i) { |
240 SkDebugf("%s%s", (*fInstanceLayerStrings)[i].c_str(), (i < cnt - 1) ? se
p : ""); | 240 SkDebugf("%s%s", (*fInstanceLayerStrings)[i].c_str(), (i < cnt - 1) ? se
p : ""); |
241 } | 241 } |
242 cnt = fDeviceLayerStrings->count(); | 242 cnt = fDeviceLayerStrings->count(); |
243 SkDebugf("\nDevice Layers: "); | 243 SkDebugf("\nDevice Layers: "); |
244 for (int i = 0; i < cnt; ++i) { | 244 for (int i = 0; i < cnt; ++i) { |
245 SkDebugf("%s%s", (*fDeviceLayerStrings)[i].c_str(), (i < cnt - 1) ? sep
: ""); | 245 SkDebugf("%s%s", (*fDeviceLayerStrings)[i].c_str(), (i < cnt - 1) ? sep
: ""); |
246 } | 246 } |
247 } | 247 } |
OLD | NEW |