Line data Source code
1 : /**
2 : Copyright (c) 2021 Roman Katuntsev <sbkarr@stappler.org>
3 : Copyright (c) 2023 Stappler LLC <admin@stappler.dev>
4 :
5 : Permission is hereby granted, free of charge, to any person obtaining a copy
6 : of this software and associated documentation files (the "Software"), to deal
7 : in the Software without restriction, including without limitation the rights
8 : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 : copies of the Software, and to permit persons to whom the Software is
10 : furnished to do so, subject to the following conditions:
11 :
12 : The above copyright notice and this permission notice shall be included in
13 : all copies or substantial portions of the Software.
14 :
15 : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 : IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 : FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 : AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 : LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 : OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 : THE SOFTWARE.
22 : **/
23 :
24 : #include "XLVkInfo.h"
25 : #include "XLVkInstance.h"
26 :
27 : namespace STAPPLER_VERSIONIZED stappler::xenolith::vk {
28 :
29 168 : DeviceInfo::Features DeviceInfo::Features::getRequired() {
30 168 : Features ret;
31 168 : ret.device10.features.independentBlend = VK_TRUE;
32 168 : return ret;
33 : }
34 :
35 42 : DeviceInfo::Features DeviceInfo::Features::getOptional() {
36 42 : Features ret;
37 42 : ret.device10.features.shaderSampledImageArrayDynamicIndexing = VK_TRUE;
38 42 : ret.device10.features.fillModeNonSolid = VK_TRUE;
39 42 : ret.device10.features.shaderStorageBufferArrayDynamicIndexing = VK_TRUE;
40 42 : ret.device10.features.shaderStorageImageArrayDynamicIndexing = VK_TRUE;
41 42 : ret.device10.features.shaderUniformBufferArrayDynamicIndexing = VK_TRUE;
42 42 : ret.device10.features.multiDrawIndirect = VK_TRUE;
43 42 : ret.device10.features.shaderFloat64 = VK_TRUE;
44 42 : ret.device10.features.shaderInt64 = VK_TRUE;
45 42 : ret.device10.features.shaderInt16 = VK_TRUE;
46 42 : ret.deviceShaderFloat16Int8.shaderFloat16 = VK_TRUE;
47 42 : ret.deviceShaderFloat16Int8.shaderInt8 = VK_TRUE;
48 42 : ret.device16bitStorage.storageBuffer16BitAccess = VK_TRUE;
49 : //ret.device16bitStorage.uniformAndStorageBuffer16BitAccess = VK_TRUE;
50 : //ret.device16bitStorage.storageInputOutput16 = VK_TRUE;
51 42 : ret.device8bitStorage.storageBuffer8BitAccess = VK_TRUE;
52 : //ret.device8bitStorage.uniformAndStorageBuffer8BitAccess = VK_TRUE;
53 42 : ret.deviceDescriptorIndexing.shaderUniformBufferArrayNonUniformIndexing = VK_TRUE;
54 42 : ret.deviceDescriptorIndexing.shaderSampledImageArrayNonUniformIndexing = VK_TRUE;
55 42 : ret.deviceDescriptorIndexing.shaderStorageBufferArrayNonUniformIndexing = VK_TRUE;
56 42 : ret.deviceDescriptorIndexing.shaderStorageImageArrayNonUniformIndexing = VK_TRUE;
57 42 : ret.deviceDescriptorIndexing.descriptorBindingUniformBufferUpdateAfterBind = VK_TRUE;
58 42 : ret.deviceDescriptorIndexing.descriptorBindingSampledImageUpdateAfterBind = VK_TRUE;
59 42 : ret.deviceDescriptorIndexing.descriptorBindingStorageImageUpdateAfterBind = VK_TRUE;
60 42 : ret.deviceDescriptorIndexing.descriptorBindingStorageBufferUpdateAfterBind = VK_TRUE;
61 42 : ret.deviceDescriptorIndexing.descriptorBindingUniformTexelBufferUpdateAfterBind = VK_TRUE;
62 42 : ret.deviceDescriptorIndexing.descriptorBindingStorageTexelBufferUpdateAfterBind = VK_TRUE;
63 42 : ret.deviceDescriptorIndexing.descriptorBindingUpdateUnusedWhilePending = VK_TRUE;
64 42 : ret.deviceDescriptorIndexing.descriptorBindingPartiallyBound = VK_TRUE;
65 42 : ret.deviceDescriptorIndexing.descriptorBindingVariableDescriptorCount = VK_TRUE;
66 42 : ret.deviceDescriptorIndexing.runtimeDescriptorArray = VK_TRUE;
67 :
68 0 : ret.flags = ExtensionFlags::Maintenance3
69 0 : | ExtensionFlags::DescriptorIndexing
70 42 : | ExtensionFlags::DrawIndirectCount
71 42 : | ExtensionFlags::Storage16Bit
72 42 : | ExtensionFlags::Storage8Bit
73 42 : | ExtensionFlags::DeviceAddress
74 42 : | ExtensionFlags::ShaderFloat16
75 42 : | ExtensionFlags::ShaderInt8
76 42 : | ExtensionFlags::MemoryBudget
77 42 : | ExtensionFlags::DedicatedAllocation
78 42 : | ExtensionFlags::GetMemoryRequirements2
79 84 : | ExtensionFlags::BufferDeviceAddress;
80 :
81 : #ifdef VK_ENABLE_BETA_EXTENSIONS
82 : ret.devicePortability.constantAlphaColorBlendFactors = VK_TRUE;
83 : ret.devicePortability.events = VK_TRUE;
84 : ret.devicePortability.imageViewFormatSwizzle = VK_TRUE;
85 : ret.devicePortability.shaderSampleRateInterpolationFunctions = VK_TRUE;
86 :
87 : ret.flags = ExtensionFlags::Portability;
88 : #endif
89 :
90 42 : ret.updateTo12();
91 42 : return ret;
92 : }
93 :
94 210 : bool DeviceInfo::Features::canEnable(const Features &features, uint32_t version) const {
95 1680 : auto doCheck = [] (SpanView<VkBool32> src, SpanView<VkBool32> trg) {
96 32970 : for (size_t i = 0; i < src.size(); ++ i) {
97 31290 : if (trg[i] && !src[i]) {
98 0 : return false;
99 : }
100 : }
101 1680 : return true;
102 : };
103 :
104 210 : if (!doCheck(
105 210 : SpanView<VkBool32>(&device10.features.robustBufferAccess, sizeof(VkPhysicalDeviceFeatures) / sizeof(VkBool32)),
106 420 : SpanView<VkBool32>(&features.device10.features.robustBufferAccess, sizeof(VkPhysicalDeviceFeatures) / sizeof(VkBool32)))) {
107 0 : return false;
108 : }
109 :
110 : #define SP_VK_BOOL_ARRAY(source, field, type) \
111 : SpanView<VkBool32>(&source.field, (sizeof(type) - offsetof(type, field)) / sizeof(VkBool32))
112 :
113 : #ifdef VK_ENABLE_BETA_EXTENSIONS
114 : if (!doCheck(
115 : SP_VK_BOOL_ARRAY(devicePortability, constantAlphaColorBlendFactors, VkPhysicalDevicePortabilitySubsetFeaturesKHR),
116 : SP_VK_BOOL_ARRAY(features.devicePortability, constantAlphaColorBlendFactors, VkPhysicalDevicePortabilitySubsetFeaturesKHR))) {
117 : return false;
118 : }
119 : #endif
120 :
121 : #if VK_VERSION_1_2
122 210 : if (version >= VK_API_VERSION_1_2) {
123 210 : if (!doCheck(
124 210 : SP_VK_BOOL_ARRAY(device11, storageBuffer16BitAccess, VkPhysicalDeviceVulkan11Features),
125 420 : SP_VK_BOOL_ARRAY(features.device11, storageBuffer16BitAccess, VkPhysicalDeviceVulkan11Features))) {
126 0 : return false;
127 : }
128 :
129 210 : if (!doCheck(
130 210 : SP_VK_BOOL_ARRAY(device12, samplerMirrorClampToEdge, VkPhysicalDeviceVulkan12Features),
131 420 : SP_VK_BOOL_ARRAY(features.device12, samplerMirrorClampToEdge, VkPhysicalDeviceVulkan12Features))) {
132 0 : return false;
133 : }
134 : }
135 : #endif
136 :
137 210 : if (!doCheck(
138 210 : SP_VK_BOOL_ARRAY(device16bitStorage, storageBuffer16BitAccess, VkPhysicalDevice16BitStorageFeaturesKHR),
139 420 : SP_VK_BOOL_ARRAY(features.device16bitStorage, storageBuffer16BitAccess, VkPhysicalDevice16BitStorageFeaturesKHR))) {
140 0 : return false;
141 : }
142 :
143 210 : if (!doCheck(
144 210 : SP_VK_BOOL_ARRAY(device8bitStorage, storageBuffer8BitAccess, VkPhysicalDevice8BitStorageFeaturesKHR),
145 420 : SP_VK_BOOL_ARRAY(features.device8bitStorage, storageBuffer8BitAccess, VkPhysicalDevice8BitStorageFeaturesKHR))) {
146 0 : return false;
147 : }
148 :
149 210 : if (!doCheck(
150 210 : SP_VK_BOOL_ARRAY(deviceDescriptorIndexing, shaderInputAttachmentArrayDynamicIndexing, VkPhysicalDeviceDescriptorIndexingFeaturesEXT),
151 420 : SP_VK_BOOL_ARRAY(features.deviceDescriptorIndexing, shaderInputAttachmentArrayDynamicIndexing, VkPhysicalDeviceDescriptorIndexingFeaturesEXT))) {
152 0 : return false;
153 : }
154 :
155 210 : if (!doCheck(
156 210 : SP_VK_BOOL_ARRAY(deviceBufferDeviceAddress, bufferDeviceAddress, VkPhysicalDeviceBufferDeviceAddressFeaturesKHR),
157 420 : SP_VK_BOOL_ARRAY(features.deviceBufferDeviceAddress, bufferDeviceAddress, VkPhysicalDeviceBufferDeviceAddressFeaturesKHR))) {
158 0 : return false;
159 : }
160 210 : if (!doCheck(
161 210 : SP_VK_BOOL_ARRAY(deviceShaderFloat16Int8, shaderFloat16, VkPhysicalDeviceShaderFloat16Int8FeaturesKHR),
162 420 : SP_VK_BOOL_ARRAY(features.deviceShaderFloat16Int8, shaderFloat16, VkPhysicalDeviceShaderFloat16Int8FeaturesKHR))) {
163 0 : return false;
164 : }
165 : #undef SP_VK_BOOL_ARRAY
166 :
167 210 : return true;
168 : }
169 :
170 84 : void DeviceInfo::Features::enableFromFeatures(const Features &features) {
171 672 : auto doCheck = [] (SpanView<VkBool32> src, SpanView<VkBool32> trg) {
172 13188 : for (size_t i = 0; i < src.size(); ++ i) {
173 12516 : if (trg[i]) {
174 2142 : const_cast<VkBool32 &>(src[i]) = trg[i];
175 : }
176 : }
177 672 : };
178 :
179 84 : doCheck(
180 84 : SpanView<VkBool32>(&device10.features.robustBufferAccess, sizeof(VkPhysicalDeviceFeatures) / sizeof(VkBool32)),
181 84 : SpanView<VkBool32>(&features.device10.features.robustBufferAccess, sizeof(VkPhysicalDeviceFeatures) / sizeof(VkBool32)));
182 :
183 : #define SP_VK_BOOL_ARRAY(source, field, type) \
184 : SpanView<VkBool32>(&source.field, (sizeof(type) - offsetof(type, field)) / sizeof(VkBool32))
185 :
186 : #ifdef VK_ENABLE_BETA_EXTENSIONS
187 : doCheck(
188 : SP_VK_BOOL_ARRAY(devicePortability, constantAlphaColorBlendFactors, VkPhysicalDevicePortabilitySubsetFeaturesKHR),
189 : SP_VK_BOOL_ARRAY(features.devicePortability, constantAlphaColorBlendFactors, VkPhysicalDevicePortabilitySubsetFeaturesKHR));
190 : #endif
191 :
192 : #if VK_VERSION_1_2
193 84 : doCheck(
194 84 : SP_VK_BOOL_ARRAY(device11, storageBuffer16BitAccess, VkPhysicalDeviceVulkan11Features),
195 84 : SP_VK_BOOL_ARRAY(features.device11, storageBuffer16BitAccess, VkPhysicalDeviceVulkan11Features));
196 :
197 84 : doCheck(
198 84 : SP_VK_BOOL_ARRAY(device12, samplerMirrorClampToEdge, VkPhysicalDeviceVulkan12Features),
199 84 : SP_VK_BOOL_ARRAY(features.device12, samplerMirrorClampToEdge, VkPhysicalDeviceVulkan12Features));
200 : #endif
201 :
202 84 : doCheck(
203 84 : SP_VK_BOOL_ARRAY(device16bitStorage, storageBuffer16BitAccess, VkPhysicalDevice16BitStorageFeaturesKHR),
204 84 : SP_VK_BOOL_ARRAY(features.device16bitStorage, storageBuffer16BitAccess, VkPhysicalDevice16BitStorageFeaturesKHR));
205 :
206 84 : doCheck(
207 84 : SP_VK_BOOL_ARRAY(device8bitStorage, storageBuffer8BitAccess, VkPhysicalDevice8BitStorageFeaturesKHR),
208 84 : SP_VK_BOOL_ARRAY(features.device8bitStorage, storageBuffer8BitAccess, VkPhysicalDevice8BitStorageFeaturesKHR));
209 :
210 84 : doCheck(
211 84 : SP_VK_BOOL_ARRAY(deviceDescriptorIndexing, shaderInputAttachmentArrayDynamicIndexing, VkPhysicalDeviceDescriptorIndexingFeaturesEXT),
212 84 : SP_VK_BOOL_ARRAY(features.deviceDescriptorIndexing, shaderInputAttachmentArrayDynamicIndexing, VkPhysicalDeviceDescriptorIndexingFeaturesEXT));
213 :
214 84 : doCheck(
215 84 : SP_VK_BOOL_ARRAY(deviceBufferDeviceAddress, bufferDeviceAddress, VkPhysicalDeviceBufferDeviceAddressFeaturesKHR),
216 84 : SP_VK_BOOL_ARRAY(features.deviceBufferDeviceAddress, bufferDeviceAddress, VkPhysicalDeviceBufferDeviceAddressFeaturesKHR));
217 :
218 84 : doCheck(
219 84 : SP_VK_BOOL_ARRAY(deviceShaderFloat16Int8, shaderFloat16, VkPhysicalDeviceShaderFloat16Int8FeaturesKHR),
220 84 : SP_VK_BOOL_ARRAY(features.deviceShaderFloat16Int8, shaderFloat16, VkPhysicalDeviceShaderFloat16Int8FeaturesKHR));
221 : #undef SP_VK_BOOL_ARRAY
222 84 : }
223 :
224 42 : void DeviceInfo::Features::disableFromFeatures(const Features &features) {
225 336 : auto doCheck = [] (SpanView<VkBool32> src, SpanView<VkBool32> trg) {
226 6594 : for (size_t i = 0; i < src.size(); ++ i) {
227 6258 : if (!trg[i]) {
228 336 : const_cast<VkBool32 &>(src[i]) = trg[i];
229 : }
230 : }
231 336 : };
232 :
233 42 : doCheck(
234 42 : SpanView<VkBool32>(&device10.features.robustBufferAccess, sizeof(VkPhysicalDeviceFeatures) / sizeof(VkBool32)),
235 42 : SpanView<VkBool32>(&features.device10.features.robustBufferAccess, sizeof(VkPhysicalDeviceFeatures) / sizeof(VkBool32)));
236 :
237 : #define SP_VK_BOOL_ARRAY(source, field, type) \
238 : SpanView<VkBool32>(&source.field, (sizeof(type) - offsetof(type, field)) / sizeof(VkBool32))
239 :
240 : #ifdef VK_ENABLE_BETA_EXTENSIONS
241 : doCheck(
242 : SP_VK_BOOL_ARRAY(devicePortability, constantAlphaColorBlendFactors, VkPhysicalDevicePortabilitySubsetFeaturesKHR),
243 : SP_VK_BOOL_ARRAY(features.devicePortability, constantAlphaColorBlendFactors, VkPhysicalDevicePortabilitySubsetFeaturesKHR));
244 : #endif
245 :
246 : #if VK_VERSION_1_2
247 42 : doCheck(
248 42 : SP_VK_BOOL_ARRAY(device11, storageBuffer16BitAccess, VkPhysicalDeviceVulkan11Features),
249 42 : SP_VK_BOOL_ARRAY(features.device11, storageBuffer16BitAccess, VkPhysicalDeviceVulkan11Features));
250 :
251 42 : doCheck(
252 42 : SP_VK_BOOL_ARRAY(device12, samplerMirrorClampToEdge, VkPhysicalDeviceVulkan12Features),
253 42 : SP_VK_BOOL_ARRAY(features.device12, samplerMirrorClampToEdge, VkPhysicalDeviceVulkan12Features));
254 : #endif
255 :
256 42 : doCheck(
257 42 : SP_VK_BOOL_ARRAY(device16bitStorage, storageBuffer16BitAccess, VkPhysicalDevice16BitStorageFeaturesKHR),
258 42 : SP_VK_BOOL_ARRAY(features.device16bitStorage, storageBuffer16BitAccess, VkPhysicalDevice16BitStorageFeaturesKHR));
259 :
260 42 : doCheck(
261 42 : SP_VK_BOOL_ARRAY(device8bitStorage, storageBuffer8BitAccess, VkPhysicalDevice8BitStorageFeaturesKHR),
262 42 : SP_VK_BOOL_ARRAY(features.device8bitStorage, storageBuffer8BitAccess, VkPhysicalDevice8BitStorageFeaturesKHR));
263 :
264 42 : doCheck(
265 42 : SP_VK_BOOL_ARRAY(deviceDescriptorIndexing, shaderInputAttachmentArrayDynamicIndexing, VkPhysicalDeviceDescriptorIndexingFeaturesEXT),
266 42 : SP_VK_BOOL_ARRAY(features.deviceDescriptorIndexing, shaderInputAttachmentArrayDynamicIndexing, VkPhysicalDeviceDescriptorIndexingFeaturesEXT));
267 :
268 42 : doCheck(
269 42 : SP_VK_BOOL_ARRAY(deviceBufferDeviceAddress, bufferDeviceAddress, VkPhysicalDeviceBufferDeviceAddressFeaturesKHR),
270 42 : SP_VK_BOOL_ARRAY(features.deviceBufferDeviceAddress, bufferDeviceAddress, VkPhysicalDeviceBufferDeviceAddressFeaturesKHR));
271 :
272 42 : doCheck(
273 42 : SP_VK_BOOL_ARRAY(deviceShaderFloat16Int8, shaderFloat16, VkPhysicalDeviceShaderFloat16Int8FeaturesKHR),
274 42 : SP_VK_BOOL_ARRAY(features.deviceShaderFloat16Int8, shaderFloat16, VkPhysicalDeviceShaderFloat16Int8FeaturesKHR));
275 : #undef SP_VK_BOOL_ARRAY
276 42 : }
277 :
278 :
279 126 : void DeviceInfo::Features::updateFrom13() {
280 : #if VK_VERSION_1_3
281 : #endif
282 126 : updateFrom12();
283 126 : }
284 :
285 126 : void DeviceInfo::Features::updateFrom12() {
286 : #if VK_VERSION_1_2
287 126 : if (device11.storageBuffer16BitAccess == VK_TRUE) {
288 126 : flags |= ExtensionFlags::Storage16Bit;
289 : } else {
290 0 : flags &= (~ExtensionFlags::Storage16Bit);
291 : }
292 :
293 126 : device16bitStorage.storageBuffer16BitAccess = device11.storageBuffer16BitAccess;
294 126 : device16bitStorage.uniformAndStorageBuffer16BitAccess = device11.uniformAndStorageBuffer16BitAccess;
295 126 : device16bitStorage.storagePushConstant16 = device11.storagePushConstant16;
296 126 : device16bitStorage.storageInputOutput16 = device11.storageInputOutput16;
297 :
298 126 : if (device12.drawIndirectCount == VK_TRUE) {
299 126 : flags |= ExtensionFlags::DrawIndirectCount;
300 : } else {
301 0 : flags &= (~ExtensionFlags::DrawIndirectCount);
302 : }
303 :
304 126 : if (device12.storageBuffer8BitAccess == VK_TRUE) {
305 126 : flags |= ExtensionFlags::Storage8Bit;
306 : } else {
307 0 : flags &= (~ExtensionFlags::Storage8Bit);
308 : }
309 :
310 126 : device8bitStorage.storageBuffer8BitAccess = device12.storageBuffer8BitAccess;
311 126 : device8bitStorage.uniformAndStorageBuffer8BitAccess = device12.uniformAndStorageBuffer8BitAccess;
312 126 : device8bitStorage.storagePushConstant8 = device12.storagePushConstant8;
313 :
314 126 : deviceShaderFloat16Int8.shaderFloat16 = device12.shaderFloat16;
315 126 : deviceShaderFloat16Int8.shaderInt8 = device12.shaderInt8;
316 :
317 126 : if (device12.shaderFloat16 == VK_TRUE) {
318 126 : flags |= ExtensionFlags::ShaderFloat16;
319 : } else {
320 0 : flags &= (~ExtensionFlags::ShaderFloat16);
321 : }
322 :
323 126 : if (device12.shaderInt8 == VK_TRUE) {
324 126 : flags |= ExtensionFlags::ShaderInt8;
325 : } else {
326 0 : flags &= (~ExtensionFlags::ShaderInt8);
327 : }
328 :
329 126 : if (device12.descriptorIndexing == VK_TRUE) {
330 126 : flags |= ExtensionFlags::DescriptorIndexing;
331 : } else {
332 0 : flags &= (~ExtensionFlags::DescriptorIndexing);
333 : }
334 :
335 126 : deviceDescriptorIndexing.shaderInputAttachmentArrayDynamicIndexing = device12.shaderInputAttachmentArrayDynamicIndexing;
336 126 : deviceDescriptorIndexing.shaderUniformTexelBufferArrayDynamicIndexing = device12.shaderUniformTexelBufferArrayDynamicIndexing;
337 126 : deviceDescriptorIndexing.shaderStorageTexelBufferArrayDynamicIndexing = device12.shaderStorageTexelBufferArrayDynamicIndexing;
338 126 : deviceDescriptorIndexing.shaderUniformBufferArrayNonUniformIndexing = device12.shaderUniformBufferArrayNonUniformIndexing;
339 126 : deviceDescriptorIndexing.shaderSampledImageArrayNonUniformIndexing = device12.shaderSampledImageArrayNonUniformIndexing;
340 126 : deviceDescriptorIndexing.shaderStorageBufferArrayNonUniformIndexing = device12.shaderStorageBufferArrayNonUniformIndexing;
341 126 : deviceDescriptorIndexing.shaderStorageImageArrayNonUniformIndexing = device12.shaderStorageImageArrayNonUniformIndexing;
342 126 : deviceDescriptorIndexing.shaderInputAttachmentArrayNonUniformIndexing = device12.shaderInputAttachmentArrayNonUniformIndexing;
343 126 : deviceDescriptorIndexing.shaderUniformTexelBufferArrayNonUniformIndexing = device12.shaderUniformTexelBufferArrayNonUniformIndexing;
344 126 : deviceDescriptorIndexing.shaderStorageTexelBufferArrayNonUniformIndexing = device12.shaderStorageTexelBufferArrayNonUniformIndexing;
345 126 : deviceDescriptorIndexing.descriptorBindingUniformBufferUpdateAfterBind = device12.descriptorBindingUniformBufferUpdateAfterBind;
346 126 : deviceDescriptorIndexing.descriptorBindingSampledImageUpdateAfterBind = device12.descriptorBindingSampledImageUpdateAfterBind;
347 126 : deviceDescriptorIndexing.descriptorBindingStorageImageUpdateAfterBind = device12.descriptorBindingStorageImageUpdateAfterBind;
348 126 : deviceDescriptorIndexing.descriptorBindingStorageBufferUpdateAfterBind = device12.descriptorBindingStorageBufferUpdateAfterBind;
349 126 : deviceDescriptorIndexing.descriptorBindingUniformTexelBufferUpdateAfterBind = device12.descriptorBindingUniformTexelBufferUpdateAfterBind;
350 126 : deviceDescriptorIndexing.descriptorBindingStorageTexelBufferUpdateAfterBind = device12.descriptorBindingStorageTexelBufferUpdateAfterBind;
351 126 : deviceDescriptorIndexing.descriptorBindingUpdateUnusedWhilePending = device12.descriptorBindingUpdateUnusedWhilePending;
352 126 : deviceDescriptorIndexing.descriptorBindingPartiallyBound = device12.descriptorBindingPartiallyBound;
353 126 : deviceDescriptorIndexing.descriptorBindingVariableDescriptorCount = device12.descriptorBindingVariableDescriptorCount;
354 126 : deviceDescriptorIndexing.runtimeDescriptorArray = device12.runtimeDescriptorArray;
355 :
356 126 : if (device12.bufferDeviceAddress == VK_TRUE) {
357 126 : flags |= ExtensionFlags::DeviceAddress;
358 : } else {
359 0 : flags &= (~ExtensionFlags::DeviceAddress);
360 : }
361 :
362 126 : deviceBufferDeviceAddress.bufferDeviceAddress = device12.bufferDeviceAddress;
363 126 : deviceBufferDeviceAddress.bufferDeviceAddressCaptureReplay = device12.bufferDeviceAddressCaptureReplay;
364 126 : deviceBufferDeviceAddress.bufferDeviceAddressMultiDevice = device12.bufferDeviceAddressMultiDevice;
365 : #endif
366 126 : }
367 :
368 42 : void DeviceInfo::Features::updateTo12(bool updateFlags) {
369 42 : if (updateFlags) {
370 0 : if ((flags & ExtensionFlags::Storage16Bit) != ExtensionFlags::None) {
371 0 : if (device16bitStorage.storageBuffer16BitAccess == VK_TRUE) {
372 0 : flags |= ExtensionFlags::Storage16Bit;
373 : } else {
374 0 : flags &= (~ExtensionFlags::Storage16Bit);
375 : }
376 : }
377 0 : if ((flags & ExtensionFlags::Storage8Bit) != ExtensionFlags::None) {
378 0 : if (device8bitStorage.storageBuffer8BitAccess == VK_TRUE) {
379 0 : flags |= ExtensionFlags::Storage8Bit;
380 : } else {
381 0 : flags &= (~ExtensionFlags::Storage8Bit);
382 : }
383 : }
384 :
385 0 : if ((flags & ExtensionFlags::ShaderFloat16) != ExtensionFlags::None || (flags & ExtensionFlags::ShaderInt8) != ExtensionFlags::None) {
386 0 : if (deviceShaderFloat16Int8.shaderInt8 == VK_TRUE) {
387 0 : flags |= ExtensionFlags::ShaderInt8;
388 : } else {
389 0 : flags &= (~ExtensionFlags::ShaderInt8);
390 : }
391 0 : if (deviceShaderFloat16Int8.shaderFloat16 == VK_TRUE) {
392 0 : flags |= ExtensionFlags::ShaderFloat16;
393 : } else {
394 0 : flags &= (~ExtensionFlags::ShaderFloat16);
395 : }
396 : }
397 :
398 0 : if ((flags & ExtensionFlags::DeviceAddress) != ExtensionFlags::None) {
399 0 : if (deviceBufferDeviceAddress.bufferDeviceAddress == VK_TRUE) {
400 0 : flags |= ExtensionFlags::DeviceAddress;
401 : } else {
402 0 : flags &= (~ExtensionFlags::DeviceAddress);
403 : }
404 : }
405 : }
406 :
407 : #if VK_VERSION_1_2
408 42 : device11.storageBuffer16BitAccess = device16bitStorage.storageBuffer16BitAccess;
409 42 : device11.uniformAndStorageBuffer16BitAccess = device16bitStorage.storageBuffer16BitAccess;
410 42 : device11.storagePushConstant16 = device16bitStorage.storageBuffer16BitAccess;
411 42 : device11.storageInputOutput16 = device16bitStorage.storageBuffer16BitAccess;
412 :
413 42 : if ((flags & ExtensionFlags::DrawIndirectCount) != ExtensionFlags::None) {
414 42 : device12.drawIndirectCount = VK_TRUE;
415 : }
416 :
417 42 : device12.storageBuffer8BitAccess = device8bitStorage.storageBuffer8BitAccess;
418 42 : device12.uniformAndStorageBuffer8BitAccess = device8bitStorage.uniformAndStorageBuffer8BitAccess;
419 42 : device12.storagePushConstant8 = device8bitStorage.storagePushConstant8;
420 :
421 42 : device12.shaderFloat16 = deviceShaderFloat16Int8.shaderFloat16;
422 42 : device12.shaderInt8 = deviceShaderFloat16Int8.shaderInt8;
423 :
424 42 : if ((flags & ExtensionFlags::DescriptorIndexing) != ExtensionFlags::None) {
425 42 : device12.descriptorIndexing = VK_TRUE;
426 : }
427 :
428 42 : device12.shaderInputAttachmentArrayDynamicIndexing = deviceDescriptorIndexing.shaderInputAttachmentArrayDynamicIndexing;
429 42 : device12.shaderUniformTexelBufferArrayDynamicIndexing = deviceDescriptorIndexing.shaderUniformTexelBufferArrayDynamicIndexing;
430 42 : device12.shaderStorageTexelBufferArrayDynamicIndexing = deviceDescriptorIndexing.shaderStorageTexelBufferArrayDynamicIndexing;
431 42 : device12.shaderUniformBufferArrayNonUniformIndexing = deviceDescriptorIndexing.shaderUniformBufferArrayNonUniformIndexing;
432 42 : device12.shaderSampledImageArrayNonUniformIndexing = deviceDescriptorIndexing.shaderSampledImageArrayNonUniformIndexing;
433 42 : device12.shaderStorageBufferArrayNonUniformIndexing = deviceDescriptorIndexing.shaderStorageBufferArrayNonUniformIndexing;
434 42 : device12.shaderStorageImageArrayNonUniformIndexing = deviceDescriptorIndexing.shaderStorageImageArrayNonUniformIndexing;
435 42 : device12.shaderInputAttachmentArrayNonUniformIndexing = deviceDescriptorIndexing.shaderInputAttachmentArrayNonUniformIndexing;
436 42 : device12.shaderUniformTexelBufferArrayNonUniformIndexing = deviceDescriptorIndexing.shaderUniformTexelBufferArrayNonUniformIndexing;
437 42 : device12.shaderStorageTexelBufferArrayNonUniformIndexing = deviceDescriptorIndexing.shaderStorageTexelBufferArrayNonUniformIndexing;
438 42 : device12.descriptorBindingUniformBufferUpdateAfterBind = deviceDescriptorIndexing.descriptorBindingUniformBufferUpdateAfterBind;
439 42 : device12.descriptorBindingSampledImageUpdateAfterBind = deviceDescriptorIndexing.descriptorBindingSampledImageUpdateAfterBind;
440 42 : device12.descriptorBindingStorageImageUpdateAfterBind = deviceDescriptorIndexing.descriptorBindingStorageImageUpdateAfterBind;
441 42 : device12.descriptorBindingStorageBufferUpdateAfterBind = deviceDescriptorIndexing.descriptorBindingStorageBufferUpdateAfterBind;
442 42 : device12.descriptorBindingUniformTexelBufferUpdateAfterBind = deviceDescriptorIndexing.descriptorBindingUniformTexelBufferUpdateAfterBind;
443 42 : device12.descriptorBindingStorageTexelBufferUpdateAfterBind = deviceDescriptorIndexing.descriptorBindingStorageTexelBufferUpdateAfterBind;
444 42 : device12.descriptorBindingUpdateUnusedWhilePending = deviceDescriptorIndexing.descriptorBindingUpdateUnusedWhilePending;
445 42 : device12.descriptorBindingPartiallyBound = deviceDescriptorIndexing.descriptorBindingPartiallyBound;
446 42 : device12.descriptorBindingVariableDescriptorCount = deviceDescriptorIndexing.descriptorBindingVariableDescriptorCount;
447 42 : device12.runtimeDescriptorArray = deviceDescriptorIndexing.runtimeDescriptorArray;
448 :
449 42 : device12.bufferDeviceAddress = deviceBufferDeviceAddress.bufferDeviceAddress;
450 42 : device12.bufferDeviceAddressCaptureReplay = deviceBufferDeviceAddress.bufferDeviceAddressCaptureReplay;
451 42 : device12.bufferDeviceAddressMultiDevice = deviceBufferDeviceAddress.bufferDeviceAddressMultiDevice;
452 : #endif
453 42 : }
454 :
455 462 : void DeviceInfo::Features::clear() {
456 4158 : auto doClear = [] (SpanView<VkBool32> src) {
457 80388 : for (size_t i = 0; i < src.size(); ++ i) {
458 76230 : const_cast<VkBool32 &>(src[i]) = VK_FALSE;
459 : }
460 4158 : };
461 :
462 462 : doClear(SpanView<VkBool32>(&device10.features.robustBufferAccess, sizeof(VkPhysicalDeviceFeatures) / sizeof(VkBool32)));
463 :
464 : #define SP_VK_BOOL_ARRAY(source, field, type) \
465 : SpanView<VkBool32>(&source.field, (sizeof(type) - offsetof(type, field)) / sizeof(VkBool32))
466 :
467 : #ifdef VK_ENABLE_BETA_EXTENSIONS
468 : doClear(SP_VK_BOOL_ARRAY(devicePortability, constantAlphaColorBlendFactors, VkPhysicalDevicePortabilitySubsetFeaturesKHR));
469 : #endif
470 :
471 : #if VK_VERSION_1_2
472 462 : doClear(SP_VK_BOOL_ARRAY(device11, storageBuffer16BitAccess, VkPhysicalDeviceVulkan11Features));
473 462 : doClear(SP_VK_BOOL_ARRAY(device12, samplerMirrorClampToEdge, VkPhysicalDeviceVulkan12Features));
474 : #endif
475 :
476 : #if VK_VERSION_1_3
477 462 : doClear(SP_VK_BOOL_ARRAY(device13, robustImageAccess, VkPhysicalDeviceVulkan13Features));
478 : #endif
479 :
480 462 : doClear(SP_VK_BOOL_ARRAY(device16bitStorage, storageBuffer16BitAccess, VkPhysicalDevice16BitStorageFeaturesKHR));
481 462 : doClear(SP_VK_BOOL_ARRAY(device8bitStorage, storageBuffer8BitAccess, VkPhysicalDevice8BitStorageFeaturesKHR));
482 462 : doClear(SP_VK_BOOL_ARRAY(deviceDescriptorIndexing, shaderInputAttachmentArrayDynamicIndexing, VkPhysicalDeviceDescriptorIndexingFeaturesEXT));
483 462 : doClear(SP_VK_BOOL_ARRAY(deviceBufferDeviceAddress, bufferDeviceAddress, VkPhysicalDeviceBufferDeviceAddressFeaturesKHR));
484 462 : doClear(SP_VK_BOOL_ARRAY(deviceShaderFloat16Int8, shaderFloat16, VkPhysicalDeviceShaderFloat16Int8FeaturesKHR));
485 : #undef SP_VK_BOOL_ARRAY
486 462 : }
487 :
488 462 : DeviceInfo::Features::Features() {
489 462 : clear();
490 462 : }
491 :
492 336 : DeviceInfo::Features::Features(const Features &f) {
493 336 : memcpy(this, &f, sizeof(Features));
494 336 : }
495 :
496 84 : DeviceInfo::Features &DeviceInfo::Features::operator=(const Features &f) {
497 84 : memcpy(this, &f, sizeof(Features));
498 84 : return *this;
499 : }
500 :
501 168 : DeviceInfo::Properties::Properties() { }
502 :
503 336 : DeviceInfo::Properties::Properties(const Properties &p) {
504 336 : memcpy(this, &p, sizeof(Properties)); }
505 :
506 42 : DeviceInfo::Properties &DeviceInfo::Properties::operator=(const Properties &p) {
507 42 : memcpy(this, &p, sizeof(Properties));
508 42 : return *this;
509 : }
510 :
511 168 : DeviceInfo::DeviceInfo() { }
512 :
513 0 : DeviceInfo::DeviceInfo(VkPhysicalDevice dev, QueueFamilyInfo gr, QueueFamilyInfo pres, QueueFamilyInfo tr, QueueFamilyInfo comp,
514 0 : Vector<StringView> &&optionals, Vector<StringView> &&promoted)
515 0 : : device(dev), graphicsFamily(gr), presentFamily(pres), transferFamily(tr), computeFamily(comp)
516 0 : , optionalExtensions(move(optionals)), promotedExtensions(move(promoted)) { }
517 :
518 147 : bool DeviceInfo::supportsPresentation() const {
519 : // transferFamily and computeFamily can be same as graphicsFamily
520 147 : bool supportsGraphics = (graphicsFamily.ops & QueueOperations::Graphics) != QueueOperations::None;
521 147 : bool supportsPresent = (presentFamily.ops & QueueOperations::Present) != QueueOperations::None;
522 147 : bool supportsTransfer = (transferFamily.ops & QueueOperations::Transfer) != QueueOperations::None;
523 147 : bool supportsCompute = (computeFamily.ops & QueueOperations::Compute) != QueueOperations::None;
524 147 : if (supportsGraphics && supportsPresent && supportsTransfer && supportsCompute
525 84 : && requiredFeaturesExists && requiredExtensionsExists) {
526 84 : return true;
527 : }
528 63 : return false;
529 : }
530 :
531 168 : String DeviceInfo::description() const {
532 168 : StringStream stream;
533 168 : stream << "\t\t[Queue] ";
534 :
535 168 : if ((graphicsFamily.ops & QueueOperations::Graphics) != QueueOperations::None) {
536 168 : stream << "Graphics: [" << graphicsFamily.index << "]; ";
537 : } else {
538 0 : stream << "Graphics: [Not available]; ";
539 : }
540 :
541 168 : if ((presentFamily.ops & QueueOperations::Present) != QueueOperations::None) {
542 84 : stream << "Presentation: [" << presentFamily.index << "]; ";
543 : } else {
544 84 : stream << "Presentation: [Not available]; ";
545 : }
546 :
547 168 : if ((transferFamily.ops & QueueOperations::Transfer) != QueueOperations::None) {
548 168 : stream << "Transfer: [" << transferFamily.index << "]; ";
549 : } else {
550 0 : stream << "Transfer: [Not available]; ";
551 : }
552 :
553 168 : if ((computeFamily.ops & QueueOperations::Compute) != QueueOperations::None) {
554 168 : stream << "Compute: [" << computeFamily.index << "];\n";
555 : } else {
556 0 : stream << "Compute: [Not available];\n";
557 : }
558 :
559 : stream << "\t\t[Limits: Samplers]"
560 168 : " PerSet: " << properties.device10.properties.limits.maxDescriptorSetSamplers
561 168 : << " (updatable: " << properties.deviceDescriptorIndexing.maxDescriptorSetUpdateAfterBindSamplers << ");"
562 168 : " PerStage: " << properties.device10.properties.limits.maxPerStageDescriptorSamplers
563 168 : << " (updatable: " << properties.deviceDescriptorIndexing.maxPerStageDescriptorUpdateAfterBindSamplers << ");"
564 168 : "\n";
565 :
566 : stream << "\t\t[Limits: UniformBuffers]"
567 168 : " PerSet: " << properties.device10.properties.limits.maxDescriptorSetUniformBuffers
568 168 : << " dyn: " << properties.device10.properties.limits.maxDescriptorSetUniformBuffersDynamic
569 168 : << " (updatable: " << properties.deviceDescriptorIndexing.maxDescriptorSetUpdateAfterBindUniformBuffers
570 168 : << " dyn: " << properties.deviceDescriptorIndexing.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic << ");"
571 168 : " PerStage: " << properties.device10.properties.limits.maxPerStageDescriptorUniformBuffers
572 168 : << " (updatable: " << properties.deviceDescriptorIndexing.maxPerStageDescriptorUpdateAfterBindUniformBuffers << ");"
573 168 : << (properties.deviceDescriptorIndexing.shaderUniformBufferArrayNonUniformIndexingNative ? StringView(" NonUniformIndexingNative;") : StringView())
574 336 : << "\n";
575 :
576 : stream << "\t\t[Limits: StorageBuffers]"
577 168 : " PerSet: " << properties.device10.properties.limits.maxDescriptorSetStorageBuffers
578 168 : << " dyn: " << properties.device10.properties.limits.maxDescriptorSetStorageBuffersDynamic
579 168 : << " (updatable: " << properties.deviceDescriptorIndexing.maxDescriptorSetUpdateAfterBindStorageBuffers
580 168 : << " dyn: " << properties.deviceDescriptorIndexing.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic << ");"
581 168 : " PerStage: " << properties.device10.properties.limits.maxPerStageDescriptorStorageBuffers
582 168 : << " (updatable: " << properties.deviceDescriptorIndexing.maxPerStageDescriptorUpdateAfterBindStorageBuffers << ");"
583 168 : << (properties.deviceDescriptorIndexing.shaderStorageBufferArrayNonUniformIndexingNative ? StringView(" NonUniformIndexingNative;") : StringView())
584 336 : << "\n";
585 :
586 : stream << "\t\t[Limits: SampledImages]"
587 168 : " PerSet: " << properties.device10.properties.limits.maxDescriptorSetSampledImages
588 168 : << " (updatable: " << properties.deviceDescriptorIndexing.maxDescriptorSetUpdateAfterBindSampledImages << ");"
589 168 : " PerStage: " << properties.device10.properties.limits.maxPerStageDescriptorSampledImages
590 168 : << " (updatable: " << properties.deviceDescriptorIndexing.maxPerStageDescriptorUpdateAfterBindSampledImages << ");"
591 168 : << (properties.deviceDescriptorIndexing.shaderSampledImageArrayNonUniformIndexingNative ? StringView(" NonUniformIndexingNative;") : StringView())
592 336 : << "\n";
593 :
594 : stream << "\t\t[Limits: StorageImages]"
595 168 : " PerSet: " << properties.device10.properties.limits.maxDescriptorSetStorageImages
596 168 : << " (updatable: " << properties.deviceDescriptorIndexing.maxDescriptorSetUpdateAfterBindStorageImages << ");"
597 168 : " PerStage: " << properties.device10.properties.limits.maxPerStageDescriptorStorageImages
598 168 : << " (updatable: " << properties.deviceDescriptorIndexing.maxPerStageDescriptorUpdateAfterBindStorageImages << ");"
599 168 : << (properties.deviceDescriptorIndexing.shaderStorageImageArrayNonUniformIndexingNative ? StringView(" NonUniformIndexingNative;") : StringView())
600 336 : << "\n";
601 :
602 : stream << "\t\t[Limits: InputAttachments]"
603 168 : " PerSet: " << properties.device10.properties.limits.maxDescriptorSetInputAttachments
604 168 : << " (updatable: " << properties.deviceDescriptorIndexing.maxDescriptorSetUpdateAfterBindInputAttachments << ");"
605 168 : " PerStage: " << properties.device10.properties.limits.maxPerStageDescriptorInputAttachments
606 168 : << " (updatable: " << properties.deviceDescriptorIndexing.maxPerStageDescriptorUpdateAfterBindInputAttachments << ");"
607 168 : << (properties.deviceDescriptorIndexing.shaderInputAttachmentArrayNonUniformIndexingNative ? StringView(" NonUniformIndexingNative;") : StringView())
608 336 : << "\n";
609 :
610 : stream << "\t\t[Limits: Resources]"
611 168 : " PerStage: " << properties.device10.properties.limits.maxPerStageDescriptorInputAttachments
612 168 : << " (updatable: " << properties.deviceDescriptorIndexing.maxPerStageUpdateAfterBindResources << ");"
613 168 : "\n";
614 168 : stream << "\t\t[Limits: Allocations] " << properties.device10.properties.limits.maxMemoryAllocationCount << " blocks, "
615 168 : << properties.device10.properties.limits.maxSamplerAllocationCount << " samplers;\n";
616 168 : stream << "\t\t[Limits: Ranges] Uniform: " << properties.device10.properties.limits.maxUniformBufferRange << ", Storage: "
617 168 : << properties.device10.properties.limits.maxStorageBufferRange << ";\n";
618 168 : stream << "\t\t[Limits: DrawIndirectCount] " << properties.device10.properties.limits.maxDrawIndirectCount << ";\n";
619 :
620 : /*uint32_t extensionCount;
621 : instance->vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount, nullptr);
622 :
623 : Vector<VkExtensionProperties> availableExtensions(extensionCount);
624 : instance->vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount, availableExtensions.data());
625 :
626 : stream << "\t[Extensions]\n";
627 : for (auto &it : availableExtensions) {
628 : stream << "\t\t" << it.extensionName << ": " << vk::Instance::getVersionDescription(it.specVersion) << "\n";
629 : }*/
630 :
631 336 : return stream.str();
632 168 : }
633 :
634 336 : QueueOperations getQueueOperations(VkQueueFlags flags, bool present) {
635 672 : QueueOperations ret = QueueOperations(flags) &
636 336 : (QueueOperations::Graphics | QueueOperations::Compute | QueueOperations::Transfer | QueueOperations::SparceBinding);
637 336 : if (present) {
638 105 : ret |= QueueOperations::Present;
639 : }
640 336 : return ret;
641 : }
642 :
643 51970 : QueueOperations getQueueOperations(core::PassType type) {
644 51970 : switch (type) {
645 1234 : case core::PassType::Graphics: return QueueOperations::Graphics; break;
646 50736 : case core::PassType::Compute: return QueueOperations::Compute; break;
647 0 : case core::PassType::Transfer: return QueueOperations::Transfer; break;
648 0 : case core::PassType::Generic: return QueueOperations::None; break;
649 : }
650 0 : return QueueOperations::None;
651 : }
652 :
653 21 : String getQueueOperationsDesc(QueueOperations ops) {
654 21 : StringStream stream;
655 21 : if ((ops & QueueOperations::Graphics) != QueueOperations::None) { stream << " Graphics"; }
656 21 : if ((ops & QueueOperations::Compute) != QueueOperations::None) { stream << " Compute"; }
657 21 : if ((ops & QueueOperations::Transfer) != QueueOperations::None) { stream << " Transfer"; }
658 21 : if ((ops & QueueOperations::SparceBinding) != QueueOperations::None) { stream << " SparceBinding"; }
659 21 : if ((ops & QueueOperations::Present) != QueueOperations::None) { stream << " Present"; }
660 42 : return stream.str();
661 21 : }
662 :
663 0 : VkShaderStageFlagBits getVkStageBits(core::ProgramStage stage) {
664 0 : return VkShaderStageFlagBits(stage);
665 : }
666 :
667 6597927 : StringView getVkFormatName(VkFormat fmt) {
668 6597927 : switch (fmt) {
669 21 : case VK_FORMAT_UNDEFINED: return "UNDEFINED"; break;
670 21 : case VK_FORMAT_R4G4_UNORM_PACK8: return "R4G4_UNORM_PACK8"; break;
671 21 : case VK_FORMAT_R4G4B4A4_UNORM_PACK16: return "R4G4B4A4_UNORM_PACK16"; break;
672 21 : case VK_FORMAT_B4G4R4A4_UNORM_PACK16: return "B4G4R4A4_UNORM_PACK16"; break;
673 21 : case VK_FORMAT_R5G6B5_UNORM_PACK16: return "R5G6B5_UNORM_PACK16"; break;
674 21 : case VK_FORMAT_B5G6R5_UNORM_PACK16: return "B5G6R5_UNORM_PACK16"; break;
675 21 : case VK_FORMAT_R5G5B5A1_UNORM_PACK16: return "R5G5B5A1_UNORM_PACK16"; break;
676 21 : case VK_FORMAT_B5G5R5A1_UNORM_PACK16: return "B5G5R5A1_UNORM_PACK16"; break;
677 21 : case VK_FORMAT_A1R5G5B5_UNORM_PACK16: return "A1R5G5B5_UNORM_PACK16"; break;
678 21 : case VK_FORMAT_R8_UNORM: return "R8_UNORM"; break;
679 21 : case VK_FORMAT_R8_SNORM: return "R8_SNORM"; break;
680 21 : case VK_FORMAT_R8_USCALED: return "R8_USCALED"; break;
681 21 : case VK_FORMAT_R8_SSCALED: return "R8_SSCALED"; break;
682 21 : case VK_FORMAT_R8_UINT: return "R8_UINT"; break;
683 21 : case VK_FORMAT_R8_SINT: return "R8_SINT"; break;
684 21 : case VK_FORMAT_R8_SRGB: return "R8_SRGB"; break;
685 21 : case VK_FORMAT_R8G8_UNORM: return "R8G8_UNORM"; break;
686 21 : case VK_FORMAT_R8G8_SNORM: return "R8G8_SNORM"; break;
687 21 : case VK_FORMAT_R8G8_USCALED: return "R8G8_USCALED"; break;
688 21 : case VK_FORMAT_R8G8_SSCALED: return "R8G8_SSCALED"; break;
689 21 : case VK_FORMAT_R8G8_UINT: return "R8G8_UINT"; break;
690 21 : case VK_FORMAT_R8G8_SINT: return "R8G8_SINT"; break;
691 21 : case VK_FORMAT_R8G8_SRGB: return "R8G8_SRGB"; break;
692 21 : case VK_FORMAT_R8G8B8_UNORM: return "R8G8B8_UNORM"; break;
693 21 : case VK_FORMAT_R8G8B8_SNORM: return "R8G8B8_SNORM"; break;
694 21 : case VK_FORMAT_R8G8B8_USCALED: return "R8G8B8_USCALED"; break;
695 21 : case VK_FORMAT_R8G8B8_SSCALED: return "R8G8B8_SSCALED"; break;
696 21 : case VK_FORMAT_R8G8B8_UINT: return "R8G8B8_UINT"; break;
697 21 : case VK_FORMAT_R8G8B8_SINT: return "R8G8B8_SINT"; break;
698 21 : case VK_FORMAT_R8G8B8_SRGB: return "R8G8B8_SRGB"; break;
699 21 : case VK_FORMAT_B8G8R8_UNORM: return "B8G8R8_UNORM"; break;
700 21 : case VK_FORMAT_B8G8R8_SNORM: return "B8G8R8_SNORM"; break;
701 21 : case VK_FORMAT_B8G8R8_USCALED: return "B8G8R8_USCALED"; break;
702 21 : case VK_FORMAT_B8G8R8_SSCALED: return "B8G8R8_SSCALED"; break;
703 21 : case VK_FORMAT_B8G8R8_UINT: return "B8G8R8_UINT"; break;
704 21 : case VK_FORMAT_B8G8R8_SINT: return "B8G8R8_SINT"; break;
705 21 : case VK_FORMAT_B8G8R8_SRGB: return "B8G8R8_SRGB"; break;
706 21 : case VK_FORMAT_R8G8B8A8_UNORM: return "R8G8B8A8_UNORM"; break;
707 21 : case VK_FORMAT_R8G8B8A8_SNORM: return "R8G8B8A8_SNORM"; break;
708 21 : case VK_FORMAT_R8G8B8A8_USCALED: return "R8G8B8A8_USCALED"; break;
709 21 : case VK_FORMAT_R8G8B8A8_SSCALED: return "R8G8B8A8_SSCALED"; break;
710 21 : case VK_FORMAT_R8G8B8A8_UINT: return "R8G8B8A8_UINT"; break;
711 21 : case VK_FORMAT_R8G8B8A8_SINT: return "R8G8B8A8_SINT"; break;
712 21 : case VK_FORMAT_R8G8B8A8_SRGB: return "R8G8B8A8_SRGB"; break;
713 21 : case VK_FORMAT_B8G8R8A8_UNORM: return "B8G8R8A8_UNORM"; break;
714 21 : case VK_FORMAT_B8G8R8A8_SNORM: return "B8G8R8A8_SNORM"; break;
715 21 : case VK_FORMAT_B8G8R8A8_USCALED: return "B8G8R8A8_USCALED"; break;
716 21 : case VK_FORMAT_B8G8R8A8_SSCALED: return "B8G8R8A8_SSCALED"; break;
717 21 : case VK_FORMAT_B8G8R8A8_UINT: return "B8G8R8A8_UINT"; break;
718 21 : case VK_FORMAT_B8G8R8A8_SINT: return "B8G8R8A8_SINT"; break;
719 21 : case VK_FORMAT_B8G8R8A8_SRGB: return "B8G8R8A8_SRGB"; break;
720 21 : case VK_FORMAT_A8B8G8R8_UNORM_PACK32: return "A8B8G8R8_UNORM_PACK32"; break;
721 21 : case VK_FORMAT_A8B8G8R8_SNORM_PACK32: return "A8B8G8R8_SNORM_PACK32"; break;
722 21 : case VK_FORMAT_A8B8G8R8_USCALED_PACK32: return "A8B8G8R8_USCALED_PACK32"; break;
723 21 : case VK_FORMAT_A8B8G8R8_SSCALED_PACK32: return "A8B8G8R8_SSCALED_PACK32"; break;
724 21 : case VK_FORMAT_A8B8G8R8_UINT_PACK32: return "A8B8G8R8_UINT_PACK32"; break;
725 21 : case VK_FORMAT_A8B8G8R8_SINT_PACK32: return "A8B8G8R8_SINT_PACK32"; break;
726 21 : case VK_FORMAT_A8B8G8R8_SRGB_PACK32: return "A8B8G8R8_SRGB_PACK32"; break;
727 21 : case VK_FORMAT_A2R10G10B10_UNORM_PACK32: return "A2R10G10B10_UNORM_PACK32"; break;
728 21 : case VK_FORMAT_A2R10G10B10_SNORM_PACK32: return "A2R10G10B10_SNORM_PACK32"; break;
729 21 : case VK_FORMAT_A2R10G10B10_USCALED_PACK32: return "A2R10G10B10_USCALED_PACK32"; break;
730 21 : case VK_FORMAT_A2R10G10B10_SSCALED_PACK32: return "A2R10G10B10_SSCALED_PACK32"; break;
731 21 : case VK_FORMAT_A2R10G10B10_UINT_PACK32: return "A2R10G10B10_UINT_PACK32"; break;
732 21 : case VK_FORMAT_A2R10G10B10_SINT_PACK32: return "A2R10G10B10_SINT_PACK32"; break;
733 21 : case VK_FORMAT_A2B10G10R10_UNORM_PACK32: return "A2B10G10R10_UNORM_PACK32"; break;
734 21 : case VK_FORMAT_A2B10G10R10_SNORM_PACK32: return "A2B10G10R10_SNORM_PACK32"; break;
735 21 : case VK_FORMAT_A2B10G10R10_USCALED_PACK32: return "A2B10G10R10_USCALED_PACK32"; break;
736 21 : case VK_FORMAT_A2B10G10R10_SSCALED_PACK32: return "A2B10G10R10_SSCALED_PACK32"; break;
737 21 : case VK_FORMAT_A2B10G10R10_UINT_PACK32: return "A2B10G10R10_UINT_PACK32"; break;
738 21 : case VK_FORMAT_A2B10G10R10_SINT_PACK32: return "A2B10G10R10_SINT_PACK32"; break;
739 21 : case VK_FORMAT_R16_UNORM: return "R16_UNORM"; break;
740 21 : case VK_FORMAT_R16_SNORM: return "R16_SNORM"; break;
741 21 : case VK_FORMAT_R16_USCALED: return "R16_USCALED"; break;
742 21 : case VK_FORMAT_R16_SSCALED: return "R16_SSCALED"; break;
743 21 : case VK_FORMAT_R16_UINT: return "R16_UINT"; break;
744 21 : case VK_FORMAT_R16_SINT: return "R16_SINT"; break;
745 21 : case VK_FORMAT_R16_SFLOAT: return "R16_SFLOAT"; break;
746 21 : case VK_FORMAT_R16G16_UNORM: return "R16G16_UNORM"; break;
747 21 : case VK_FORMAT_R16G16_SNORM: return "R16G16_SNORM"; break;
748 21 : case VK_FORMAT_R16G16_USCALED: return "R16G16_USCALED"; break;
749 21 : case VK_FORMAT_R16G16_SSCALED: return "R16G16_SSCALED"; break;
750 21 : case VK_FORMAT_R16G16_UINT: return "R16G16_UINT"; break;
751 21 : case VK_FORMAT_R16G16_SINT: return "R16G16_SINT"; break;
752 21 : case VK_FORMAT_R16G16_SFLOAT: return "R16G16_SFLOAT"; break;
753 21 : case VK_FORMAT_R16G16B16_UNORM: return "R16G16B16_UNORM"; break;
754 21 : case VK_FORMAT_R16G16B16_SNORM: return "R16G16B16_SNORM"; break;
755 21 : case VK_FORMAT_R16G16B16_USCALED: return "R16G16B16_USCALED"; break;
756 21 : case VK_FORMAT_R16G16B16_SSCALED: return "R16G16B16_SSCALED"; break;
757 21 : case VK_FORMAT_R16G16B16_UINT: return "R16G16B16_UINT"; break;
758 21 : case VK_FORMAT_R16G16B16_SINT: return "R16G16B16_SINT"; break;
759 21 : case VK_FORMAT_R16G16B16_SFLOAT: return "R16G16B16_SFLOAT"; break;
760 21 : case VK_FORMAT_R16G16B16A16_UNORM: return "R16G16B16A16_UNORM"; break;
761 21 : case VK_FORMAT_R16G16B16A16_SNORM: return "R16G16B16A16_SNORM"; break;
762 21 : case VK_FORMAT_R16G16B16A16_USCALED: return "R16G16B16A16_USCALED"; break;
763 21 : case VK_FORMAT_R16G16B16A16_SSCALED: return "R16G16B16A16_SSCALED"; break;
764 21 : case VK_FORMAT_R16G16B16A16_UINT: return "R16G16B16A16_UINT"; break;
765 21 : case VK_FORMAT_R16G16B16A16_SINT: return "R16G16B16A16_SINT"; break;
766 21 : case VK_FORMAT_R16G16B16A16_SFLOAT: return "R16G16B16A16_SFLOAT"; break;
767 21 : case VK_FORMAT_R32_UINT: return "R32_UINT"; break;
768 21 : case VK_FORMAT_R32_SINT: return "R32_SINT"; break;
769 21 : case VK_FORMAT_R32_SFLOAT: return "R32_SFLOAT"; break;
770 21 : case VK_FORMAT_R32G32_UINT: return "R32G32_UINT"; break;
771 21 : case VK_FORMAT_R32G32_SINT: return "R32G32_SINT"; break;
772 21 : case VK_FORMAT_R32G32_SFLOAT: return "R32G32_SFLOAT"; break;
773 21 : case VK_FORMAT_R32G32B32_UINT: return "R32G32B32_UINT"; break;
774 21 : case VK_FORMAT_R32G32B32_SINT: return "R32G32B32_SINT"; break;
775 21 : case VK_FORMAT_R32G32B32_SFLOAT: return "R32G32B32_SFLOAT"; break;
776 21 : case VK_FORMAT_R32G32B32A32_UINT: return "R32G32B32A32_UINT"; break;
777 21 : case VK_FORMAT_R32G32B32A32_SINT: return "R32G32B32A32_SINT"; break;
778 21 : case VK_FORMAT_R32G32B32A32_SFLOAT: return "R32G32B32A32_SFLOAT"; break;
779 21 : case VK_FORMAT_R64_UINT: return "R64_UINT"; break;
780 21 : case VK_FORMAT_R64_SINT: return "R64_SINT"; break;
781 21 : case VK_FORMAT_R64_SFLOAT: return "R64_SFLOAT"; break;
782 21 : case VK_FORMAT_R64G64_UINT: return "R64G64_UINT"; break;
783 21 : case VK_FORMAT_R64G64_SINT: return "R64G64_SINT"; break;
784 21 : case VK_FORMAT_R64G64_SFLOAT: return "R64G64_SFLOAT"; break;
785 21 : case VK_FORMAT_R64G64B64_UINT: return "R64G64B64_UINT"; break;
786 21 : case VK_FORMAT_R64G64B64_SINT: return "R64G64B64_SINT"; break;
787 21 : case VK_FORMAT_R64G64B64_SFLOAT: return "R64G64B64_SFLOAT"; break;
788 21 : case VK_FORMAT_R64G64B64A64_UINT: return "R64G64B64A64_UINT"; break;
789 21 : case VK_FORMAT_R64G64B64A64_SINT: return "R64G64B64A64_SINT"; break;
790 21 : case VK_FORMAT_R64G64B64A64_SFLOAT: return "R64G64B64A64_SFLOAT"; break;
791 21 : case VK_FORMAT_B10G11R11_UFLOAT_PACK32: return "B10G11R11_UFLOAT_PACK32"; break;
792 21 : case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: return "E5B9G9R9_UFLOAT_PACK32"; break;
793 21 : case VK_FORMAT_D16_UNORM: return "D16_UNORM"; break;
794 21 : case VK_FORMAT_X8_D24_UNORM_PACK32: return "X8_D24_UNORM_PACK32"; break;
795 21 : case VK_FORMAT_D32_SFLOAT: return "D32_SFLOAT"; break;
796 21 : case VK_FORMAT_S8_UINT: return "S8_UINT"; break;
797 21 : case VK_FORMAT_D16_UNORM_S8_UINT: return "D16_UNORM_S8_UINT"; break;
798 21 : case VK_FORMAT_D24_UNORM_S8_UINT: return "D24_UNORM_S8_UINT"; break;
799 21 : case VK_FORMAT_D32_SFLOAT_S8_UINT: return "D32_SFLOAT_S8_UINT"; break;
800 21 : case VK_FORMAT_BC1_RGB_UNORM_BLOCK: return "BC1_RGB_UNORM_BLOCK"; break;
801 21 : case VK_FORMAT_BC1_RGB_SRGB_BLOCK: return "BC1_RGB_SRGB_BLOCK"; break;
802 21 : case VK_FORMAT_BC1_RGBA_UNORM_BLOCK: return "BC1_RGBA_UNORM_BLOCK"; break;
803 21 : case VK_FORMAT_BC1_RGBA_SRGB_BLOCK: return "BC1_RGBA_SRGB_BLOCK"; break;
804 21 : case VK_FORMAT_BC2_UNORM_BLOCK: return "BC2_UNORM_BLOCK"; break;
805 21 : case VK_FORMAT_BC2_SRGB_BLOCK: return "BC2_SRGB_BLOCK"; break;
806 21 : case VK_FORMAT_BC3_UNORM_BLOCK: return "BC3_UNORM_BLOCK"; break;
807 21 : case VK_FORMAT_BC3_SRGB_BLOCK: return "BC3_SRGB_BLOCK"; break;
808 21 : case VK_FORMAT_BC4_UNORM_BLOCK: return "BC4_UNORM_BLOCK"; break;
809 21 : case VK_FORMAT_BC4_SNORM_BLOCK: return "BC4_SNORM_BLOCK"; break;
810 21 : case VK_FORMAT_BC5_UNORM_BLOCK: return "BC5_UNORM_BLOCK"; break;
811 21 : case VK_FORMAT_BC5_SNORM_BLOCK: return "BC5_SNORM_BLOCK"; break;
812 21 : case VK_FORMAT_BC6H_UFLOAT_BLOCK: return "BC6H_UFLOAT_BLOCK"; break;
813 21 : case VK_FORMAT_BC6H_SFLOAT_BLOCK: return "BC6H_SFLOAT_BLOCK"; break;
814 21 : case VK_FORMAT_BC7_UNORM_BLOCK: return "BC7_UNORM_BLOCK"; break;
815 21 : case VK_FORMAT_BC7_SRGB_BLOCK: return "BC7_SRGB_BLOCK"; break;
816 21 : case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK: return "ETC2_R8G8B8_UNORM_BLOCK"; break;
817 21 : case VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK: return "ETC2_R8G8B8_SRGB_BLOCK"; break;
818 21 : case VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK: return "ETC2_R8G8B8A1_UNORM_BLOCK"; break;
819 21 : case VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK: return "ETC2_R8G8B8A1_SRGB_BLOCK"; break;
820 21 : case VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK: return "ETC2_R8G8B8A8_UNORM_BLOCK"; break;
821 21 : case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK: return "ETC2_R8G8B8A8_SRGB_BLOCK"; break;
822 21 : case VK_FORMAT_EAC_R11_UNORM_BLOCK: return "EAC_R11_UNORM_BLOCK"; break;
823 21 : case VK_FORMAT_EAC_R11_SNORM_BLOCK: return "EAC_R11_SNORM_BLOCK"; break;
824 21 : case VK_FORMAT_EAC_R11G11_UNORM_BLOCK: return "EAC_R11G11_UNORM_BLOCK"; break;
825 21 : case VK_FORMAT_EAC_R11G11_SNORM_BLOCK: return "EAC_R11G11_SNORM_BLOCK"; break;
826 21 : case VK_FORMAT_ASTC_4x4_UNORM_BLOCK: return "ASTC_4x4_UNORM_BLOCK"; break;
827 21 : case VK_FORMAT_ASTC_4x4_SRGB_BLOCK: return "ASTC_4x4_SRGB_BLOCK"; break;
828 21 : case VK_FORMAT_ASTC_5x4_UNORM_BLOCK: return "ASTC_5x4_UNORM_BLOCK"; break;
829 21 : case VK_FORMAT_ASTC_5x4_SRGB_BLOCK: return "ASTC_5x4_SRGB_BLOCK"; break;
830 21 : case VK_FORMAT_ASTC_5x5_UNORM_BLOCK: return "ASTC_5x5_UNORM_BLOCK"; break;
831 21 : case VK_FORMAT_ASTC_5x5_SRGB_BLOCK: return "ASTC_5x5_SRGB_BLOCK"; break;
832 21 : case VK_FORMAT_ASTC_6x5_UNORM_BLOCK: return "ASTC_6x5_UNORM_BLOCK"; break;
833 21 : case VK_FORMAT_ASTC_6x5_SRGB_BLOCK: return "ASTC_6x5_SRGB_BLOCK"; break;
834 21 : case VK_FORMAT_ASTC_6x6_UNORM_BLOCK: return "ASTC_6x6_UNORM_BLOCK"; break;
835 21 : case VK_FORMAT_ASTC_6x6_SRGB_BLOCK: return "ASTC_6x6_SRGB_BLOCK"; break;
836 21 : case VK_FORMAT_ASTC_8x5_UNORM_BLOCK: return "ASTC_8x5_UNORM_BLOCK"; break;
837 21 : case VK_FORMAT_ASTC_8x5_SRGB_BLOCK: return "ASTC_8x5_SRGB_BLOCK"; break;
838 21 : case VK_FORMAT_ASTC_8x6_UNORM_BLOCK: return "ASTC_8x6_UNORM_BLOCK"; break;
839 21 : case VK_FORMAT_ASTC_8x6_SRGB_BLOCK: return "ASTC_8x6_SRGB_BLOCK"; break;
840 21 : case VK_FORMAT_ASTC_8x8_UNORM_BLOCK: return "ASTC_8x8_UNORM_BLOCK"; break;
841 21 : case VK_FORMAT_ASTC_8x8_SRGB_BLOCK: return "ASTC_8x8_SRGB_BLOCK"; break;
842 21 : case VK_FORMAT_ASTC_10x5_UNORM_BLOCK: return "ASTC_10x5_UNORM_BLOCK"; break;
843 21 : case VK_FORMAT_ASTC_10x5_SRGB_BLOCK: return "ASTC_10x5_SRGB_BLOCK"; break;
844 21 : case VK_FORMAT_ASTC_10x6_UNORM_BLOCK: return "ASTC_10x6_UNORM_BLOCK"; break;
845 21 : case VK_FORMAT_ASTC_10x6_SRGB_BLOCK: return "ASTC_10x6_SRGB_BLOCK"; break;
846 21 : case VK_FORMAT_ASTC_10x8_UNORM_BLOCK: return "ASTC_10x8_UNORM_BLOCK"; break;
847 21 : case VK_FORMAT_ASTC_10x8_SRGB_BLOCK: return "ASTC_10x8_SRGB_BLOCK"; break;
848 21 : case VK_FORMAT_ASTC_10x10_UNORM_BLOCK: return "ASTC_10x10_UNORM_BLOCK"; break;
849 21 : case VK_FORMAT_ASTC_10x10_SRGB_BLOCK: return "ASTC_10x10_SRGB_BLOCK"; break;
850 21 : case VK_FORMAT_ASTC_12x10_UNORM_BLOCK: return "ASTC_12x10_UNORM_BLOCK"; break;
851 21 : case VK_FORMAT_ASTC_12x10_SRGB_BLOCK: return "ASTC_12x10_SRGB_BLOCK"; break;
852 21 : case VK_FORMAT_ASTC_12x12_UNORM_BLOCK: return "ASTC_12x12_UNORM_BLOCK"; break;
853 21 : case VK_FORMAT_ASTC_12x12_SRGB_BLOCK: return "ASTC_12x12_SRGB_BLOCK"; break;
854 21 : case VK_FORMAT_G8B8G8R8_422_UNORM: return "G8B8G8R8_422_UNORM"; break;
855 21 : case VK_FORMAT_B8G8R8G8_422_UNORM: return "B8G8R8G8_422_UNORM"; break;
856 21 : case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM: return "G8_B8_R8_3PLANE_420_UNORM"; break;
857 21 : case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM: return "G8_B8R8_2PLANE_420_UNORM"; break;
858 21 : case VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM: return "G8_B8_R8_3PLANE_422_UNORM"; break;
859 21 : case VK_FORMAT_G8_B8R8_2PLANE_422_UNORM: return "G8_B8R8_2PLANE_422_UNORM"; break;
860 21 : case VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM: return "G8_B8_R8_3PLANE_444_UNORM"; break;
861 21 : case VK_FORMAT_R10X6_UNORM_PACK16: return "R10X6_UNORM_PACK16"; break;
862 21 : case VK_FORMAT_R10X6G10X6_UNORM_2PACK16: return "R10X6G10X6_UNORM_2PACK16"; break;
863 21 : case VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16: return "R10X6G10X6B10X6A10X6_UNORM_4PACK16"; break;
864 21 : case VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16: return "G10X6B10X6G10X6R10X6_422_UNORM_4PACK16"; break;
865 21 : case VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16: return "B10X6G10X6R10X6G10X6_422_UNORM_4PACK16"; break;
866 21 : case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16: return "G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16"; break;
867 21 : case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16: return "G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16"; break;
868 21 : case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16: return "G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16"; break;
869 21 : case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16: return "G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16"; break;
870 21 : case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16: return "G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16"; break;
871 21 : case VK_FORMAT_R12X4_UNORM_PACK16: return "R12X4_UNORM_PACK16"; break;
872 21 : case VK_FORMAT_R12X4G12X4_UNORM_2PACK16: return "R12X4G12X4_UNORM_2PACK16"; break;
873 21 : case VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16: return "R12X4G12X4B12X4A12X4_UNORM_4PACK16"; break;
874 21 : case VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16: return "G12X4B12X4G12X4R12X4_422_UNORM_4PACK16"; break;
875 21 : case VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16: return "B12X4G12X4R12X4G12X4_422_UNORM_4PACK16"; break;
876 21 : case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16: return "G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16"; break;
877 21 : case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16: return "G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16"; break;
878 21 : case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16: return "G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16"; break;
879 21 : case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16: return "G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16"; break;
880 21 : case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16: return "G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16"; break;
881 21 : case VK_FORMAT_G16B16G16R16_422_UNORM: return "G16B16G16R16_422_UNORM"; break;
882 21 : case VK_FORMAT_B16G16R16G16_422_UNORM: return "B16G16R16G16_422_UNORM"; break;
883 21 : case VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM: return "G16_B16_R16_3PLANE_420_UNORM"; break;
884 21 : case VK_FORMAT_G16_B16R16_2PLANE_420_UNORM: return "G16_B16R16_2PLANE_420_UNORM"; break;
885 21 : case VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM: return "G16_B16_R16_3PLANE_422_UNORM"; break;
886 21 : case VK_FORMAT_G16_B16R16_2PLANE_422_UNORM: return "G16_B16R16_2PLANE_422_UNORM"; break;
887 21 : case VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM: return "G16_B16_R16_3PLANE_444_UNORM"; break;
888 0 : case VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG: return "PVRTC1_2BPP_UNORM_BLOCK_IMG"; break;
889 0 : case VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG: return "PVRTC1_4BPP_UNORM_BLOCK_IMG"; break;
890 0 : case VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG: return "PVRTC2_2BPP_UNORM_BLOCK_IMG"; break;
891 0 : case VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG: return "PVRTC2_4BPP_UNORM_BLOCK_IMG"; break;
892 0 : case VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG: return "PVRTC1_2BPP_SRGB_BLOCK_IMG"; break;
893 0 : case VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG: return "PVRTC1_4BPP_SRGB_BLOCK_IMG"; break;
894 0 : case VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG: return "PVRTC2_2BPP_SRGB_BLOCK_IMG"; break;
895 0 : case VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG: return "PVRTC2_4BPP_SRGB_BLOCK_IMG"; break;
896 0 : case VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT: return "ASTC_4x4_SFLOAT_BLOCK_EXT"; break;
897 0 : case VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT: return "ASTC_5x4_SFLOAT_BLOCK_EXT"; break;
898 0 : case VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT: return "ASTC_5x5_SFLOAT_BLOCK_EXT"; break;
899 0 : case VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT: return "ASTC_6x5_SFLOAT_BLOCK_EXT"; break;
900 0 : case VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT: return "ASTC_6x6_SFLOAT_BLOCK_EXT"; break;
901 0 : case VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT: return "ASTC_8x5_SFLOAT_BLOCK_EXT"; break;
902 0 : case VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT: return "ASTC_8x6_SFLOAT_BLOCK_EXT"; break;
903 0 : case VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT: return "ASTC_8x8_SFLOAT_BLOCK_EXT"; break;
904 0 : case VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT: return "ASTC_10x5_SFLOAT_BLOCK_EXT"; break;
905 0 : case VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT: return "ASTC_10x6_SFLOAT_BLOCK_EXT"; break;
906 0 : case VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT: return "ASTC_10x8_SFLOAT_BLOCK_EXT"; break;
907 0 : case VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT: return "ASTC_10x10_SFLOAT_BLOCK_EXT"; break;
908 0 : case VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT: return "ASTC_12x10_SFLOAT_BLOCK_EXT"; break;
909 0 : case VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT: return "ASTC_12x12_SFLOAT_BLOCK_EXT"; break;
910 6593328 : default: return "UNDEFINED"; break;
911 : }
912 : return "UNDEFINED";
913 : }
914 :
915 2289000 : StringView getVkColorSpaceName(VkColorSpaceKHR fmt) {
916 2289000 : switch (fmt) {
917 0 : case VK_COLOR_SPACE_SRGB_NONLINEAR_KHR: return "SRGB_NONLINEAR"; break;
918 21 : case VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT: return "DISPLAY_P3_NONLINEAR"; break;
919 21 : case VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT: return "EXTENDED_SRGB_LINEAR"; break;
920 21 : case VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT: return "DISPLAY_P3_LINEAR"; break;
921 21 : case VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT: return "DCI_P3_NONLINEAR"; break;
922 21 : case VK_COLOR_SPACE_BT709_LINEAR_EXT: return "BT709_LINEAR"; break;
923 21 : case VK_COLOR_SPACE_BT709_NONLINEAR_EXT: return "BT709_NONLINEAR"; break;
924 21 : case VK_COLOR_SPACE_BT2020_LINEAR_EXT: return "BT2020_LINEAR"; break;
925 21 : case VK_COLOR_SPACE_HDR10_ST2084_EXT: return "HDR10_ST2084"; break;
926 21 : case VK_COLOR_SPACE_DOLBYVISION_EXT: return "DOLBYVISION"; break;
927 21 : case VK_COLOR_SPACE_HDR10_HLG_EXT: return "HDR10_HLG"; break;
928 21 : case VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT: return "ADOBERGB_LINEAR"; break;
929 21 : case VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT: return "ADOBERGB_NONLINEAR"; break;
930 21 : case VK_COLOR_SPACE_PASS_THROUGH_EXT: return "PASS_THROUGH"; break;
931 21 : case VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT: return "EXTENDED_SRGB_NONLINEAR"; break;
932 21 : case VK_COLOR_SPACE_DISPLAY_NATIVE_AMD: return "DISPLAY_NATIVE"; break;
933 2288685 : default: return "UNKNOWN"; break;
934 : }
935 : return "UNKNOWN";
936 : }
937 :
938 3906315 : StringView getVkResultName(VkResult res) {
939 3906315 : switch (res) {
940 21 : case VK_SUCCESS: return "VK_SUCCESS"; break;
941 0 : case VK_NOT_READY: return "VK_NOT_READY"; break;
942 0 : case VK_TIMEOUT: return "VK_TIMEOUT"; break;
943 0 : case VK_EVENT_SET: return "VK_EVENT_SET"; break;
944 0 : case VK_EVENT_RESET: return "VK_EVENT_RESET"; break;
945 0 : case VK_INCOMPLETE: return "VK_INCOMPLETE"; break;
946 21 : case VK_ERROR_OUT_OF_HOST_MEMORY: return "VK_ERROR_OUT_OF_HOST_MEMORY"; break;
947 21 : case VK_ERROR_OUT_OF_DEVICE_MEMORY: return "VK_ERROR_OUT_OF_DEVICE_MEMORY"; break;
948 21 : case VK_ERROR_INITIALIZATION_FAILED: return "VK_ERROR_INITIALIZATION_FAILED"; break;
949 21 : case VK_ERROR_DEVICE_LOST: return "VK_ERROR_DEVICE_LOST"; break;
950 21 : case VK_ERROR_MEMORY_MAP_FAILED: return "VK_ERROR_MEMORY_MAP_FAILED"; break;
951 21 : case VK_ERROR_LAYER_NOT_PRESENT: return "VK_ERROR_LAYER_NOT_PRESENT"; break;
952 21 : case VK_ERROR_EXTENSION_NOT_PRESENT: return "VK_ERROR_EXTENSION_NOT_PRESENT"; break;
953 21 : case VK_ERROR_FEATURE_NOT_PRESENT: return "VK_ERROR_FEATURE_NOT_PRESENT"; break;
954 21 : case VK_ERROR_INCOMPATIBLE_DRIVER: return "VK_ERROR_INCOMPATIBLE_DRIVER"; break;
955 21 : case VK_ERROR_TOO_MANY_OBJECTS: return "VK_ERROR_TOO_MANY_OBJECTS"; break;
956 21 : case VK_ERROR_FORMAT_NOT_SUPPORTED: return "VK_ERROR_FORMAT_NOT_SUPPORTED"; break;
957 21 : case VK_ERROR_FRAGMENTED_POOL: return "VK_ERROR_FRAGMENTED_POOL"; break;
958 21 : case VK_ERROR_UNKNOWN: return "VK_ERROR_UNKNOWN"; break;
959 21 : case VK_ERROR_OUT_OF_POOL_MEMORY: return "VK_ERROR_OUT_OF_POOL_MEMORY"; break;
960 21 : case VK_ERROR_INVALID_EXTERNAL_HANDLE: return "VK_ERROR_INVALID_EXTERNAL_HANDLE"; break;
961 21 : case VK_ERROR_FRAGMENTATION: return "VK_ERROR_FRAGMENTATION"; break;
962 0 : case VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS: return "VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS"; break;
963 : #if VK_VERSION_1_3
964 0 : case VK_PIPELINE_COMPILE_REQUIRED: return "VK_PIPELINE_COMPILE_REQUIRED"; break;
965 : #endif
966 0 : case VK_ERROR_SURFACE_LOST_KHR: return "VK_ERROR_SURFACE_LOST_KHR"; break;
967 0 : case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR"; break;
968 0 : case VK_SUBOPTIMAL_KHR: return "VK_SUBOPTIMAL_KHR"; break;
969 0 : case VK_ERROR_OUT_OF_DATE_KHR: return "VK_ERROR_OUT_OF_DATE_KHR"; break;
970 0 : case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR"; break;
971 0 : case VK_ERROR_VALIDATION_FAILED_EXT: return "VK_ERROR_VALIDATION_FAILED_EXT"; break;
972 0 : case VK_ERROR_INVALID_SHADER_NV: return "VK_ERROR_INVALID_SHADER_NV"; break;
973 21 : case VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT: return "VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT"; break;
974 : #if VK_VERSION_1_3
975 21 : case VK_ERROR_NOT_PERMITTED_KHR: return "VK_ERROR_NOT_PERMITTED_KHR"; break;
976 : #endif
977 21 : case VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT: return "VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT"; break;
978 0 : case VK_THREAD_IDLE_KHR: return "VK_THREAD_IDLE_KHR"; break;
979 0 : case VK_THREAD_DONE_KHR: return "VK_THREAD_DONE_KHR"; break;
980 0 : case VK_OPERATION_DEFERRED_KHR: return "VK_OPERATION_DEFERRED_KHR"; break;
981 0 : case VK_OPERATION_NOT_DEFERRED_KHR: return "VK_OPERATION_NOT_DEFERRED_KHR"; break;
982 0 : case VK_RESULT_MAX_ENUM: return "VK_RESULT_MAX_ENUM"; break;
983 3905895 : default: break;
984 : }
985 3905895 : return "UNKNOWN";
986 : }
987 :
988 0 : String getVkMemoryPropertyFlags(VkMemoryPropertyFlags flags) {
989 0 : StringStream ret;
990 0 : if (flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) { ret << " DEVICE_LOCAL"; }
991 0 : if (flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { ret << " HOST_VISIBLE"; }
992 0 : if (flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) { ret << " HOST_COHERENT"; }
993 0 : if (flags & VK_MEMORY_PROPERTY_HOST_CACHED_BIT) { ret << " HOST_CACHED"; }
994 0 : if (flags & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT) { ret << " LAZILY_ALLOCATED"; }
995 0 : if (flags & VK_MEMORY_PROPERTY_PROTECTED_BIT) { ret << " PROTECTED"; }
996 0 : if (flags & VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD) { ret << " DEVICE_COHERENT_AMD"; }
997 0 : if (flags & VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD) { ret << " DEVICE_UNCACHED_AMD"; }
998 0 : return ret.str();
999 0 : }
1000 :
1001 1260 : static ExtensionFlags getFlagForExtension(const char *name) {
1002 1260 : if (strcmp(name, VK_KHR_MAINTENANCE3_EXTENSION_NAME) == 0) {
1003 126 : return ExtensionFlags::Maintenance3;
1004 1134 : } else if (strcmp(name, VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME) == 0) {
1005 126 : return ExtensionFlags::DescriptorIndexing;
1006 1008 : } else if (strcmp(name, VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME) == 0) {
1007 126 : return ExtensionFlags::DrawIndirectCount;
1008 882 : } else if (strcmp(name, VK_KHR_16BIT_STORAGE_EXTENSION_NAME) == 0) {
1009 126 : return ExtensionFlags::Storage16Bit;
1010 756 : } else if (strcmp(name, VK_KHR_8BIT_STORAGE_EXTENSION_NAME) == 0) {
1011 126 : return ExtensionFlags::Storage8Bit;
1012 630 : } else if (strcmp(name, VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME) == 0) {
1013 126 : return ExtensionFlags::DeviceAddress;
1014 504 : } else if (strcmp(name, VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME) == 0) {
1015 126 : return ExtensionFlags::ShaderInt8 | ExtensionFlags::ShaderFloat16;
1016 378 : } else if (strcmp(name, VK_EXT_MEMORY_BUDGET_EXTENSION_NAME) == 0) {
1017 126 : return ExtensionFlags::MemoryBudget;
1018 252 : } else if (strcmp(name, VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME) == 0) {
1019 126 : return ExtensionFlags::GetMemoryRequirements2;
1020 126 : } else if (strcmp(name, VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME) == 0) {
1021 126 : return ExtensionFlags::DedicatedAllocation;
1022 : #if __APPLE__
1023 : } else if (strcmp(name, VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME) == 0) {
1024 : return ExtensionFlags::Portability;
1025 : #endif
1026 : }
1027 0 : return ExtensionFlags::None;
1028 : }
1029 :
1030 1260 : bool checkIfExtensionAvailable(uint32_t apiVersion, const char *name, const Vector<VkExtensionProperties> &available,
1031 : Vector<StringView> &optionals, Vector<StringView> &promoted, ExtensionFlags &flags) {
1032 1260 : auto flag = getFlagForExtension(name);
1033 1260 : if (flag == ExtensionFlags::None) {
1034 0 : log::error("Vk", "Extension is not registered as optional: %s", name);
1035 0 : return false;
1036 : }
1037 :
1038 : #if VK_VERSION_1_3
1039 1260 : if (apiVersion >= VK_API_VERSION_1_3) {
1040 31500 : for (auto &it : s_promotedVk13Extensions) {
1041 30240 : if (it) {
1042 28980 : if (strcmp(name, it) == 0) {
1043 0 : flags |= flag;
1044 0 : promoted.emplace_back(StringView(name));
1045 0 : return true;
1046 : }
1047 : }
1048 : }
1049 : }
1050 : #endif
1051 1260 : if (apiVersion >= VK_API_VERSION_1_2) {
1052 21294 : for (auto &it : s_promotedVk12Extensions) {
1053 20664 : if (it) {
1054 20034 : if (strcmp(name, it) == 0) {
1055 630 : flags |= flag;
1056 630 : promoted.emplace_back(StringView(name));
1057 630 : return true;
1058 : }
1059 : }
1060 : }
1061 : }
1062 630 : if (apiVersion >= VK_API_VERSION_1_1) {
1063 7434 : for (auto &it : s_promotedVk11Extensions) {
1064 7308 : if (it) {
1065 7182 : if (strcmp(name, it) == 0) {
1066 504 : flags |= flag;
1067 504 : promoted.emplace_back(StringView(name));
1068 504 : return true;
1069 : }
1070 : }
1071 : }
1072 : }
1073 :
1074 12726 : for (auto &it : available) {
1075 12726 : if (strcmp(name, it.extensionName) == 0) {
1076 126 : flags |= flag;
1077 126 : optionals.emplace_back(StringView(name));
1078 126 : return true;
1079 : }
1080 : }
1081 0 : return false;
1082 : }
1083 :
1084 546 : bool isPromotedExtension(uint32_t apiVersion, StringView name) {
1085 546 : if (apiVersion >= VK_API_VERSION_1_2) {
1086 10374 : for (auto &it : s_promotedVk12Extensions) {
1087 10038 : if (it) {
1088 9702 : if (strcmp(name.data(), it) == 0) {
1089 210 : return true;
1090 : }
1091 : }
1092 : }
1093 : }
1094 336 : if (apiVersion >= VK_API_VERSION_1_1) {
1095 5124 : for (auto &it : s_promotedVk11Extensions) {
1096 5124 : if (it) {
1097 5124 : if (strcmp(name.data(), it) == 0) {
1098 336 : return true;
1099 : }
1100 : }
1101 : }
1102 : }
1103 0 : return false;
1104 : }
1105 :
1106 6597990 : size_t getFormatBlockSize(VkFormat format) {
1107 6597990 : switch (format) {
1108 21 : case VK_FORMAT_UNDEFINED: return 0; break;
1109 0 : case VK_FORMAT_MAX_ENUM: return 0; break;
1110 21 : case VK_FORMAT_R4G4_UNORM_PACK8: return 1; break;
1111 21 : case VK_FORMAT_R4G4B4A4_UNORM_PACK16: return 2; break;
1112 21 : case VK_FORMAT_B4G4R4A4_UNORM_PACK16: return 2; break;
1113 21 : case VK_FORMAT_R5G6B5_UNORM_PACK16: return 2; break;
1114 21 : case VK_FORMAT_B5G6R5_UNORM_PACK16: return 2; break;
1115 21 : case VK_FORMAT_R5G5B5A1_UNORM_PACK16: return 2; break;
1116 21 : case VK_FORMAT_B5G5R5A1_UNORM_PACK16: return 2; break;
1117 21 : case VK_FORMAT_A1R5G5B5_UNORM_PACK16: return 2; break;
1118 21 : case VK_FORMAT_R8_UNORM: return 1; break;
1119 21 : case VK_FORMAT_R8_SNORM: return 1; break;
1120 21 : case VK_FORMAT_R8_USCALED: return 1; break;
1121 21 : case VK_FORMAT_R8_SSCALED: return 1; break;
1122 21 : case VK_FORMAT_R8_UINT: return 1; break;
1123 21 : case VK_FORMAT_R8_SINT: return 1; break;
1124 21 : case VK_FORMAT_R8_SRGB: return 1; break;
1125 21 : case VK_FORMAT_R8G8_UNORM: return 2; break;
1126 21 : case VK_FORMAT_R8G8_SNORM: return 2; break;
1127 21 : case VK_FORMAT_R8G8_USCALED: return 2; break;
1128 21 : case VK_FORMAT_R8G8_SSCALED: return 2; break;
1129 21 : case VK_FORMAT_R8G8_UINT: return 2; break;
1130 21 : case VK_FORMAT_R8G8_SINT: return 2; break;
1131 21 : case VK_FORMAT_R8G8_SRGB: return 2; break;
1132 21 : case VK_FORMAT_R8G8B8_UNORM: return 3; break;
1133 21 : case VK_FORMAT_R8G8B8_SNORM: return 3; break;
1134 21 : case VK_FORMAT_R8G8B8_USCALED: return 3; break;
1135 21 : case VK_FORMAT_R8G8B8_SSCALED: return 3; break;
1136 21 : case VK_FORMAT_R8G8B8_UINT: return 3; break;
1137 21 : case VK_FORMAT_R8G8B8_SINT: return 3; break;
1138 21 : case VK_FORMAT_R8G8B8_SRGB: return 3; break;
1139 21 : case VK_FORMAT_B8G8R8_UNORM: return 3; break;
1140 21 : case VK_FORMAT_B8G8R8_SNORM: return 3; break;
1141 21 : case VK_FORMAT_B8G8R8_USCALED: return 3; break;
1142 21 : case VK_FORMAT_B8G8R8_SSCALED: return 3; break;
1143 21 : case VK_FORMAT_B8G8R8_UINT: return 3; break;
1144 21 : case VK_FORMAT_B8G8R8_SINT: return 3; break;
1145 21 : case VK_FORMAT_B8G8R8_SRGB: return 3; break;
1146 84 : case VK_FORMAT_R8G8B8A8_UNORM: return 4; break;
1147 21 : case VK_FORMAT_R8G8B8A8_SNORM: return 4; break;
1148 21 : case VK_FORMAT_R8G8B8A8_USCALED: return 4; break;
1149 21 : case VK_FORMAT_R8G8B8A8_SSCALED: return 4; break;
1150 21 : case VK_FORMAT_R8G8B8A8_UINT: return 4; break;
1151 21 : case VK_FORMAT_R8G8B8A8_SINT: return 4; break;
1152 21 : case VK_FORMAT_R8G8B8A8_SRGB: return 4; break;
1153 21 : case VK_FORMAT_B8G8R8A8_UNORM: return 4; break;
1154 21 : case VK_FORMAT_B8G8R8A8_SNORM: return 4; break;
1155 21 : case VK_FORMAT_B8G8R8A8_USCALED: return 4; break;
1156 21 : case VK_FORMAT_B8G8R8A8_SSCALED: return 4; break;
1157 21 : case VK_FORMAT_B8G8R8A8_UINT: return 4; break;
1158 21 : case VK_FORMAT_B8G8R8A8_SINT: return 4; break;
1159 21 : case VK_FORMAT_B8G8R8A8_SRGB: return 4; break;
1160 21 : case VK_FORMAT_A8B8G8R8_UNORM_PACK32: return 4; break;
1161 21 : case VK_FORMAT_A8B8G8R8_SNORM_PACK32: return 4; break;
1162 21 : case VK_FORMAT_A8B8G8R8_USCALED_PACK32: return 4; break;
1163 21 : case VK_FORMAT_A8B8G8R8_SSCALED_PACK32: return 4; break;
1164 21 : case VK_FORMAT_A8B8G8R8_UINT_PACK32: return 4; break;
1165 21 : case VK_FORMAT_A8B8G8R8_SINT_PACK32: return 4; break;
1166 21 : case VK_FORMAT_A8B8G8R8_SRGB_PACK32: return 4; break;
1167 21 : case VK_FORMAT_A2R10G10B10_UNORM_PACK32: return 4; break;
1168 21 : case VK_FORMAT_A2R10G10B10_SNORM_PACK32: return 4; break;
1169 21 : case VK_FORMAT_A2R10G10B10_USCALED_PACK32: return 4; break;
1170 21 : case VK_FORMAT_A2R10G10B10_SSCALED_PACK32: return 4; break;
1171 21 : case VK_FORMAT_A2R10G10B10_UINT_PACK32: return 4; break;
1172 21 : case VK_FORMAT_A2R10G10B10_SINT_PACK32: return 4; break;
1173 21 : case VK_FORMAT_A2B10G10R10_UNORM_PACK32: return 4; break;
1174 21 : case VK_FORMAT_A2B10G10R10_SNORM_PACK32: return 4; break;
1175 21 : case VK_FORMAT_A2B10G10R10_USCALED_PACK32: return 4; break;
1176 21 : case VK_FORMAT_A2B10G10R10_SSCALED_PACK32: return 4; break;
1177 21 : case VK_FORMAT_A2B10G10R10_UINT_PACK32: return 4; break;
1178 21 : case VK_FORMAT_A2B10G10R10_SINT_PACK32: return 4; break;
1179 21 : case VK_FORMAT_R16_UNORM: return 2; break;
1180 21 : case VK_FORMAT_R16_SNORM: return 2; break;
1181 21 : case VK_FORMAT_R16_USCALED: return 2; break;
1182 21 : case VK_FORMAT_R16_SSCALED: return 2; break;
1183 21 : case VK_FORMAT_R16_UINT: return 2; break;
1184 21 : case VK_FORMAT_R16_SINT: return 2; break;
1185 21 : case VK_FORMAT_R16_SFLOAT: return 2; break;
1186 21 : case VK_FORMAT_R16G16_UNORM: return 4; break;
1187 21 : case VK_FORMAT_R16G16_SNORM: return 4; break;
1188 21 : case VK_FORMAT_R16G16_USCALED: return 4; break;
1189 21 : case VK_FORMAT_R16G16_SSCALED: return 4; break;
1190 21 : case VK_FORMAT_R16G16_UINT: return 4; break;
1191 21 : case VK_FORMAT_R16G16_SINT: return 4; break;
1192 21 : case VK_FORMAT_R16G16_SFLOAT: return 4; break;
1193 21 : case VK_FORMAT_R16G16B16_UNORM: return 6; break;
1194 21 : case VK_FORMAT_R16G16B16_SNORM: return 6; break;
1195 21 : case VK_FORMAT_R16G16B16_USCALED: return 6; break;
1196 21 : case VK_FORMAT_R16G16B16_SSCALED: return 6; break;
1197 21 : case VK_FORMAT_R16G16B16_UINT: return 6; break;
1198 21 : case VK_FORMAT_R16G16B16_SINT: return 6; break;
1199 21 : case VK_FORMAT_R16G16B16_SFLOAT: return 6; break;
1200 21 : case VK_FORMAT_R16G16B16A16_UNORM: return 8; break;
1201 21 : case VK_FORMAT_R16G16B16A16_SNORM: return 8; break;
1202 21 : case VK_FORMAT_R16G16B16A16_USCALED: return 8; break;
1203 21 : case VK_FORMAT_R16G16B16A16_SSCALED: return 8; break;
1204 21 : case VK_FORMAT_R16G16B16A16_UINT: return 8; break;
1205 21 : case VK_FORMAT_R16G16B16A16_SINT: return 8; break;
1206 21 : case VK_FORMAT_R16G16B16A16_SFLOAT: return 8; break;
1207 21 : case VK_FORMAT_R32_UINT: return 4; break;
1208 21 : case VK_FORMAT_R32_SINT: return 4; break;
1209 21 : case VK_FORMAT_R32_SFLOAT: return 4; break;
1210 21 : case VK_FORMAT_R32G32_UINT: return 8; break;
1211 21 : case VK_FORMAT_R32G32_SINT: return 8; break;
1212 21 : case VK_FORMAT_R32G32_SFLOAT: return 8; break;
1213 21 : case VK_FORMAT_R32G32B32_UINT: return 12; break;
1214 21 : case VK_FORMAT_R32G32B32_SINT: return 12; break;
1215 21 : case VK_FORMAT_R32G32B32_SFLOAT: return 12; break;
1216 21 : case VK_FORMAT_R32G32B32A32_UINT: return 16; break;
1217 21 : case VK_FORMAT_R32G32B32A32_SINT: return 16; break;
1218 21 : case VK_FORMAT_R32G32B32A32_SFLOAT: return 16; break;
1219 21 : case VK_FORMAT_R64_UINT: return 8; break;
1220 21 : case VK_FORMAT_R64_SINT: return 8; break;
1221 21 : case VK_FORMAT_R64_SFLOAT: return 8; break;
1222 21 : case VK_FORMAT_R64G64_UINT: return 16; break;
1223 21 : case VK_FORMAT_R64G64_SINT: return 16; break;
1224 21 : case VK_FORMAT_R64G64_SFLOAT: return 16; break;
1225 21 : case VK_FORMAT_R64G64B64_UINT: return 24; break;
1226 21 : case VK_FORMAT_R64G64B64_SINT: return 24; break;
1227 21 : case VK_FORMAT_R64G64B64_SFLOAT: return 24; break;
1228 21 : case VK_FORMAT_R64G64B64A64_UINT: return 32; break;
1229 21 : case VK_FORMAT_R64G64B64A64_SINT: return 32; break;
1230 21 : case VK_FORMAT_R64G64B64A64_SFLOAT: return 32; break;
1231 21 : case VK_FORMAT_B10G11R11_UFLOAT_PACK32: return 4; break;
1232 21 : case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: return 4; break;
1233 21 : case VK_FORMAT_D16_UNORM: return 2; break;
1234 21 : case VK_FORMAT_X8_D24_UNORM_PACK32: return 4; break;
1235 21 : case VK_FORMAT_D32_SFLOAT: return 4; break;
1236 21 : case VK_FORMAT_S8_UINT: return 1; break;
1237 21 : case VK_FORMAT_D16_UNORM_S8_UINT: return 3; break;
1238 21 : case VK_FORMAT_D24_UNORM_S8_UINT: return 4; break;
1239 21 : case VK_FORMAT_D32_SFLOAT_S8_UINT: return 5; break;
1240 21 : case VK_FORMAT_BC1_RGB_UNORM_BLOCK: return 8; break;
1241 21 : case VK_FORMAT_BC1_RGB_SRGB_BLOCK: return 8; break;
1242 21 : case VK_FORMAT_BC1_RGBA_UNORM_BLOCK: return 8; break;
1243 21 : case VK_FORMAT_BC1_RGBA_SRGB_BLOCK: return 8; break;
1244 21 : case VK_FORMAT_BC2_UNORM_BLOCK: return 16; break;
1245 21 : case VK_FORMAT_BC2_SRGB_BLOCK: return 16; break;
1246 21 : case VK_FORMAT_BC3_UNORM_BLOCK: return 16; break;
1247 21 : case VK_FORMAT_BC3_SRGB_BLOCK: return 16; break;
1248 21 : case VK_FORMAT_BC4_UNORM_BLOCK: return 8; break;
1249 21 : case VK_FORMAT_BC4_SNORM_BLOCK: return 8; break;
1250 21 : case VK_FORMAT_BC5_UNORM_BLOCK: return 16; break;
1251 21 : case VK_FORMAT_BC5_SNORM_BLOCK: return 16; break;
1252 21 : case VK_FORMAT_BC6H_UFLOAT_BLOCK: return 16; break;
1253 21 : case VK_FORMAT_BC6H_SFLOAT_BLOCK: return 16; break;
1254 21 : case VK_FORMAT_BC7_UNORM_BLOCK: return 16; break;
1255 21 : case VK_FORMAT_BC7_SRGB_BLOCK: return 16; break;
1256 21 : case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK: return 8; break;
1257 21 : case VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK: return 8; break;
1258 21 : case VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK: return 8; break;
1259 21 : case VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK: return 8; break;
1260 21 : case VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK: return 8; break;
1261 21 : case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK: return 8; break;
1262 21 : case VK_FORMAT_EAC_R11_UNORM_BLOCK: return 8; break;
1263 21 : case VK_FORMAT_EAC_R11_SNORM_BLOCK: return 8; break;
1264 21 : case VK_FORMAT_EAC_R11G11_UNORM_BLOCK: return 16; break;
1265 21 : case VK_FORMAT_EAC_R11G11_SNORM_BLOCK: return 16; break;
1266 21 : case VK_FORMAT_ASTC_4x4_UNORM_BLOCK: return 16; break;
1267 21 : case VK_FORMAT_ASTC_4x4_SRGB_BLOCK: return 16; break;
1268 21 : case VK_FORMAT_ASTC_5x4_UNORM_BLOCK: return 16; break;
1269 21 : case VK_FORMAT_ASTC_5x4_SRGB_BLOCK: return 16; break;
1270 21 : case VK_FORMAT_ASTC_5x5_UNORM_BLOCK: return 16; break;
1271 21 : case VK_FORMAT_ASTC_5x5_SRGB_BLOCK: return 16; break;
1272 21 : case VK_FORMAT_ASTC_6x5_UNORM_BLOCK: return 16; break;
1273 21 : case VK_FORMAT_ASTC_6x5_SRGB_BLOCK: return 16; break;
1274 21 : case VK_FORMAT_ASTC_6x6_UNORM_BLOCK: return 16; break;
1275 21 : case VK_FORMAT_ASTC_6x6_SRGB_BLOCK: return 16; break;
1276 21 : case VK_FORMAT_ASTC_8x5_UNORM_BLOCK: return 16; break;
1277 21 : case VK_FORMAT_ASTC_8x5_SRGB_BLOCK: return 16; break;
1278 21 : case VK_FORMAT_ASTC_8x6_UNORM_BLOCK: return 16; break;
1279 21 : case VK_FORMAT_ASTC_8x6_SRGB_BLOCK: return 16; break;
1280 21 : case VK_FORMAT_ASTC_8x8_UNORM_BLOCK: return 16; break;
1281 21 : case VK_FORMAT_ASTC_8x8_SRGB_BLOCK: return 16; break;
1282 21 : case VK_FORMAT_ASTC_10x5_UNORM_BLOCK: return 16; break;
1283 21 : case VK_FORMAT_ASTC_10x5_SRGB_BLOCK: return 16; break;
1284 21 : case VK_FORMAT_ASTC_10x6_UNORM_BLOCK: return 16; break;
1285 21 : case VK_FORMAT_ASTC_10x6_SRGB_BLOCK: return 16; break;
1286 21 : case VK_FORMAT_ASTC_10x8_UNORM_BLOCK: return 16; break;
1287 21 : case VK_FORMAT_ASTC_10x8_SRGB_BLOCK: return 16; break;
1288 21 : case VK_FORMAT_ASTC_10x10_UNORM_BLOCK: return 16; break;
1289 21 : case VK_FORMAT_ASTC_10x10_SRGB_BLOCK: return 16; break;
1290 21 : case VK_FORMAT_ASTC_12x10_UNORM_BLOCK: return 16; break;
1291 21 : case VK_FORMAT_ASTC_12x10_SRGB_BLOCK: return 16; break;
1292 21 : case VK_FORMAT_ASTC_12x12_UNORM_BLOCK: return 16; break;
1293 21 : case VK_FORMAT_ASTC_12x12_SRGB_BLOCK: return 16; break;
1294 21 : case VK_FORMAT_G8B8G8R8_422_UNORM: return 4; break;
1295 21 : case VK_FORMAT_B8G8R8G8_422_UNORM: return 4; break;
1296 21 : case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM: return 3; break;
1297 21 : case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM: return 3; break;
1298 21 : case VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM: return 3; break;
1299 21 : case VK_FORMAT_G8_B8R8_2PLANE_422_UNORM: return 3; break;
1300 21 : case VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM: return 3; break;
1301 21 : case VK_FORMAT_R10X6_UNORM_PACK16: return 2; break;
1302 21 : case VK_FORMAT_R10X6G10X6_UNORM_2PACK16: return 4; break;
1303 21 : case VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16: return 8; break;
1304 21 : case VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16: return 8; break;
1305 21 : case VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16: return 8; break;
1306 21 : case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16: return 6; break;
1307 21 : case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16: return 6; break;
1308 21 : case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16: return 6; break;
1309 21 : case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16: return 4; break;
1310 21 : case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16: return 6; break;
1311 21 : case VK_FORMAT_R12X4_UNORM_PACK16: return 2; break;
1312 21 : case VK_FORMAT_R12X4G12X4_UNORM_2PACK16: return 4; break;
1313 21 : case VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16: return 8; break;
1314 21 : case VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16: return 8; break;
1315 21 : case VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16: return 8; break;
1316 21 : case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16: return 6; break;
1317 21 : case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16: return 6; break;
1318 21 : case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16: return 6; break;
1319 21 : case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16: return 6; break;
1320 21 : case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16: return 6; break;
1321 21 : case VK_FORMAT_G16B16G16R16_422_UNORM: return 8; break;
1322 21 : case VK_FORMAT_B16G16R16G16_422_UNORM: return 8; break;
1323 21 : case VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM: return 6; break;
1324 21 : case VK_FORMAT_G16_B16R16_2PLANE_420_UNORM: return 6; break;
1325 21 : case VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM: return 6; break;
1326 21 : case VK_FORMAT_G16_B16R16_2PLANE_422_UNORM: return 6; break;
1327 21 : case VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM: return 6; break;
1328 0 : case VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG: return 8; break;
1329 0 : case VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG: return 8; break;
1330 0 : case VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG: return 8; break;
1331 0 : case VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG: return 8; break;
1332 0 : case VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG: return 8; break;
1333 0 : case VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG: return 8; break;
1334 0 : case VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG: return 8; break;
1335 0 : case VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG: return 8; break;
1336 0 : case VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT: return 8; break;
1337 0 : case VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT: return 8; break;
1338 0 : case VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT: return 8; break;
1339 0 : case VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT: return 8; break;
1340 0 : case VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT: return 8; break;
1341 0 : case VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT: return 8; break;
1342 0 : case VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT: return 8; break;
1343 0 : case VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT: return 8; break;
1344 0 : case VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT: return 8; break;
1345 0 : case VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT: return 8; break;
1346 0 : case VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT: return 8; break;
1347 0 : case VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT: return 8; break;
1348 0 : case VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT: return 8; break;
1349 0 : case VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT: return 8; break;
1350 21 : case VK_FORMAT_G8_B8R8_2PLANE_444_UNORM_EXT: return 3; break;
1351 21 : case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16_EXT: return 6; break;
1352 21 : case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16_EXT: return 6; break;
1353 21 : case VK_FORMAT_G16_B16R16_2PLANE_444_UNORM_EXT: return 6; break;
1354 21 : case VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT: return 2; break;
1355 21 : case VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT: return 2; break;
1356 6593202 : default:
1357 6593202 : break;
1358 : }
1359 6593202 : return 0;
1360 : }
1361 :
1362 42 : VkPresentModeKHR getVkPresentMode(core::PresentMode presentMode) {
1363 42 : switch (presentMode) {
1364 0 : case core::PresentMode::Immediate: return VK_PRESENT_MODE_IMMEDIATE_KHR; break;
1365 0 : case core::PresentMode::FifoRelaxed: return VK_PRESENT_MODE_FIFO_RELAXED_KHR; break;
1366 42 : case core::PresentMode::Fifo: return VK_PRESENT_MODE_FIFO_KHR; break;
1367 0 : case core::PresentMode::Mailbox: return VK_PRESENT_MODE_MAILBOX_KHR; break;
1368 0 : default: break;
1369 : }
1370 0 : return VkPresentModeKHR(0);
1371 : }
1372 :
1373 0 : std::ostream &operator<< (std::ostream &stream, VkResult res) {
1374 0 : stream << STAPPLER_VERSIONIZED_NAMESPACE::xenolith::vk::getVkResultName(res);
1375 0 : return stream;
1376 : }
1377 :
1378 : }
|