d48634fb43400299b3bca4455223e66c3fdc1589
[vktest3] / src / vk.h
1 #ifndef VK_H_
2 #define VK_H_
3
4 #include <X11/Xlib.h>
5 #include <vulkan/vulkan.h>
6
7 enum {
8         VKINIT_DEPTH    = 1,
9         VKINIT_STENCIL  = 2,
10         VKINIT_RAY              = 0x100
11 };
12
13 /* queue capability flags for vk_find_qfamily and vk_init_queue */
14 enum {
15         VKQ_GFX                 = 1,
16         VKQ_COMPUTE             = 2,
17         VKQ_PRESENT             = 4,
18         VKQ_XFER                = 8
19 };
20
21 /* shader types */
22 enum {
23         VKSDR_VERTEX,
24         VKSDR_PIXEL,
25         VKSDR_TESS_CTL,
26         VKSDR_TESS_EVAL,
27         VKSDR_GEOM
28 };
29
30 /* primitives */
31 enum {
32         VKPRIM_POINTS,
33         VKPRIM_LINES,
34         VKPRIM_TRIANGLES
35 };
36
37 void vk_init_xwin(Display *dpy, Window win);
38 void vk_init_queue(unsigned int qflags, int count);
39
40 int vk_init(unsigned int flags, unsigned int *usedflags);
41 void vk_cleanup(void);
42
43 int vk_reshape(int xsz, int ysz);
44
45 int vk_find_qfamily(unsigned int flags);
46 VkQueue vk_getq_fam(int fam, int n);
47 VkQueue vk_getq(unsigned int flags, int n);
48
49 VkCommandBuffer vk_create_cmdbuf_fam(int qfam, int level);
50 VkCommandBuffer vk_create_cmdbuf(unsigned int qflags, int level);
51
52 int vk_create_rpass(void);
53 void vk_free_rpass(int rp);
54 void vk_rpass_colorbuf(int rp, int fmt, int n);
55 void vk_rpass_msaa(int rp, int nsamp);
56 void vk_rpass_clear(int rp, int clear);
57 VkRenderPass vk_rpass(int rp);
58
59 int vk_create_fb(void);
60 void vk_free_fb(int fb);
61 void vk_fb_size(int fb, int x, int y);
62 void vk_fb_rpass(int fb, int rpass);
63 void vk_fb_images(int fb, int n, ...);
64 VkFramebuffer vk_fb(int fb);
65
66 int vk_create_pipeln(void);
67 void vk_free_pipeln(int pp);
68 void vk_viewport(int pp, int x, int y, int width, int height);
69 void vk_scissor(int pp, int x, int y, int width, int height);
70 void vk_pipeln_shader(int pp, int type, VkShaderModule sdr);
71 /* TODO: vertex input */
72 void vk_pipeln_prim(int pp, int prim);
73 void vk_pipeln_polymode(int pp, int mode);
74 void vk_pipeln_cull(int pp, int cull);
75 void vk_pipeln_frontface(int pp, int ff);
76 void vk_pipeln_linewidth(int pp, float w);
77 void vk_pipeln_multisample(int pp, int nsamples);
78 void vk_pipeln_colormask(int pp, int r, int g, int b);
79 void vk_pipeln_depthmask(int pp, int z);
80 void vk_pipeln_stencilmask(int pp, int s);
81 void vk_pipeln_zbuffer(int pp, int enable);
82 void vk_pipeln_stencil(int pp, int enable);
83 void vk_pipeln_stencil_op(int pp, int sfail, int zfail, int zpass);
84 void vk_pipeln_stencil_func(int pp, int op, unsigned int ref, unsigned int mask);
85 void vk_pipeln_blend(int pp, int enable);
86 void vk_pipeln_blendfunc(int pp, int src, int dst);
87
88 #endif  /* VK_H_ */