foo
[vktest3] / src / vk.h
index 4e94784..f93634f 100644 (file)
--- a/src/vk.h
+++ b/src/vk.h
@@ -2,6 +2,7 @@
 #define VK_H_
 
 #include <X11/Xlib.h>
+#include <vulkan/vulkan.h>
 
 enum {
        VKINIT_DEPTH    = 1,
@@ -9,18 +10,93 @@ enum {
        VKINIT_RAY              = 0x100
 };
 
+/* queue capability flags for vk_find_qfamily and vk_init_queue */
+enum {
+       VKQ_GFX                 = 1,
+       VKQ_COMPUTE             = 2,
+       VKQ_PRESENT             = 4,
+       VKQ_XFER                = 8
+};
+
+/* shader types
+ * arranged so that: (1 << VKSDR_FOO) == VK_SHADER_STAGE_FOO_BIT
+ */
+enum {
+       VKSDR_VERTEX    = 0,
+       VKSDR_TESS_CTL  = 1,
+       VKSDR_TESS_EVAL = 2,
+       VKSDR_GEOM              = 3,
+       VKSDR_PIXEL             = 4,
+       VKSDR_COMPUTE   = 5,
+
+       VKSDR_TASK              = 6,
+       VKSDR_MESH              = 7,
+
+       VKSDR_RAYGEN    = 8,
+       VKSDR_ANYHIT    = 9,
+       VKSDR_CLOSESTHIT = 10,
+       VKSDR_MISS              = 11,
+       VKSDR_ISECT             = 12,
+
+       VKSDR_MAX
+};
+
+/* primitives */
+enum {
+       VKPRIM_POINTS           = VK_PRIMITIVE_TOPOLOGY_POINT_LIST,
+       VKPRIM_LINES            = VK_PRIMITIVE_TOPOLOGY_LINE_LIST,
+       VKPRIM_TRIANGLES        = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST
+};
+
 void vk_init_xwin(Display *dpy, Window win);
+void vk_init_queue(unsigned int qflags, int count);
 
 int vk_init(unsigned int flags, unsigned int *usedflags);
 void vk_cleanup(void);
 
 int vk_reshape(int xsz, int ysz);
 
+int vk_find_qfamily(unsigned int flags);
+VkQueue vk_getq_fam(int fam, int n);
+VkQueue vk_getq(unsigned int flags, int n);
+
+VkCommandBuffer vk_create_cmdbuf_fam(int qfam, int level);
+VkCommandBuffer vk_create_cmdbuf(unsigned int qflags, int level);
+
 int vk_create_rpass(void);
 void vk_free_rpass(int rp);
 void vk_rpass_colorbuf(int rp, int fmt, int n);
 void vk_rpass_msaa(int rp, int nsamp);
+void vk_rpass_clear(int rp, int clear);
 VkRenderPass vk_rpass(int rp);
 
+int vk_create_fb(void);
+void vk_free_fb(int fb);
+void vk_fb_size(int fb, int x, int y);
+void vk_fb_rpass(int fb, int rpass);
+void vk_fb_images(int fb, int n, ...);
+VkFramebuffer vk_fb(int fb);
+
+int vk_create_pipeln(void);
+void vk_free_pipeln(int pp);
+void vk_viewport(int pp, int x, int y, int width, int height);
+void vk_scissor(int pp, int x, int y, int width, int height);
+void vk_pipeln_shader(int pp, int type, VkShaderModule sdr);
+/* TODO: vertex input */
+void vk_pipeln_prim(int pp, int prim);
+void vk_pipeln_polymode(int pp, int mode);
+void vk_pipeln_cull(int pp, int cull);
+void vk_pipeln_frontface(int pp, int ff);
+void vk_pipeln_multisample(int pp, int nsamples);
+void vk_pipeln_colormask(int pp, int r, int g, int b, int a);
+void vk_pipeln_depthmask(int pp, int z);
+void vk_pipeln_stencilmask(int pp, int s);
+void vk_pipeln_zbuffer(int pp, int enable);
+void vk_pipeln_stencil(int pp, int enable);
+void vk_pipeln_stencil_op(int pp, int sfail, int zfail, int zpass);
+void vk_pipeln_stencil_func(int pp, int op, unsigned int ref, unsigned int mask);
+void vk_pipeln_blend(int pp, int enable);
+void vk_pipeln_blendfunc(int pp, int src, int dst);
+VkPipeline vk_pipeln(int pp);
 
 #endif /* VK_H_ */