simplification/taylorization and fix
[vulkan-misc.git] / nyanvk / types.h
blob0272a56ae7322024e3892d6ed69c0ec63f54000a
1 #ifndef NYANVK_TYPES_H
2 #define NYANVK_TYPES_H
3 /*
4 * this is public domain without any warranties of any kind
5 * Sylvain BERTRAND
6 */
7 /* XXX: KEEP AN EYE ON ABBREVIATIONS, ALWAYS */
8 /*----------------------------------------------------------------------------*/
9 #define vk_true 1
10 #define vk_false 0
11 #define vk_whole_sz 0xffffffffffffffff
12 #define vk_q_fam_ignored 0xffffffff
13 /*----------------------------------------------------------------------------*/
14 #define VK_VERSION_MAJOR(x) (x >> 22)
15 #define VK_VERSION_MINOR(x) ((x >> 12) & 0x3ff)
16 #define VK_VERSION_PATCH(x) (x & 0xfff)
17 /*----------------------------------------------------------------------------*/
18 struct vk_offset_2d_t {
19 u32 x;
20 u32 y;
22 struct vk_offset_3d_t {
23 u32 x;
24 u32 y;
25 u32 z;
27 struct vk_extent_2d_t {
28 u32 width;
29 u32 height;
31 struct vk_extent_3d_t {
32 u32 width;
33 u32 height;
34 u32 depth;
36 struct vk_rect_2d_t {
37 struct vk_offset_2d_t offset;
38 struct vk_extent_2d_t extent;
40 struct vk_instance_create_info_t {
41 u32 type;
42 void *next;
43 u32 flags;
44 void *app_info; /* allow easy hidden driver optimizations: no! */
45 u32 enabled_layers_n;
46 u8 **enabled_layer_names;
47 u32 enabled_exts_n;
48 u8 **enabled_ext_names;
50 #define VK_MAX_EXT_NAME_SZ 256
51 struct vk_ext_props_t {
52 u8 name[VK_MAX_EXT_NAME_SZ];
53 u32 spec_version;
55 #define VK_MAX_DESC_SZ 256
56 struct vk_layer_props_t {
57 u8 name[VK_MAX_EXT_NAME_SZ];
58 u32 spec_version;
59 u32 implementation_version;
60 u8 desc[VK_MAX_DESC_SZ];
62 struct vk_phydev_limits_t {
63 u32 not_used_00[11];
64 u64 not_used_01[2];
65 u32 not_used_02[51];
66 float not_used_03[2];
67 u32 not_used_04[3];
68 float not_used_05[2];
69 u32 not_used_06;
70 size_t not_used_07;
71 u64 not_used_08[3];
72 u32 not_used_09[4];
73 float not_used_10[2];
74 u32 not_used_11[16];
75 float not_used_12;
76 u32 not_used_13[4];
77 float not_used_14[6];
78 u32 not_used_15[2];
79 u64 not_used_16[3];
81 struct vk_phydev_sparse_props_t {
82 u32 not_used[5];
84 #define VK_MAX_PHYDEV_NAME_SZ 256
85 #define VK_UUID_SZ 16
86 struct vk_phydev_props_core_t {
87 u32 api_version;
88 u32 driver_version;
89 u32 vendor_id;
90 u32 dev_id;
91 u32 dev_type;
92 u8 name[VK_MAX_PHYDEV_NAME_SZ];
93 u8 pl_cache_uuid[VK_UUID_SZ];
94 struct vk_phydev_limits_t limits;
95 struct vk_phydev_sparse_props_t sparse_props;
97 /* the vulkan 1.1 version */
98 struct vk_phydev_props_t {
99 u32 type;
100 void *next;
101 struct vk_phydev_props_core_t core;
103 struct vk_q_fam_props_core_t {
104 u32 flags;
105 u32 qs_n;
106 u32 timestamp_valid_bits;
107 struct vk_extent_3d_t min_img_transfer_granularity;
109 struct vk_q_fam_props_t {
110 u32 type;
111 void *next;
112 struct vk_q_fam_props_core_t core;
114 struct vk_phydev_features_t {
115 u32 not_used[55];
117 struct vk_dev_q_create_info_t {
118 u32 type;
119 void *next;
120 u32 flags;
121 u32 q_fam;
122 u32 qs_n;
123 float *q_prios;
125 struct vk_dev_create_info_t {
126 u32 type;
127 void *next;
128 u32 flags;
129 u32 q_create_infos_n;
130 struct vk_dev_q_create_info_t *q_create_infos;
131 u32 do_not_use_0;
132 void *do_not_use_1;
133 u32 enabled_exts_n;
134 u8 **enabled_ext_names;
135 void *do_not_use_2;
137 struct vk_cp_create_info_t {
138 u32 type;
139 void *next;
140 u32 flags;
141 u32 q_fam;
143 struct vk_xcb_surf_create_info_t {
144 u32 type;
145 void *next;
146 u32 flags;
147 xcb_connection_t *c;
148 xcb_window_t win;
150 struct vk_phydev_surf_info_t {
151 u32 type;
152 void *next;
153 void *surf;
155 struct vk_surf_texel_mem_blk_conf_core_t {
156 u32 fmt;
157 u32 color_space;
159 struct vk_surf_texel_mem_blk_conf_t {
160 u32 type;
161 void *next;
162 struct vk_surf_texel_mem_blk_conf_core_t core;
164 struct vk_mem_type_t {
165 u32 prop_flags;
166 u32 heap;
168 struct vk_mem_heap_t {
169 u64 sz;
170 u32 flags;
172 #define VK_MEM_TYPES_N_MAX 32
173 #define VK_MEM_HEAPS_N_MAX 16
174 struct vk_phydev_mem_props_core_t {
175 u32 mem_types_n;
176 struct vk_mem_type_t mem_types[VK_MEM_TYPES_N_MAX];
177 u32 mem_heaps_n;
178 struct vk_mem_heap_t mem_heaps[VK_MEM_HEAPS_N_MAX];
180 struct vk_phydev_mem_props_t {
181 u32 type;
182 void *next;
183 struct vk_phydev_mem_props_core_t core;
185 struct vk_surf_caps_core_t {
186 u32 imgs_n_min;
187 u32 imgs_n_max;
188 struct vk_extent_2d_t current_extent;
189 struct vk_extent_2d_t img_extent_min;
190 struct vk_extent_2d_t img_extent_max;
191 u32 img_array_layers_n_max;
192 u32 supported_transforms;
193 u32 current_transform;
194 u32 supported_composite_alpha;
195 u32 supported_img_usage_flags;
197 struct vk_surf_caps_t {
198 u32 type;
199 void *next;
200 struct vk_surf_caps_core_t core;
202 struct vk_swpchn_create_info_t {
203 u32 type;
204 void *next;
205 u32 flags;
206 void *surf;
207 u32 imgs_n_min;
208 u32 img_texel_mem_blk_fmt;
209 u32 img_color_space;
210 struct vk_extent_2d_t img_extent;
211 u32 img_layers_n;
212 u32 img_usage;
213 u32 img_sharing_mode;
214 u32 q_fams_n;
215 u32 *q_fams;
216 u32 pre_transform;
217 u32 composite_alpha;
218 u32 present_mode;
219 u32 clipped;
220 void *old_swpchn;
222 struct vk_img_create_info_t {
223 u32 type;
224 void *next;
225 u32 flags;
226 u32 img_type;
227 u32 texel_mem_blk_fmt;
228 struct vk_extent_3d_t extent;
229 u32 mip_lvls_n;
230 u32 array_layers_n;
231 u32 samples_n; /* flags */
232 u32 img_tiling;
233 u32 usage;
234 u32 sharing_mode;
235 u32 q_fams_n;
236 u32 *q_fams;
237 u32 initial_layout;
239 struct vk_img_mem_rqmts_info_t {
240 u32 type;
241 void *next;
242 void *img;
244 struct vk_mem_rqmts_core_t {
245 u64 sz;
246 u64 alignment;
247 /* idxs of bits are idxs in mem types of vk_phydev_mem_props_core_t */
248 u32 mem_type_bits;
250 struct vk_mem_rqmts_t {
251 u32 type;
252 void *next;
253 struct vk_mem_rqmts_core_t core;
255 struct vk_mem_alloc_info_t {
256 u32 type;
257 void *next;
258 u64 sz;
259 u32 mem_type_idx; /* in the physical device array of memory types */
261 struct vk_bind_img_mem_info_t {
262 u32 type;
263 void *next;
264 void *img;
265 void *mem;
266 u64 offset;
268 struct vk_img_subrsrc_range_t {
269 u32 aspect;
270 u32 base_mip_lvl;
271 u32 lvls_n;
272 u32 base_array_layer;
273 u32 array_layers_n;
275 struct vk_img_mem_barrier_t {
276 u32 type;
277 void *next;
278 u32 src_access;
279 u32 dst_access;
280 u32 old_layout;
281 u32 new_layout;
282 u32 src_q_fam;
283 u32 dst_q_fam;
284 void *img;
285 struct vk_img_subrsrc_range_t subrsrc_range;
287 struct vk_cb_alloc_info_t {
288 u32 type;
289 void *next;
290 void *cp;
291 u32 lvl;
292 u32 cbs_n;
294 struct vk_cb_begin_info_t {
295 u32 type;
296 void *next;
297 u32 flags;
298 void *do_not_use;
300 struct vk_submit_info_t {
301 u32 type;
302 void *next;
303 u32 wait_sems_n;
304 void **wait_sems;
305 u32* wait_dst_stages;
306 u32 cbs_n;
307 void **cbs;
308 u32 signal_sems_n;
309 void **signal_sems;
311 struct vk_img_subrsrc_t {
312 u32 aspect;
313 u32 mip_lvl;
314 u32 array_layer;
316 struct vk_subrsrc_layout_t {
317 u64 offset;
318 u64 sz;
319 u64 row_pitch;
320 u64 array_pitch;
321 u64 depth_pitch;
323 struct vk_img_subrsrc_layers_t {
324 u32 aspect;
325 u32 mip_lvl;
326 u32 base_array_layer;
327 u32 array_layers_n;
329 struct vk_acquire_next_img_info_t {
330 u32 type;
331 void *next;
332 void *swpchn;
333 u64 timeout;
334 void *sem;
335 void *fence;
336 u32 devs;
338 struct vk_img_blit_t {
339 struct vk_img_subrsrc_layers_t src_subrsrc;
340 struct vk_offset_3d_t src_offsets[2];
341 struct vk_img_subrsrc_layers_t dst_subrsrc;
342 struct vk_offset_3d_t dst_offsets[2];
344 struct vk_present_info_t {
345 u32 type;
346 void *next;
347 u32 wait_sems_n;
348 void **wait_sems;
349 u32 swpchns_n;
350 void **swpchns;
351 u32 *idxs;
352 s32 *results;
354 struct vk_sem_create_info_t {
355 u32 type;
356 void *next;
357 u32 flags;
359 struct vk_comp_map_t {
360 s32 r;
361 s32 g;
362 s32 b;
363 s32 a;
365 struct vk_imgview_create_info_t {
366 u32 type;
367 void *next;
368 u32 flags;
369 void *img;
370 s32 view_type;
371 s32 fmt;
372 struct vk_comp_map_t comps;
373 struct vk_img_subrsrc_range_t subrsrc_range;
375 struct vk_at_desc_t {
376 u32 flags;
377 u32 fmt;
378 u32 samples_n;
379 u32 load_op;
380 u32 store_op;
381 u32 stencil_load_op;
382 u32 stencil_store_op;
383 u32 initial_layout;
384 u32 final_layout;
386 struct vk_at_ref_t {
387 u32 at;
388 u32 layout;
390 struct vk_sp_desc_t {
391 u32 flags;
392 u32 pl_bind_point;
393 u32 input_ats_n;
394 struct vk_at_ref_t *input_ats;
395 u32 color_ats_n;
396 struct vk_at_ref_t *color_ats;
397 struct vk_at_ref_t *resolve_ats;
398 struct vk_at_ref_t *depth_stencil_ats;
399 u32 preserve_ats_n;
400 u32 *preserve_ats;
402 struct vk_sp_dep_t {
403 u32 src_sp;
404 u32 dst_sp;
405 u32 src_stage_mask;
406 u32 dst_stage_mask;
407 u32 src_access_mask;
408 u32 dst_access_mask;
409 u32 dep;
411 struct vk_rp_create_info_t {
412 u32 type;
413 void *next;
414 u32 flags;
415 u32 ats_n;
416 struct vk_at_desc_t *ats;
417 u32 sps_n;
418 struct vk_sp_desc_t *sps;
419 u32 deps_n;
420 struct vk_sp_dep_t *deps;
422 struct vk_fb_create_info_t {
423 u32 type;
424 void *next;
425 u32 flags;
426 void *rp;
427 u32 ats_n;
428 void *ats; /* imgviews!!! */
429 u32 width;
430 u32 height;
431 u32 layers_n;
433 struct vk_shmod_create_info_t {
434 u32 type;
435 void *next;
436 u32 flags;
437 size_t code_sz; /* bytes_n */
438 u32 *code;
440 struct vk_pl_sh_stage_create_info_t {
441 u32 type;
442 void *next;
443 u32 flags;
444 u32 stage;
445 void *shmod;
446 u8 *name;
447 void *specialization_info; /* later */
449 struct vk_pl_vtx_input_state_create_info_t {
450 u32 type;
451 void *next;
452 u32 flags;
453 u32 not_used_0;
454 void *not_used_1;
455 u32 not_used_2;
456 void *not_used_3;
459 struct vk_pl_input_assembly_state_create_info_t {
460 u32 type;
461 void *next;
462 u32 flags;
463 u32 topology;
464 u32 prim_restart_ena;
466 /* XXX: this does define a _transformation_ ! */
467 struct vk_viewport_t {
468 f32 x;
469 f32 y;
470 f32 width;
471 f32 height;
472 f32 depth_min;
473 f32 depth_max;
475 struct vk_pl_viewport_state_create_info_t {
476 u32 type;
477 void *next;
478 u32 flags;
479 u32 viewports_n;
480 struct vk_viewport_t *viewports;
481 u32 scissors_n;
482 struct vk_rect_2d_t *scissors;
484 struct vk_pl_raster_state_create_info_t {
485 u32 type;
486 void *next;
487 u32 flags;
488 u32 depth_clamp_ena;
489 u32 raster_discard_ena;
490 u32 polygon_mode;
491 u32 cull_mode;
492 u32 front_face;
493 u32 depth_bias_ena;
494 f32 depth_bias_constant_factor;
495 f32 depth_bias_clamp;
496 f32 depth_bias_slope_factor;
497 f32 line_width;
499 struct vk_pl_multisample_state_create_info_t {
500 u32 type;
501 void *next;
502 u32 flags;
503 u32 raster_samples_n;
504 u32 sample_shading_ena;
505 f32 sample_shading_min;
506 u32 sample_mask;
507 u32 alpha_to_coverage_ena;
508 u32 alpha_to_one_ena;
510 struct vk_pl_color_blend_at_state_t {
511 u32 blend_ena;
513 u32 src_color_blend_factor;
514 u32 dst_color_blend_factor;
515 /* normalized integer */
516 u32 color_blend_op;
518 u32 src_alpha_blend_factor;
519 u32 dst_alpha_blend_factor;
520 u32 alpha_blend_op;
522 /* normalized integer */
523 u32 color_write_mask;
525 struct vk_pl_color_blend_state_create_info_t {
526 u32 type;
527 void *next;
528 u32 flags;
529 u32 logic_op_ena;
530 /* floats */
531 u32 logic_op;
532 u32 ats_n;
533 struct vk_pl_color_blend_at_state_t *ats;
534 f32 blend_consts[4];
536 struct vk_pushconst_range_t {
537 u32 shader_stages;
538 u32 offset;
539 u32 size;
541 struct vk_pl_layout_create_info_t {
542 u32 type;
543 void *next;
544 u32 flags;
545 u32 layouts_n;
546 void **layouts;
547 u32 pushconst_ranges_n;
548 struct vk_pushconst_range_t *ranges;
550 struct vk_gfx_pl_create_info_t {
551 u32 type;
552 void *next;
553 u32 flags;
554 u32 sh_stages_n;
555 struct vk_pl_sh_stage_create_info_t *sh_stages;
556 struct vk_pl_vtx_input_state_create_info_t *vtx_input_state;
557 struct vk_pl_input_assembly_state_create_info_t *input_assembly_state;
558 void *dont_use_0;
559 struct vk_pl_viewport_state_create_info_t *viewport_state;
560 struct vk_pl_raster_state_create_info_t *raster_state;
561 struct vk_pl_multisample_state_create_info_t *multisample_state;
562 void *not_used_0;
563 struct vk_pl_color_blend_state_create_info_t *color_blend_state;
564 void *not_used_1;
565 void *layout;
566 void *rp;
567 u32 sp;
568 void *base_pl;
569 u32 base_pl_idx;
571 union vk_clr_color_val_t {
572 f32 f32s[4];
573 u32 u32s[4];
574 s32 s32s[4];
576 struct vk_clr_depth_stencil_val_t {
577 f32 depth;
578 u32 stencil;
580 union vk_clr_val_t {
581 union vk_clr_color_val_t color;
582 struct vk_clr_depth_stencil_val_t depth_stencil;
584 struct vk_rp_begin_info_t {
585 u32 type;
586 void *next;
587 void *rp;
588 void *fb;
589 struct vk_rect_2d_t render_area;
590 u32 clr_vals_n;
591 union vk_clr_val_t *clr_vals;
593 #endif