5 #include <vulkan/vulkan.h>
13 /* queue capability flags for vk_find_qfamily and vk_init_queue */
22 * arranged so that: (1 << VKSDR_FOO) == VK_SHADER_STAGE_FOO_BIT
37 VKSDR_CLOSESTHIT = 10,
43 #define VKSDR_STAGE(x) (1 << (x))
47 VKPRIM_POINTS = VK_PRIMITIVE_TOPOLOGY_POINT_LIST,
48 VKPRIM_LINES = VK_PRIMITIVE_TOPOLOGY_LINE_LIST,
49 VKPRIM_TRIANGLES = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST
52 void vk_init_xwin(Display *dpy, Window win);
53 void vk_init_queue(unsigned int qflags, int count);
55 int vk_init(unsigned int flags, unsigned int *usedflags);
56 void vk_cleanup(void);
58 int vk_reshape(int xsz, int ysz);
60 /* returns the image index, or -1 on failure. Pass optional semaphore to signal */
61 int vk_next_image(VkSemaphore sem);
63 int vk_submit(VkQueue q, VkCommandBuffer cmdbuf, VkSemaphore semwait, VkSemaphore semsig);
64 int vk_present(VkQueue q, int imgid, VkSemaphore semwait);
66 int vk_find_qfamily(unsigned int flags);
67 VkQueue vk_getq_fam(int fam, int n);
68 VkQueue vk_getq(unsigned int flags, int n);
70 VkCommandBuffer vk_create_cmdbuf_fam(int qfam, int level);
71 VkCommandBuffer vk_create_cmdbuf(unsigned int qflags, int level);
72 /* return one of the swap-chain command buffers */
73 VkCommandBuffer vk_get_cmdbuf(int imgid);
75 int vk_create_rpass(void);
76 void vk_free_rpass(int rp);
77 void vk_rpass_colorbuf(int rp, int fmt, int n);
78 void vk_rpass_msaa(int rp, int nsamp);
79 void vk_rpass_clear(int rp, int clear);
80 VkRenderPass vk_rpass(int rp);
82 int vk_create_fb(void);
83 void vk_free_fb(int fb);
84 void vk_fb_size(int fb, int x, int y);
85 void vk_fb_rpass(int fb, int rpass);
86 void vk_fb_images(int fb, int n, ...);
87 VkFramebuffer vk_fb(int fb);
89 int vk_create_pipeln(void);
90 void vk_free_pipeln(int pp);
91 void vk_pipeln_rpass(int pp, VkRenderPass rp);
92 void vk_pipeln_viewport(int pp, int x, int y, int width, int height);
93 void vk_pipeln_scissor(int pp, int x, int y, int width, int height);
94 void vk_pipeln_shader(int pp, int type, VkShaderModule sdr);
95 /* TODO: vertex input */
96 void vk_pipeln_prim(int pp, int prim);
97 void vk_pipeln_polymode(int pp, int mode);
98 void vk_pipeln_cull(int pp, int cull);
99 void vk_pipeln_frontface(int pp, int ff);
100 void vk_pipeln_linewidth(int pp, int w);
101 void vk_pipeln_multisample(int pp, int nsamples);
102 void vk_pipeln_colormask(int pp, int r, int g, int b, int a);
103 void vk_pipeln_depthmask(int pp, int z);
104 void vk_pipeln_stencilmask(int pp, int s);
105 void vk_pipeln_zbuffer(int pp, int enable);
106 void vk_pipeln_zbuffer_op(int pp, int op);
107 void vk_pipeln_stencil(int pp, int enable);
108 void vk_pipeln_stencil_op(int pp, int sfail, int zfail, int zpass);
109 void vk_pipeln_stencil_func(int pp, int op, unsigned int ref, unsigned int mask);
110 void vk_pipeln_blend(int pp, int enable);
111 void vk_pipeln_blendfunc(int pp, int src, int dst);
112 VkPipeline vk_pipeln(int pp);
114 VkShaderModule vk_load_shader(const char *fname);
115 void vk_free_shader(VkShaderModule sdr);
117 VkSemaphore vk_create_sem(void);
118 void vk_free_sem(VkSemaphore sem);