npv: correct coarse sync of vulkan image acquisition
[nyanmp.git] / npv / nyanvk / types.h
blobb264ce3da26a4f4e170dbcf147ff578e08b4a7cb
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 /* opaque or not defined */
19 struct vk_dev_t;
20 struct vk_cp_t;
21 struct vk_img_t;
22 struct vk_dev_mem_t;
23 struct vk_swpchn_t;
24 struct vk_cb_t;
25 struct vk_buf_barrier_t;
26 struct vk_mem_barrier_t;
27 struct vk_q_t;
28 struct vk_fence_t;
29 struct vk_sem_t;
30 struct vk_imgview_t;
31 struct vk_rp_t;
32 struct vk_fb_t;
33 struct vk_shmod_t;
34 struct vk_pl_layout_t;
35 struct vk_pl_cache_t;
36 struct vk_pl_t;
37 struct vk_surf_t;
38 struct vk_specialization_info_t;
39 struct vk_dset_layout_t;
40 struct vk_instance_t;
41 struct vk_phydev_t;
42 /*----------------------------------------------------------------------------*/
43 struct vk_offset_2d_t {
44 s32 x;
45 s32 y;
47 struct vk_offset_3d_t {
48 s32 x;
49 s32 y;
50 s32 z;
52 struct vk_extent_2d_t {
53 u32 width;
54 u32 height;
56 struct vk_extent_3d_t {
57 u32 width;
58 u32 height;
59 u32 depth;
61 struct vk_rect_2d_t {
62 struct vk_offset_2d_t offset;
63 struct vk_extent_2d_t extent;
65 struct vk_instance_create_info_t {
66 u32 type;
67 void *next;
68 u32 flags;
69 void *app_info; /* allow easy hidden driver optimizations: no! */
70 u32 enabled_layers_n;
71 u8 **enabled_layer_names;
72 u32 enabled_exts_n;
73 u8 **enabled_ext_names;
75 #define VK_MAX_EXT_NAME_SZ 256
76 struct vk_ext_props_t {
77 u8 name[VK_MAX_EXT_NAME_SZ];
78 u32 spec_version;
80 #define VK_MAX_DESC_SZ 256
81 struct vk_layer_props_t {
82 u8 name[VK_MAX_EXT_NAME_SZ];
83 u32 spec_version;
84 u32 implementation_version;
85 u8 desc[VK_MAX_DESC_SZ];
87 struct vk_phydev_limits_t {
88 u32 not_used_00[11];
89 u64 not_used_01[2];
90 u32 not_used_02[51];
91 float not_used_03[2];
92 u32 not_used_04[3];
93 float not_used_05[2];
94 u32 not_used_06;
95 size_t not_used_07;
96 u64 not_used_08[3];
97 u32 not_used_09[4];
98 float not_used_10[2];
99 u32 not_used_11[16];
100 float not_used_12;
101 u32 not_used_13[4];
102 float not_used_14[6];
103 u32 not_used_15[2];
104 u64 not_used_16[3];
106 struct vk_phydev_sparse_props_t {
107 u32 not_used[5];
109 #define VK_MAX_PHYDEV_NAME_SZ 256
110 #define VK_UUID_SZ 16
111 struct vk_phydev_props_core_t {
112 u32 api_version;
113 u32 driver_version;
114 u32 vendor_id;
115 u32 dev_id;
116 u32 dev_type;
117 u8 name[VK_MAX_PHYDEV_NAME_SZ];
118 u8 pl_cache_uuid[VK_UUID_SZ];
119 struct vk_phydev_limits_t limits;
120 struct vk_phydev_sparse_props_t sparse_props;
122 /* the vulkan 1.1 version */
123 struct vk_phydev_props_t {
124 u32 type;
125 void *next;
126 struct vk_phydev_props_core_t core;
128 struct vk_q_fam_props_core_t {
129 u32 flags;
130 u32 qs_n;
131 u32 timestamp_valid_bits;
132 struct vk_extent_3d_t min_img_transfer_granularity;
134 struct vk_q_fam_props_t {
135 u32 type;
136 void *next;
137 struct vk_q_fam_props_core_t core;
139 struct vk_phydev_features_t {
140 u32 not_used[55];
142 struct vk_dev_q_create_info_t {
143 u32 type;
144 void *next;
145 u32 flags;
146 u32 q_fam;
147 u32 qs_n;
148 float *q_prios;
150 struct vk_dev_create_info_t {
151 u32 type;
152 void *next;
153 u32 flags;
154 u32 q_create_infos_n;
155 struct vk_dev_q_create_info_t *q_create_infos;
156 u32 do_not_use_0;
157 void *do_not_use_1;
158 u32 enabled_exts_n;
159 u8 **enabled_ext_names;
160 void *do_not_use_2;
162 struct vk_cp_create_info_t {
163 u32 type;
164 void *next;
165 u32 flags;
166 u32 q_fam;
168 struct vk_xcb_surf_create_info_t {
169 u32 type;
170 void *next;
171 u32 flags;
172 xcb_connection_t *c;
173 xcb_window_t win;
175 struct vk_phydev_surf_info_t {
176 u32 type;
177 void *next;
178 void *surf;
180 struct vk_surf_texel_mem_blk_conf_core_t {
181 u32 fmt;
182 u32 color_space;
184 struct vk_surf_texel_mem_blk_conf_t {
185 u32 type;
186 void *next;
187 struct vk_surf_texel_mem_blk_conf_core_t core;
189 struct vk_mem_type_t {
190 u32 prop_flags;
191 u32 heap;
193 struct vk_mem_heap_t {
194 u64 sz;
195 u32 flags;
197 #define VK_MEM_TYPES_N_MAX 32
198 #define VK_MEM_HEAPS_N_MAX 16
199 struct vk_phydev_mem_props_core_t {
200 u32 mem_types_n;
201 struct vk_mem_type_t mem_types[VK_MEM_TYPES_N_MAX];
202 u32 mem_heaps_n;
203 struct vk_mem_heap_t mem_heaps[VK_MEM_HEAPS_N_MAX];
205 struct vk_phydev_mem_props_t {
206 u32 type;
207 void *next;
208 struct vk_phydev_mem_props_core_t core;
210 struct vk_surf_caps_core_t {
211 u32 imgs_n_min;
212 u32 imgs_n_max;
213 struct vk_extent_2d_t current_extent;
214 struct vk_extent_2d_t img_extent_min;
215 struct vk_extent_2d_t img_extent_max;
216 u32 img_array_layers_n_max;
217 u32 supported_transforms;
218 u32 current_transform;
219 u32 supported_composite_alpha;
220 u32 supported_img_usage_flags;
222 struct vk_surf_caps_t {
223 u32 type;
224 void *next;
225 struct vk_surf_caps_core_t core;
227 struct vk_swpchn_create_info_t {
228 u32 type;
229 void *next;
230 u32 flags;
231 struct vk_surf_t *surf;
232 u32 imgs_n_min;
233 u32 img_texel_mem_blk_fmt;
234 u32 img_color_space;
235 struct vk_extent_2d_t img_extent;
236 u32 img_layers_n;
237 u32 img_usage;
238 u32 img_sharing_mode;
239 u32 q_fams_n;
240 u32 *q_fams;
241 u32 pre_transform;
242 u32 composite_alpha;
243 u32 present_mode;
244 u32 clipped;
245 struct vk_swpchn_t *old_swpchn;
247 struct vk_img_create_info_t {
248 u32 type;
249 void *next;
250 u32 flags;
251 u32 img_type;
252 u32 texel_mem_blk_fmt;
253 struct vk_extent_3d_t extent;
254 u32 mip_lvls_n;
255 u32 array_layers_n;
256 u32 samples_n; /* flags */
257 u32 img_tiling;
258 u32 usage;
259 u32 sharing_mode;
260 u32 q_fams_n;
261 u32 *q_fams;
262 u32 initial_layout;
264 struct vk_img_mem_rqmts_info_t {
265 u32 type;
266 void *next;
267 struct vk_img_t *img;
269 struct vk_mem_rqmts_core_t {
270 u64 sz;
271 u64 alignment;
272 /* idxs of bits are idxs in mem types of vk_phydev_mem_props_core_t */
273 u32 mem_type_bits;
275 struct vk_mem_rqmts_t {
276 u32 type;
277 void *next;
278 struct vk_mem_rqmts_core_t core;
280 struct vk_mem_alloc_info_t {
281 u32 type;
282 void *next;
283 u64 sz;
284 u32 mem_type_idx; /* in the physical device array of memory types */
286 struct vk_bind_img_mem_info_t {
287 u32 type;
288 void *next;
289 struct vk_img_t *img;
290 struct vk_dev_mem_t *mem;
291 u64 offset;
293 struct vk_img_subrsrc_range_t {
294 u32 aspect;
295 u32 base_mip_lvl;
296 u32 lvls_n;
297 u32 base_array_layer;
298 u32 array_layers_n;
300 struct vk_img_mem_barrier_t {
301 u32 type;
302 void *next;
303 u32 src_access;
304 u32 dst_access;
305 u32 old_layout;
306 u32 new_layout;
307 u32 src_q_fam;
308 u32 dst_q_fam;
309 struct vk_img_t *img;
310 struct vk_img_subrsrc_range_t subrsrc_range;
312 struct vk_cb_alloc_info_t {
313 u32 type;
314 void *next;
315 struct vk_cp_t *cp;
316 u32 lvl;
317 u32 cbs_n;
319 struct vk_cb_begin_info_t {
320 u32 type;
321 void *next;
322 u32 flags;
323 void *do_not_use;
325 struct vk_submit_info_t {
326 u32 type;
327 void *next;
328 u32 wait_sems_n;
329 struct vk_sem_t **wait_sems;
330 u32* wait_dst_stages;
331 u32 cbs_n;
332 struct vk_cb_t **cbs;
333 u32 signal_sems_n;
334 struct vk_sem_t **signal_sems;
336 struct vk_img_subrsrc_t {
337 u32 aspect;
338 u32 mip_lvl;
339 u32 array_layer;
341 struct vk_subrsrc_layout_t {
342 u64 offset;
343 u64 sz;
344 u64 row_pitch;
345 u64 array_pitch;
346 u64 depth_pitch;
348 struct vk_img_subrsrc_layers_t {
349 u32 aspect;
350 u32 mip_lvl;
351 u32 base_array_layer;
352 u32 array_layers_n;
354 struct vk_acquire_next_img_info_t {
355 u32 type;
356 void *next;
357 struct vk_swpchn_t *swpchn;
358 u64 timeout;
359 struct vk_sem_t *sem;
360 struct vk_fence_t *fence;
361 u32 devs;
363 struct vk_img_blit_t {
364 struct vk_img_subrsrc_layers_t src_subrsrc;
365 struct vk_offset_3d_t src_offsets[2];
366 struct vk_img_subrsrc_layers_t dst_subrsrc;
367 struct vk_offset_3d_t dst_offsets[2];
369 struct vk_present_info_t {
370 u32 type;
371 void *next;
372 u32 wait_sems_n;
373 struct vk_sem_t **wait_sems;
374 u32 swpchns_n;
375 struct vk_swpchn_t **swpchns;
376 u32 *idxs;
377 s32 *results;
379 struct vk_sem_create_info_t {
380 u32 type;
381 void *next;
382 u32 flags;
384 struct vk_comp_map_t {
385 s32 r;
386 s32 g;
387 s32 b;
388 s32 a;
390 struct vk_imgview_create_info_t {
391 u32 type;
392 void *next;
393 u32 flags;
394 struct vk_img_t *img;
395 s32 view_type;
396 s32 fmt;
397 struct vk_comp_map_t comps;
398 struct vk_img_subrsrc_range_t subrsrc_range;
400 struct vk_at_desc_t {
401 u32 type;
402 void *next;
403 u32 flags;
404 u32 fmt;
405 u32 samples_n;
406 u32 load_op;
407 u32 store_op;
408 u32 stencil_load_op;
409 u32 stencil_store_op;
410 u32 initial_layout;
411 u32 final_layout;
413 struct vk_at_ref_t {
414 u32 type;
415 void *next;
416 u32 at;
417 u32 layout;
419 struct vk_sp_desc_t {
420 u32 type;
421 void *next;
422 u32 flags;
423 u32 pl_bind_point;
424 u32 viewmask;
425 u32 input_ats_n;
426 struct vk_at_ref_t *input_ats;
427 u32 color_ats_n;
428 struct vk_at_ref_t *color_ats;
429 struct vk_at_ref_t *resolve_ats;
430 struct vk_at_ref_t *depth_stencil_ats;
431 u32 preserve_ats_n;
432 u32 *preserve_ats;
434 struct vk_sp_dep_t {
435 u32 src_sp;
436 u32 dst_sp;
437 u32 src_stage_mask;
438 u32 dst_stage_mask;
439 u32 src_access_mask;
440 u32 dst_access_mask;
441 u32 dep;
443 struct vk_rp_create_info_t {
444 u32 type;
445 void *next;
446 u32 flags;
447 u32 ats_n;
448 struct vk_at_desc_t *ats;
449 u32 sps_n;
450 struct vk_sp_desc_t *sps;
451 u32 deps_n;
452 struct vk_sp_dep_t *deps;
453 u32 correlated_viewmasks_n;
454 u32 *correlated_viewmasks;
456 struct vk_sp_begin_info_t {
457 u32 type;
458 void *next;
459 u32 contents;
461 struct vk_sp_end_info_t {
462 u32 type;
463 void *next;
465 struct vk_fb_create_info_t {
466 u32 type;
467 void *next;
468 u32 flags;
469 struct vk_rp_t *rp;
470 u32 ats_n;
471 struct vk_imgview_t *ats;
472 u32 width;
473 u32 height;
474 u32 layers_n;
476 struct vk_shmod_create_info_t {
477 u32 type;
478 void *next;
479 u32 flags;
480 size_t code_sz; /* bytes_n */
481 u32 *code;
483 struct vk_pl_sh_stage_create_info_t {
484 u32 type;
485 void *next;
486 u32 flags;
487 u32 stage;
488 struct vk_shmod_t *shmod;
489 u8 *name;
490 struct vk_specialization_t *specialization_info; /* later */
492 struct vk_pl_vtx_input_state_create_info_t {
493 u32 type;
494 void *next;
495 u32 flags;
496 u32 not_used_0;
497 void *not_used_1;
498 u32 not_used_2;
499 void *not_used_3;
501 struct vk_pl_input_assembly_state_create_info_t {
502 u32 type;
503 void *next;
504 u32 flags;
505 u32 topology;
506 u32 prim_restart_ena;
508 /* XXX: this does define a _transformation_ from "normalized" coords ! */
509 struct vk_viewport_t {
510 f32 x;
511 f32 y;
512 f32 width;
513 f32 height;
514 f32 depth_min;
515 f32 depth_max;
517 struct vk_pl_viewport_state_create_info_t {
518 u32 type;
519 void *next;
520 u32 flags;
521 u32 viewports_n;
522 struct vk_viewport_t *viewports;
523 u32 scissors_n;
524 struct vk_rect_2d_t *scissors;
526 struct vk_pl_raster_state_create_info_t {
527 u32 type;
528 void *next;
529 u32 flags;
530 u32 depth_clamp_ena;
531 u32 raster_discard_ena;
532 u32 polygon_mode;
533 u32 cull_mode;
534 u32 front_face;
535 u32 depth_bias_ena;
536 f32 depth_bias_constant_factor;
537 f32 depth_bias_clamp;
538 f32 depth_bias_slope_factor;
539 f32 line_width;
541 struct vk_pl_multisample_state_create_info_t {
542 u32 type;
543 void *next;
544 u32 flags;
545 u32 raster_samples_n; /* flag */
546 u32 sample_shading_ena;
547 f32 sample_shading_min;
548 u32 *sample_mask;
549 u32 alpha_to_coverage_ena;
550 u32 alpha_to_one_ena;
552 struct vk_pl_color_blend_at_state_t {
553 u32 blend_ena;
555 u32 src_color_blend_factor;
556 u32 dst_color_blend_factor;
557 /* normalized integer */
558 u32 color_blend_op;
560 u32 src_alpha_blend_factor;
561 u32 dst_alpha_blend_factor;
562 u32 alpha_blend_op;
564 /* normalized integer */
565 /* XXX: must always be set, blending enabled or disabled */
566 u32 color_write_mask;
568 struct vk_pl_color_blend_state_create_info_t {
569 u32 type;
570 void *next;
571 u32 flags;
572 u32 logic_op_ena;
573 /* floats */
574 u32 logic_op;
575 u32 ats_n;
576 struct vk_pl_color_blend_at_state_t *ats;
577 f32 blend_consts[4];
579 struct vk_pushconst_range_t {
580 u32 shader_stages;
581 u32 offset;
582 u32 size;
584 struct vk_pl_layout_create_info_t {
585 u32 type;
586 void *next;
587 u32 flags;
588 u32 layouts_n;
589 struct vk_dset_layout_t **layouts;
590 u32 pushconst_ranges_n;
591 struct vk_pushconst_range_t *ranges;
593 struct vk_gfx_pl_create_info_t {
594 u32 type;
595 void *next;
596 u32 flags;
597 u32 sh_stages_n;
598 struct vk_pl_sh_stage_create_info_t *sh_stages;
599 struct vk_pl_vtx_input_state_create_info_t *vtx_input_state;
600 struct vk_pl_input_assembly_state_create_info_t *input_assembly_state;
601 void *dont_use_0;
602 struct vk_pl_viewport_state_create_info_t *viewport_state;
603 struct vk_pl_raster_state_create_info_t *raster_state;
604 struct vk_pl_multisample_state_create_info_t *multisample_state;
605 void *not_used_0;
606 struct vk_pl_color_blend_state_create_info_t *color_blend_state;
607 void *not_used_1;
608 struct vk_pl_layout_t *layout;
609 struct vk_rp_t *rp;
610 u32 sp;
611 struct vk_pl_t *base_pl;
612 u32 base_pl_idx;
614 union vk_clr_color_val_t {
615 f32 f32s[4];
616 u32 u32s[4];
617 s32 s32s[4];
619 struct vk_clr_depth_stencil_val_t {
620 f32 depth;
621 u32 stencil;
623 union vk_clr_val_t {
624 union vk_clr_color_val_t color;
625 struct vk_clr_depth_stencil_val_t depth_stencil;
627 struct vk_rp_begin_info_t {
628 u32 type;
629 void *next;
630 struct vk_rp_t *rp;
631 struct vk_fb_t *fb;
632 struct vk_rect_2d_t render_area;
633 u32 clr_vals_n;
634 union vk_clr_val_t *clr_vals;
636 struct vk_fence_create_info_t {
637 u32 type;
638 void *next;
639 u32 flags;
641 #endif