1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2015-2016 The Khronos Group Inc.
4 // Copyright (c) 2015-2016 Valve Corporation
5 // Copyright (c) 2015-2016 LunarG, Inc.
6 // Copyright (c) 2015-2016 Google, Inc.
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 //
12 // http://www.apache.org/licenses/LICENSE-2.0
13 //
14 // Unless required by applicable law or agreed to in writing, software
15 // distributed under the License is distributed on an "AS IS" BASIS,
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 // See the License for the specific language governing permissions and
18 // limitations under the License.
19 ///////////////////////////////////////////////////////////////////////////////
20
21 #ifndef VKJSON_H_
22 #define VKJSON_H_
23
24 #include <string.h>
25 #include <vulkan/vulkan.h>
26
27 #include <map>
28 #include <string>
29 #include <vector>
30
31 #ifdef WIN32
32 #undef min
33 #undef max
34 #endif
35
36 /*
37 * This file is autogenerated by vkjson_generator.py. Do not edit directly.
38 */
39 struct VkJsonLayer {
40 VkLayerProperties properties;
41 std::vector<VkExtensionProperties> extensions;
42 };
43
44 struct VkJsonKHRVariablePointers {
VkJsonKHRVariablePointersVkJsonKHRVariablePointers45 VkJsonKHRVariablePointers() {
46 reported = false;
47 memset(&variable_pointer_features_khr, 0,
48 sizeof(VkPhysicalDeviceVariablePointerFeaturesKHR));
49 memset(&variable_pointers_features_khr, 0,
50 sizeof(VkPhysicalDeviceVariablePointersFeaturesKHR));
51 }
52 bool reported;
53 VkPhysicalDeviceVariablePointerFeaturesKHR variable_pointer_features_khr;
54 VkPhysicalDeviceVariablePointersFeaturesKHR variable_pointers_features_khr;
55 };
56
57 struct VkJsonKHRShaderFloat16Int8 {
VkJsonKHRShaderFloat16Int8VkJsonKHRShaderFloat16Int858 VkJsonKHRShaderFloat16Int8() {
59 reported = false;
60 memset(&shader_float16_int8_features_khr, 0,
61 sizeof(VkPhysicalDeviceShaderFloat16Int8FeaturesKHR));
62 memset(&float16_int8_features_khr, 0,
63 sizeof(VkPhysicalDeviceFloat16Int8FeaturesKHR));
64 }
65 bool reported;
66 VkPhysicalDeviceShaderFloat16Int8FeaturesKHR shader_float16_int8_features_khr;
67 VkPhysicalDeviceFloat16Int8FeaturesKHR float16_int8_features_khr;
68 };
69
70 struct VkJsonExtImage2dViewOf3d {
VkJsonExtImage2dViewOf3dVkJsonExtImage2dViewOf3d71 VkJsonExtImage2dViewOf3d() {
72 reported = false;
73 memset(&image_2d_view_of_3d_features_ext, 0,
74 sizeof(VkPhysicalDeviceImage2DViewOf3DFeaturesEXT));
75 }
76 bool reported;
77 VkPhysicalDeviceImage2DViewOf3DFeaturesEXT image_2d_view_of_3d_features_ext;
78 };
79
80 struct VkJsonExtCustomBorderColor {
VkJsonExtCustomBorderColorVkJsonExtCustomBorderColor81 VkJsonExtCustomBorderColor() {
82 reported = false;
83 memset(&custom_border_color_features_ext, 0,
84 sizeof(VkPhysicalDeviceCustomBorderColorFeaturesEXT));
85 }
86 bool reported;
87 VkPhysicalDeviceCustomBorderColorFeaturesEXT custom_border_color_features_ext;
88 };
89
90 struct VkJsonExtPrimitiveTopologyListRestart {
VkJsonExtPrimitiveTopologyListRestartVkJsonExtPrimitiveTopologyListRestart91 VkJsonExtPrimitiveTopologyListRestart() {
92 reported = false;
93 memset(&primitive_topology_list_restart_features_ext, 0,
94 sizeof(VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT));
95 }
96 bool reported;
97 VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT
98 primitive_topology_list_restart_features_ext;
99 };
100
101 struct VkJsonExtProvokingVertex {
VkJsonExtProvokingVertexVkJsonExtProvokingVertex102 VkJsonExtProvokingVertex() {
103 reported = false;
104 memset(&provoking_vertex_features_ext, 0,
105 sizeof(VkPhysicalDeviceProvokingVertexFeaturesEXT));
106 }
107 bool reported;
108 VkPhysicalDeviceProvokingVertexFeaturesEXT provoking_vertex_features_ext;
109 };
110
111 struct VkJsonKHRIndexTypeUint8 {
VkJsonKHRIndexTypeUint8VkJsonKHRIndexTypeUint8112 VkJsonKHRIndexTypeUint8() {
113 reported = false;
114 memset(&index_type_uint8_features_khr, 0,
115 sizeof(VkPhysicalDeviceIndexTypeUint8FeaturesKHR));
116 }
117 bool reported;
118 VkPhysicalDeviceIndexTypeUint8FeaturesKHR index_type_uint8_features_khr;
119 };
120
121 struct VkJsonExtIndexTypeUint8 {
VkJsonExtIndexTypeUint8VkJsonExtIndexTypeUint8122 VkJsonExtIndexTypeUint8() {
123 reported = false;
124 memset(&index_type_uint8_features_ext, 0,
125 sizeof(VkPhysicalDeviceIndexTypeUint8FeaturesEXT));
126 }
127 bool reported;
128 VkPhysicalDeviceIndexTypeUint8FeaturesEXT index_type_uint8_features_ext;
129 };
130
131 struct VkJsonKHRVertexAttributeDivisor {
VkJsonKHRVertexAttributeDivisorVkJsonKHRVertexAttributeDivisor132 VkJsonKHRVertexAttributeDivisor() {
133 reported = false;
134 memset(&vertex_attribute_divisor_features_khr, 0,
135 sizeof(VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR));
136 }
137 bool reported;
138 VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR
139 vertex_attribute_divisor_features_khr;
140 };
141
142 struct VkJsonExtVertexAttributeDivisor {
VkJsonExtVertexAttributeDivisorVkJsonExtVertexAttributeDivisor143 VkJsonExtVertexAttributeDivisor() {
144 reported = false;
145 memset(&vertex_attribute_divisor_features_ext, 0,
146 sizeof(VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT));
147 }
148 bool reported;
149 VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT
150 vertex_attribute_divisor_features_ext;
151 };
152
153 struct VkJsonExtTransformFeedback {
VkJsonExtTransformFeedbackVkJsonExtTransformFeedback154 VkJsonExtTransformFeedback() {
155 reported = false;
156 memset(&transform_feedback_features_ext, 0,
157 sizeof(VkPhysicalDeviceTransformFeedbackFeaturesEXT));
158 }
159 bool reported;
160 VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback_features_ext;
161 };
162
163 struct VkJsonKHRShaderSubgroupUniformControlFlow {
VkJsonKHRShaderSubgroupUniformControlFlowVkJsonKHRShaderSubgroupUniformControlFlow164 VkJsonKHRShaderSubgroupUniformControlFlow() {
165 reported = false;
166 memset(&shader_subgroup_uniform_control_flow_features_khr, 0,
167 sizeof(VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR));
168 }
169 bool reported;
170 VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR
171 shader_subgroup_uniform_control_flow_features_khr;
172 };
173
174 struct VkJsonKHRShaderSubgroupExtendedTypes {
VkJsonKHRShaderSubgroupExtendedTypesVkJsonKHRShaderSubgroupExtendedTypes175 VkJsonKHRShaderSubgroupExtendedTypes() {
176 reported = false;
177 memset(&shader_subgroup_extended_types_features_khr, 0,
178 sizeof(VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR));
179 }
180 bool reported;
181 VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR
182 shader_subgroup_extended_types_features_khr;
183 };
184
185 struct VkJsonKHR8bitStorage {
VkJsonKHR8bitStorageVkJsonKHR8bitStorage186 VkJsonKHR8bitStorage() {
187 reported = false;
188 memset(&bit8_storage_features_khr, 0,
189 sizeof(VkPhysicalDevice8BitStorageFeaturesKHR));
190 }
191 bool reported;
192 VkPhysicalDevice8BitStorageFeaturesKHR bit8_storage_features_khr;
193 };
194
195 struct VkJsonKHRShaderIntegerDotProduct {
VkJsonKHRShaderIntegerDotProductVkJsonKHRShaderIntegerDotProduct196 VkJsonKHRShaderIntegerDotProduct() {
197 reported = false;
198 memset(&shader_integer_dot_product_features_khr, 0,
199 sizeof(VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR));
200 }
201 bool reported;
202 VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR
203 shader_integer_dot_product_features_khr;
204 };
205
206 struct VkJsonIMGRelaxedLineRasterization {
VkJsonIMGRelaxedLineRasterizationVkJsonIMGRelaxedLineRasterization207 VkJsonIMGRelaxedLineRasterization() {
208 reported = false;
209 memset(&relaxed_line_rasterization_features_img, 0,
210 sizeof(VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG));
211 }
212 bool reported;
213 VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG
214 relaxed_line_rasterization_features_img;
215 };
216
217 struct VkJsonKHRLineRasterization {
VkJsonKHRLineRasterizationVkJsonKHRLineRasterization218 VkJsonKHRLineRasterization() {
219 reported = false;
220 memset(&line_rasterization_features_khr, 0,
221 sizeof(VkPhysicalDeviceLineRasterizationFeaturesKHR));
222 }
223 bool reported;
224 VkPhysicalDeviceLineRasterizationFeaturesKHR line_rasterization_features_khr;
225 };
226
227 struct VkJsonExtLineRasterization {
VkJsonExtLineRasterizationVkJsonExtLineRasterization228 VkJsonExtLineRasterization() {
229 reported = false;
230 memset(&line_rasterization_features_ext, 0,
231 sizeof(VkPhysicalDeviceLineRasterizationFeaturesEXT));
232 }
233 bool reported;
234 VkPhysicalDeviceLineRasterizationFeaturesEXT line_rasterization_features_ext;
235 };
236
237 struct VkJsonExtPrimitivesGeneratedQuery {
VkJsonExtPrimitivesGeneratedQueryVkJsonExtPrimitivesGeneratedQuery238 VkJsonExtPrimitivesGeneratedQuery() {
239 reported = false;
240 memset(&primitives_generated_query_features_ext, 0,
241 sizeof(VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT));
242 }
243 bool reported;
244 VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT
245 primitives_generated_query_features_ext;
246 };
247
248 struct VkJsonKHRShaderFloatControls {
VkJsonKHRShaderFloatControlsVkJsonKHRShaderFloatControls249 VkJsonKHRShaderFloatControls() {
250 reported = false;
251 memset(&float_controls_properties_khr, 0,
252 sizeof(VkPhysicalDeviceFloatControlsPropertiesKHR));
253 }
254 bool reported;
255 VkPhysicalDeviceFloatControlsPropertiesKHR float_controls_properties_khr;
256 };
257
258 struct VkJsonKHRDriverProperties {
VkJsonKHRDriverPropertiesVkJsonKHRDriverProperties259 VkJsonKHRDriverProperties() {
260 reported = false;
261 memset(&driver_properties_khr, 0,
262 sizeof(VkPhysicalDeviceDriverPropertiesKHR));
263 }
264 bool reported;
265 VkPhysicalDeviceDriverPropertiesKHR driver_properties_khr;
266 };
267
268 struct VkJsonCore11 {
VkJsonCore11VkJsonCore11269 VkJsonCore11() {
270 memset(&properties, 0, sizeof(VkPhysicalDeviceVulkan11Properties));
271 memset(&features, 0, sizeof(VkPhysicalDeviceVulkan11Features));
272 }
273 VkPhysicalDeviceVulkan11Properties properties;
274 VkPhysicalDeviceVulkan11Features features;
275 };
276
277 struct VkJsonCore12 {
VkJsonCore12VkJsonCore12278 VkJsonCore12() {
279 memset(&properties, 0, sizeof(VkPhysicalDeviceVulkan12Properties));
280 memset(&features, 0, sizeof(VkPhysicalDeviceVulkan12Features));
281 }
282 VkPhysicalDeviceVulkan12Properties properties;
283 VkPhysicalDeviceVulkan12Features features;
284 };
285
286 struct VkJsonCore13 {
VkJsonCore13VkJsonCore13287 VkJsonCore13() {
288 memset(&properties, 0, sizeof(VkPhysicalDeviceVulkan13Properties));
289 memset(&features, 0, sizeof(VkPhysicalDeviceVulkan13Features));
290 }
291 VkPhysicalDeviceVulkan13Properties properties;
292 VkPhysicalDeviceVulkan13Features features;
293 };
294
295 struct VkJsonCore14 {
VkJsonCore14VkJsonCore14296 VkJsonCore14() {
297 memset(&properties, 0, sizeof(VkPhysicalDeviceVulkan14Properties));
298 memset(&features, 0, sizeof(VkPhysicalDeviceVulkan14Features));
299 }
300 VkPhysicalDeviceVulkan14Properties properties;
301 VkPhysicalDeviceVulkan14Features features;
302 std::vector<VkImageLayout> copy_src_layouts;
303 std::vector<VkImageLayout> copy_dst_layouts;
304 };
305
306 struct VkJsonDevice {
VkJsonDeviceVkJsonDevice307 VkJsonDevice() {
308 memset(&properties, 0, sizeof(VkPhysicalDeviceProperties));
309 memset(&features, 0, sizeof(VkPhysicalDeviceFeatures));
310 memset(&memory, 0, sizeof(VkPhysicalDeviceMemoryProperties));
311 memset(&subgroup_properties, 0, sizeof(VkPhysicalDeviceSubgroupProperties));
312 memset(&point_clipping_properties, 0,
313 sizeof(VkPhysicalDevicePointClippingProperties));
314 memset(&multiview_properties, 0,
315 sizeof(VkPhysicalDeviceMultiviewProperties));
316 memset(&id_properties, 0, sizeof(VkPhysicalDeviceIDProperties));
317 memset(&maintenance3_properties, 0,
318 sizeof(VkPhysicalDeviceMaintenance3Properties));
319 memset(&bit16_storage_features, 0,
320 sizeof(VkPhysicalDevice16BitStorageFeatures));
321 memset(&multiview_features, 0, sizeof(VkPhysicalDeviceMultiviewFeatures));
322 memset(&variable_pointers_features, 0,
323 sizeof(VkPhysicalDeviceVariablePointersFeatures));
324 memset(&protected_memory_features, 0,
325 sizeof(VkPhysicalDeviceProtectedMemoryFeatures));
326 memset(&sampler_ycbcr_conversion_features, 0,
327 sizeof(VkPhysicalDeviceSamplerYcbcrConversionFeatures));
328 memset(&shader_draw_parameter_features, 0,
329 sizeof(VkPhysicalDeviceShaderDrawParameterFeatures));
330 }
331 VkJsonKHRVariablePointers khr_variable_pointers;
332 VkJsonKHRShaderFloat16Int8 khr_shader_float16_int8;
333 VkJsonExtImage2dViewOf3d ext_image_2d_view_of_3d;
334 VkJsonExtCustomBorderColor ext_custom_border_color;
335 VkJsonExtPrimitiveTopologyListRestart ext_primitive_topology_list_restart;
336 VkJsonExtProvokingVertex ext_provoking_vertex;
337 VkJsonKHRIndexTypeUint8 khr_index_type_uint8;
338 VkJsonExtIndexTypeUint8 ext_index_type_uint8;
339 VkJsonKHRVertexAttributeDivisor khr_vertex_attribute_divisor;
340 VkJsonExtVertexAttributeDivisor ext_vertex_attribute_divisor;
341 VkJsonExtTransformFeedback ext_transform_feedback;
342 VkJsonKHRShaderSubgroupUniformControlFlow
343 khr_shader_subgroup_uniform_control_flow;
344 VkJsonKHRShaderSubgroupExtendedTypes khr_shader_subgroup_extended_types;
345 VkJsonKHR8bitStorage khr_8bit_storage;
346 VkJsonKHRShaderIntegerDotProduct khr_shader_integer_dot_product;
347 VkJsonIMGRelaxedLineRasterization img_relaxed_line_rasterization;
348 VkJsonKHRLineRasterization khr_line_rasterization;
349 VkJsonExtLineRasterization ext_line_rasterization;
350 VkJsonExtPrimitivesGeneratedQuery ext_primitives_generated_query;
351 VkJsonKHRShaderFloatControls khr_shader_float_controls;
352 VkJsonKHRDriverProperties khr_driver_properties;
353 VkJsonCore11 core11;
354 VkJsonCore12 core12;
355 VkJsonCore13 core13;
356 VkJsonCore14 core14;
357 VkPhysicalDeviceProperties properties;
358 VkPhysicalDeviceFeatures features;
359 VkPhysicalDeviceMemoryProperties memory;
360 VkPhysicalDeviceSubgroupProperties subgroup_properties;
361 VkPhysicalDevicePointClippingProperties point_clipping_properties;
362 VkPhysicalDeviceMultiviewProperties multiview_properties;
363 VkPhysicalDeviceIDProperties id_properties;
364 VkPhysicalDeviceMaintenance3Properties maintenance3_properties;
365 VkPhysicalDevice16BitStorageFeatures bit16_storage_features;
366 VkPhysicalDeviceMultiviewFeatures multiview_features;
367 VkPhysicalDeviceVariablePointersFeatures variable_pointers_features;
368 VkPhysicalDeviceProtectedMemoryFeatures protected_memory_features;
369 VkPhysicalDeviceSamplerYcbcrConversionFeatures
370 sampler_ycbcr_conversion_features;
371 VkPhysicalDeviceShaderDrawParameterFeatures shader_draw_parameter_features;
372 std::vector<VkQueueFamilyProperties> queues;
373 std::vector<VkExtensionProperties> extensions;
374 std::vector<VkLayerProperties> layers;
375 std::map<VkFormat, VkFormatProperties> formats;
376 std::map<VkExternalFenceHandleTypeFlagBits, VkExternalFenceProperties>
377 external_fence_properties;
378 std::map<VkExternalSemaphoreHandleTypeFlagBits, VkExternalSemaphoreProperties>
379 external_semaphore_properties;
380 };
381
382 struct VkJsonDeviceGroup {
VkJsonDeviceGroupVkJsonDeviceGroup383 VkJsonDeviceGroup() {
384 memset(&properties, 0, sizeof(VkPhysicalDeviceGroupProperties));
385 }
386 VkPhysicalDeviceGroupProperties properties;
387 std::vector<uint32_t> device_inds;
388 };
389
390 struct VkJsonInstance {
VkJsonInstanceVkJsonInstance391 VkJsonInstance() : api_version(0) {}
392 uint32_t api_version;
393 std::vector<VkJsonLayer> layers;
394 std::vector<VkExtensionProperties> extensions;
395 std::vector<VkJsonDevice> devices;
396 std::vector<VkJsonDeviceGroup> device_groups;
397 };
398
399 VkJsonInstance VkJsonGetInstance();
400 std::string VkJsonInstanceToJson(const VkJsonInstance& instance);
401 bool VkJsonInstanceFromJson(const std::string& json,
402 VkJsonInstance* instance,
403 std::string* errors);
404
405 VkJsonDevice VkJsonGetDevice(VkPhysicalDevice device);
406 std::string VkJsonDeviceToJson(const VkJsonDevice& device);
407 bool VkJsonDeviceFromJson(const std::string& json,
408 VkJsonDevice* device,
409 std::string* errors);
410
411 std::string VkJsonImageFormatPropertiesToJson(
412 const VkImageFormatProperties& properties);
413 bool VkJsonImageFormatPropertiesFromJson(const std::string& json,
414 VkImageFormatProperties* properties,
415 std::string* errors);
416
417 // Backward-compatibility aliases
418 typedef VkJsonDevice VkJsonAllProperties;
VkJsonGetAllProperties(VkPhysicalDevice physicalDevice)419 inline VkJsonAllProperties VkJsonGetAllProperties(
420 VkPhysicalDevice physicalDevice) {
421 return VkJsonGetDevice(physicalDevice);
422 }
VkJsonAllPropertiesToJson(const VkJsonAllProperties & properties)423 inline std::string VkJsonAllPropertiesToJson(
424 const VkJsonAllProperties& properties) {
425 return VkJsonDeviceToJson(properties);
426 }
VkJsonAllPropertiesFromJson(const std::string & json,VkJsonAllProperties * properties,std::string * errors)427 inline bool VkJsonAllPropertiesFromJson(const std::string& json,
428 VkJsonAllProperties* properties,
429 std::string* errors) {
430 return VkJsonDeviceFromJson(json, properties, errors);
431 }
432
433 #endif // VKJSON_H_