blob: cfba8c58d963d087d27ccdfa8eb0def8e5f052b6 [file] [log] [blame]
Yiwei Zhangf9a57e62018-04-05 00:17:22 -07001///////////////////////////////////////////////////////////////////////////////
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
Yiwei Zhangf9a57e62018-04-05 00:17:22 -070024#include <string.h>
Nikita Gupta3c2535d2025-03-10 10:00:27 -070025#include <vulkan/vulkan.h>
Yiwei Zhangf9a57e62018-04-05 00:17:22 -070026
27#include <map>
28#include <string>
29#include <vector>
30
31#ifdef WIN32
32#undef min
33#undef max
34#endif
35
Nikita Gupta6616c482025-03-14 18:53:52 +000036/*
37 * This file is autogenerated by vkjson_generator.py. Do not edit directly.
38 */
Yiwei Zhangf9a57e62018-04-05 00:17:22 -070039struct VkJsonLayer {
40 VkLayerProperties properties;
41 std::vector<VkExtensionProperties> extensions;
42};
43
Nikita Gupta3c2535d2025-03-10 10:00:27 -070044struct VkJsonKHRVariablePointers {
45 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
57struct VkJsonKHRShaderFloat16Int8 {
58 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
70struct VkJsonExtImage2dViewOf3d {
71 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
80struct VkJsonExtCustomBorderColor {
81 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
90struct VkJsonExtPrimitiveTopologyListRestart {
91 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
101struct VkJsonExtProvokingVertex {
102 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
111struct VkJsonKHRIndexTypeUint8 {
112 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
121struct VkJsonExtIndexTypeUint8 {
122 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
131struct VkJsonKHRVertexAttributeDivisor {
132 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
142struct VkJsonExtVertexAttributeDivisor {
143 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
153struct VkJsonExtTransformFeedback {
154 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
163struct VkJsonKHRShaderSubgroupUniformControlFlow {
164 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
174struct VkJsonKHRShaderSubgroupExtendedTypes {
175 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
185struct VkJsonKHR8bitStorage {
186 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
195struct VkJsonKHRShaderIntegerDotProduct {
196 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
206struct VkJsonIMGRelaxedLineRasterization {
207 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
217struct VkJsonKHRLineRasterization {
218 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
227struct VkJsonExtLineRasterization {
228 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
237struct VkJsonExtPrimitivesGeneratedQuery {
238 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
248struct VkJsonKHRShaderFloatControls {
249 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
258struct VkJsonKHRDriverProperties {
259 VkJsonKHRDriverProperties() {
Yiwei Zhang7b4169d2018-10-02 18:58:31 -0700260 reported = false;
261 memset(&driver_properties_khr, 0,
262 sizeof(VkPhysicalDeviceDriverPropertiesKHR));
263 }
264 bool reported;
265 VkPhysicalDeviceDriverPropertiesKHR driver_properties_khr;
266};
267
Nikita Gupta3c2535d2025-03-10 10:00:27 -0700268struct VkJsonCore11 {
Nikita Gupta6616c482025-03-14 18:53:52 +0000269 VkJsonCore11() {
270 memset(&properties, 0, sizeof(VkPhysicalDeviceVulkan11Properties));
271 memset(&features, 0, sizeof(VkPhysicalDeviceVulkan11Features));
272 }
Nikita Gupta3c2535d2025-03-10 10:00:27 -0700273 VkPhysicalDeviceVulkan11Properties properties;
274 VkPhysicalDeviceVulkan11Features features;
Peiyong Linc1b5ffb2020-02-27 19:31:51 -0800275};
276
Trevor David Blackd35f0f62021-09-07 23:39:36 +0000277struct VkJsonCore12 {
Nikita Gupta6616c482025-03-14 18:53:52 +0000278 VkJsonCore12() {
279 memset(&properties, 0, sizeof(VkPhysicalDeviceVulkan12Properties));
280 memset(&features, 0, sizeof(VkPhysicalDeviceVulkan12Features));
281 }
Trevor David Blackd35f0f62021-09-07 23:39:36 +0000282 VkPhysicalDeviceVulkan12Properties properties;
283 VkPhysicalDeviceVulkan12Features features;
284};
285
Trevor David Black79883792021-11-04 23:46:31 +0000286struct VkJsonCore13 {
Nikita Gupta6616c482025-03-14 18:53:52 +0000287 VkJsonCore13() {
288 memset(&properties, 0, sizeof(VkPhysicalDeviceVulkan13Properties));
289 memset(&features, 0, sizeof(VkPhysicalDeviceVulkan13Features));
290 }
Trevor David Black79883792021-11-04 23:46:31 +0000291 VkPhysicalDeviceVulkan13Properties properties;
292 VkPhysicalDeviceVulkan13Features features;
293};
294
Tom Murphy80d9ca72024-10-17 09:52:47 +0000295struct VkJsonCore14 {
Nikita Gupta6616c482025-03-14 18:53:52 +0000296 VkJsonCore14() {
297 memset(&properties, 0, sizeof(VkPhysicalDeviceVulkan14Properties));
298 memset(&features, 0, sizeof(VkPhysicalDeviceVulkan14Features));
299 }
Tom Murphy80d9ca72024-10-17 09:52:47 +0000300 VkPhysicalDeviceVulkan14Properties properties;
301 VkPhysicalDeviceVulkan14Features features;
Nikita Gupta6616c482025-03-14 18:53:52 +0000302 std::vector<VkImageLayout> copy_src_layouts;
303 std::vector<VkImageLayout> copy_dst_layouts;
Tom Murphy80d9ca72024-10-17 09:52:47 +0000304};
305
Yiwei Zhangf9a57e62018-04-05 00:17:22 -0700306struct VkJsonDevice {
307 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));
Nikita Gupta3c2535d2025-03-10 10:00:27 -0700322 memset(&variable_pointers_features, 0,
323 sizeof(VkPhysicalDeviceVariablePointersFeatures));
Yiwei Zhangf9a57e62018-04-05 00:17:22 -0700324 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 }
Nikita Gupta3c2535d2025-03-10 10:00:27 -0700331 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;
Yiwei Zhangf9a57e62018-04-05 00:17:22 -0700357 VkPhysicalDeviceProperties properties;
358 VkPhysicalDeviceFeatures features;
Yiwei Zhangf9a57e62018-04-05 00:17:22 -0700359 VkPhysicalDeviceMemoryProperties memory;
Yiwei Zhangf9a57e62018-04-05 00:17:22 -0700360 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;
Nikita Gupta3c2535d2025-03-10 10:00:27 -0700367 VkPhysicalDeviceVariablePointersFeatures variable_pointers_features;
Yiwei Zhangf9a57e62018-04-05 00:17:22 -0700368 VkPhysicalDeviceProtectedMemoryFeatures protected_memory_features;
369 VkPhysicalDeviceSamplerYcbcrConversionFeatures
370 sampler_ycbcr_conversion_features;
371 VkPhysicalDeviceShaderDrawParameterFeatures shader_draw_parameter_features;
Nikita Gupta3c2535d2025-03-10 10:00:27 -0700372 std::vector<VkQueueFamilyProperties> queues;
373 std::vector<VkExtensionProperties> extensions;
374 std::vector<VkLayerProperties> layers;
375 std::map<VkFormat, VkFormatProperties> formats;
Yiwei Zhangf9a57e62018-04-05 00:17:22 -0700376 std::map<VkExternalFenceHandleTypeFlagBits, VkExternalFenceProperties>
377 external_fence_properties;
378 std::map<VkExternalSemaphoreHandleTypeFlagBits, VkExternalSemaphoreProperties>
379 external_semaphore_properties;
380};
381
382struct VkJsonDeviceGroup {
383 VkJsonDeviceGroup() {
384 memset(&properties, 0, sizeof(VkPhysicalDeviceGroupProperties));
385 }
386 VkPhysicalDeviceGroupProperties properties;
387 std::vector<uint32_t> device_inds;
388};
389
390struct VkJsonInstance {
391 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
399VkJsonInstance VkJsonGetInstance();
400std::string VkJsonInstanceToJson(const VkJsonInstance& instance);
401bool VkJsonInstanceFromJson(const std::string& json,
402 VkJsonInstance* instance,
403 std::string* errors);
404
Yiwei Zhang91fc3dc2020-07-05 23:33:22 -0700405VkJsonDevice VkJsonGetDevice(VkPhysicalDevice device);
Yiwei Zhangf9a57e62018-04-05 00:17:22 -0700406std::string VkJsonDeviceToJson(const VkJsonDevice& device);
407bool VkJsonDeviceFromJson(const std::string& json,
408 VkJsonDevice* device,
409 std::string* errors);
410
411std::string VkJsonImageFormatPropertiesToJson(
412 const VkImageFormatProperties& properties);
413bool VkJsonImageFormatPropertiesFromJson(const std::string& json,
414 VkImageFormatProperties* properties,
415 std::string* errors);
416
417// Backward-compatibility aliases
418typedef VkJsonDevice VkJsonAllProperties;
419inline VkJsonAllProperties VkJsonGetAllProperties(
420 VkPhysicalDevice physicalDevice) {
Yiwei Zhang91fc3dc2020-07-05 23:33:22 -0700421 return VkJsonGetDevice(physicalDevice);
Yiwei Zhangf9a57e62018-04-05 00:17:22 -0700422}
423inline std::string VkJsonAllPropertiesToJson(
424 const VkJsonAllProperties& properties) {
425 return VkJsonDeviceToJson(properties);
426}
427inline bool VkJsonAllPropertiesFromJson(const std::string& json,
428 VkJsonAllProperties* properties,
429 std::string* errors) {
430 return VkJsonDeviceFromJson(json, properties, errors);
431}
432
Nikita Gupta3c2535d2025-03-10 10:00:27 -0700433#endif // VKJSON_H_