npv:osd:ascii only mode for the timer
[nyanmp.git] / npv / nyanvk / types.h
blob123e19423cd7470ce9548052045179a2493d0000
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_texel_mem_blk_fmt_props_core_t {
211 u32 linear_tiling_features;
212 u32 optimal_tiling_features;
213 u32 buffer_features;
215 struct vk_texel_mem_blk_fmt_props_t {
216 u32 type;
217 void *next;
218 struct vk_texel_mem_blk_fmt_props_core_t core;
220 struct vk_surf_caps_core_t {
221 u32 imgs_n_min;
222 u32 imgs_n_max;
223 struct vk_extent_2d_t current_extent;
224 struct vk_extent_2d_t img_extent_min;
225 struct vk_extent_2d_t img_extent_max;
226 u32 img_array_layers_n_max;
227 u32 supported_transforms;
228 u32 current_transform;
229 u32 supported_composite_alpha;
230 u32 supported_img_usage_flags;
232 struct vk_surf_caps_t {
233 u32 type;
234 void *next;
235 struct vk_surf_caps_core_t core;
237 struct vk_swpchn_create_info_t {
238 u32 type;
239 void *next;
240 u32 flags;
241 struct vk_surf_t *surf;
242 u32 imgs_n_min;
243 u32 img_texel_mem_blk_fmt;
244 u32 img_color_space;
245 struct vk_extent_2d_t img_extent;
246 u32 img_layers_n;
247 u32 img_usage;
248 u32 img_sharing_mode;
249 u32 q_fams_n;
250 u32 *q_fams;
251 u32 pre_transform;
252 u32 composite_alpha;
253 u32 present_mode;
254 u32 clipped;
255 struct vk_swpchn_t *old_swpchn;
257 struct vk_img_create_info_t {
258 u32 type;
259 void *next;
260 u32 flags;
261 u32 img_type;
262 u32 texel_mem_blk_fmt;
263 struct vk_extent_3d_t extent;
264 u32 mip_lvls_n;
265 u32 array_layers_n;
266 u32 samples_n; /* flags */
267 u32 img_tiling;
268 u32 usage;
269 u32 sharing_mode;
270 u32 q_fams_n;
271 u32 *q_fams;
272 u32 initial_layout;
274 struct vk_img_mem_rqmts_info_t {
275 u32 type;
276 void *next;
277 struct vk_img_t *img;
279 struct vk_mem_rqmts_core_t {
280 u64 sz;
281 u64 alignment;
282 /* idxs of bits are idxs in mem types of vk_phydev_mem_props_core_t */
283 u32 mem_type_bits;
285 struct vk_mem_rqmts_t {
286 u32 type;
287 void *next;
288 struct vk_mem_rqmts_core_t core;
290 struct vk_mem_alloc_info_t {
291 u32 type;
292 void *next;
293 u64 sz;
294 u32 mem_type_idx; /* in the physical device array of memory types */
296 struct vk_bind_img_mem_info_t {
297 u32 type;
298 void *next;
299 struct vk_img_t *img;
300 struct vk_dev_mem_t *mem;
301 u64 offset;
303 struct vk_img_subrsrc_range_t {
304 u32 aspect;
305 u32 base_mip_lvl;
306 u32 lvls_n;
307 u32 base_array_layer;
308 u32 array_layers_n;
310 struct vk_img_mem_barrier_t {
311 u32 type;
312 void *next;
313 u32 src_access;
314 u32 dst_access;
315 u32 old_layout;
316 u32 new_layout;
317 u32 src_q_fam;
318 u32 dst_q_fam;
319 struct vk_img_t *img;
320 struct vk_img_subrsrc_range_t subrsrc_range;
322 struct vk_cb_alloc_info_t {
323 u32 type;
324 void *next;
325 struct vk_cp_t *cp;
326 u32 lvl;
327 u32 cbs_n;
329 struct vk_cb_begin_info_t {
330 u32 type;
331 void *next;
332 u32 flags;
333 void *do_not_use;
335 struct vk_submit_info_t {
336 u32 type;
337 void *next;
338 u32 wait_sems_n;
339 struct vk_sem_t **wait_sems;
340 u32* wait_dst_stages;
341 u32 cbs_n;
342 struct vk_cb_t **cbs;
343 u32 signal_sems_n;
344 struct vk_sem_t **signal_sems;
346 struct vk_img_subrsrc_t {
347 u32 aspect;
348 u32 mip_lvl;
349 u32 array_layer;
351 struct vk_subrsrc_layout_t {
352 u64 offset;
353 u64 sz;
354 u64 row_pitch;
355 u64 array_pitch;
356 u64 depth_pitch;
358 struct vk_img_subrsrc_layers_t {
359 u32 aspect;
360 u32 mip_lvl;
361 u32 base_array_layer;
362 u32 array_layers_n;
364 struct vk_acquire_next_img_info_t {
365 u32 type;
366 void *next;
367 struct vk_swpchn_t *swpchn;
368 u64 timeout;
369 struct vk_sem_t *sem;
370 struct vk_fence_t *fence;
371 u32 devs;
373 struct vk_img_blit_t {
374 struct vk_img_subrsrc_layers_t src_subrsrc;
375 struct vk_offset_3d_t src_offsets[2];
376 struct vk_img_subrsrc_layers_t dst_subrsrc;
377 struct vk_offset_3d_t dst_offsets[2];
379 struct vk_present_info_t {
380 u32 type;
381 void *next;
382 u32 wait_sems_n;
383 struct vk_sem_t **wait_sems;
384 u32 swpchns_n;
385 struct vk_swpchn_t **swpchns;
386 u32 *idxs;
387 s32 *results;
389 struct vk_sem_create_info_t {
390 u32 type;
391 void *next;
392 u32 flags;
394 struct vk_comp_map_t {
395 s32 r;
396 s32 g;
397 s32 b;
398 s32 a;
400 struct vk_imgview_create_info_t {
401 u32 type;
402 void *next;
403 u32 flags;
404 struct vk_img_t *img;
405 s32 view_type;
406 s32 fmt;
407 struct vk_comp_map_t comps;
408 struct vk_img_subrsrc_range_t subrsrc_range;
410 struct vk_at_desc_t {
411 u32 type;
412 void *next;
413 u32 flags;
414 u32 fmt;
415 u32 samples_n;
416 u32 load_op;
417 u32 store_op;
418 u32 stencil_load_op;
419 u32 stencil_store_op;
420 u32 initial_layout;
421 u32 final_layout;
423 struct vk_at_ref_t {
424 u32 type;
425 void *next;
426 u32 at;
427 u32 layout;
429 struct vk_sp_desc_t {
430 u32 type;
431 void *next;
432 u32 flags;
433 u32 pl_bind_point;
434 u32 viewmask;
435 u32 input_ats_n;
436 struct vk_at_ref_t *input_ats;
437 u32 color_ats_n;
438 struct vk_at_ref_t *color_ats;
439 struct vk_at_ref_t *resolve_ats;
440 struct vk_at_ref_t *depth_stencil_ats;
441 u32 preserve_ats_n;
442 u32 *preserve_ats;
444 struct vk_sp_dep_t {
445 u32 src_sp;
446 u32 dst_sp;
447 u32 src_stage_mask;
448 u32 dst_stage_mask;
449 u32 src_access_mask;
450 u32 dst_access_mask;
451 u32 dep;
453 struct vk_rp_create_info_t {
454 u32 type;
455 void *next;
456 u32 flags;
457 u32 ats_n;
458 struct vk_at_desc_t *ats;
459 u32 sps_n;
460 struct vk_sp_desc_t *sps;
461 u32 deps_n;
462 struct vk_sp_dep_t *deps;
463 u32 correlated_viewmasks_n;
464 u32 *correlated_viewmasks;
466 struct vk_sp_begin_info_t {
467 u32 type;
468 void *next;
469 u32 contents;
471 struct vk_sp_end_info_t {
472 u32 type;
473 void *next;
475 struct vk_fb_create_info_t {
476 u32 type;
477 void *next;
478 u32 flags;
479 struct vk_rp_t *rp;
480 u32 ats_n;
481 struct vk_imgview_t *ats;
482 u32 width;
483 u32 height;
484 u32 layers_n;
486 struct vk_shmod_create_info_t {
487 u32 type;
488 void *next;
489 u32 flags;
490 size_t code_sz; /* bytes_n */
491 u32 *code;
493 struct vk_pl_sh_stage_create_info_t {
494 u32 type;
495 void *next;
496 u32 flags;
497 u32 stage;
498 struct vk_shmod_t *shmod;
499 u8 *name;
500 struct vk_specialization_t *specialization_info; /* later */
502 struct vk_pl_vtx_input_state_create_info_t {
503 u32 type;
504 void *next;
505 u32 flags;
506 u32 not_used_0;
507 void *not_used_1;
508 u32 not_used_2;
509 void *not_used_3;
511 struct vk_pl_input_assembly_state_create_info_t {
512 u32 type;
513 void *next;
514 u32 flags;
515 u32 topology;
516 u32 prim_restart_ena;
518 /* XXX: this does define a _transformation_ from "normalized" coords ! */
519 struct vk_viewport_t {
520 f32 x;
521 f32 y;
522 f32 width;
523 f32 height;
524 f32 depth_min;
525 f32 depth_max;
527 struct vk_pl_viewport_state_create_info_t {
528 u32 type;
529 void *next;
530 u32 flags;
531 u32 viewports_n;
532 struct vk_viewport_t *viewports;
533 u32 scissors_n;
534 struct vk_rect_2d_t *scissors;
536 struct vk_pl_raster_state_create_info_t {
537 u32 type;
538 void *next;
539 u32 flags;
540 u32 depth_clamp_ena;
541 u32 raster_discard_ena;
542 u32 polygon_mode;
543 u32 cull_mode;
544 u32 front_face;
545 u32 depth_bias_ena;
546 f32 depth_bias_constant_factor;
547 f32 depth_bias_clamp;
548 f32 depth_bias_slope_factor;
549 f32 line_width;
551 struct vk_pl_multisample_state_create_info_t {
552 u32 type;
553 void *next;
554 u32 flags;
555 u32 raster_samples_n; /* flag */
556 u32 sample_shading_ena;
557 f32 sample_shading_min;
558 u32 *sample_mask;
559 u32 alpha_to_coverage_ena;
560 u32 alpha_to_one_ena;
562 struct vk_pl_color_blend_at_state_t {
563 u32 blend_ena;
565 u32 src_color_blend_factor;
566 u32 dst_color_blend_factor;
567 /* normalized integer */
568 u32 color_blend_op;
570 u32 src_alpha_blend_factor;
571 u32 dst_alpha_blend_factor;
572 u32 alpha_blend_op;
574 /* normalized integer */
575 /* XXX: must always be set, blending enabled or disabled */
576 u32 color_write_mask;
578 struct vk_pl_color_blend_state_create_info_t {
579 u32 type;
580 void *next;
581 u32 flags;
582 u32 logic_op_ena;
583 /* floats */
584 u32 logic_op;
585 u32 ats_n;
586 struct vk_pl_color_blend_at_state_t *ats;
587 f32 blend_consts[4];
589 struct vk_pushconst_range_t {
590 u32 shader_stages;
591 u32 offset;
592 u32 size;
594 struct vk_pl_layout_create_info_t {
595 u32 type;
596 void *next;
597 u32 flags;
598 u32 layouts_n;
599 struct vk_dset_layout_t **layouts;
600 u32 pushconst_ranges_n;
601 struct vk_pushconst_range_t *ranges;
603 struct vk_gfx_pl_create_info_t {
604 u32 type;
605 void *next;
606 u32 flags;
607 u32 sh_stages_n;
608 struct vk_pl_sh_stage_create_info_t *sh_stages;
609 struct vk_pl_vtx_input_state_create_info_t *vtx_input_state;
610 struct vk_pl_input_assembly_state_create_info_t *input_assembly_state;
611 void *dont_use_0;
612 struct vk_pl_viewport_state_create_info_t *viewport_state;
613 struct vk_pl_raster_state_create_info_t *raster_state;
614 struct vk_pl_multisample_state_create_info_t *multisample_state;
615 void *not_used_0;
616 struct vk_pl_color_blend_state_create_info_t *color_blend_state;
617 void *not_used_1;
618 struct vk_pl_layout_t *layout;
619 struct vk_rp_t *rp;
620 u32 sp;
621 struct vk_pl_t *base_pl;
622 u32 base_pl_idx;
624 union vk_clr_color_val_t {
625 f32 f32s[4];
626 u32 u32s[4];
627 s32 s32s[4];
629 struct vk_clr_depth_stencil_val_t {
630 f32 depth;
631 u32 stencil;
633 union vk_clr_val_t {
634 union vk_clr_color_val_t color;
635 struct vk_clr_depth_stencil_val_t depth_stencil;
637 struct vk_rp_begin_info_t {
638 u32 type;
639 void *next;
640 struct vk_rp_t *rp;
641 struct vk_fb_t *fb;
642 struct vk_rect_2d_t render_area;
643 u32 clr_vals_n;
644 union vk_clr_val_t *clr_vals;
646 struct vk_fence_create_info_t {
647 u32 type;
648 void *next;
649 u32 flags;
651 #endif