4 #include <vulkan/vulkan.h>
6 extern VkSwapchainKHR vkswapchain;
7 extern VkImage *vkswapchain_images;
8 extern VkSurfaceKHR vksurface;
9 extern VkInstance vkinst;
10 extern VkPhysicalDevice vkpdev;
11 extern VkDevice vkdev;
13 extern VkCommandPool vkcmdpool;
14 extern VkCommandBuffer vkcmdbuf; /* primary command buffer */
16 extern int vknext_swapchain_image;
20 VkDeviceMemory mem_pool;
21 int mem_start, mem_size;
25 bool vku_have_extension(const char *name);
26 bool vku_have_device_extension(const char *name);
29 bool vku_create_device();
33 VkCommandBuffer vku_alloc_cmdbuf(VkCommandPool pool, VkCommandBufferLevel level);
34 void vku_free_cmdbuf(VkCommandPool pool, VkCommandBuffer buf);
36 void vku_begin_cmdbuf(VkCommandBuffer buf, unsigned int flags);
37 void vku_end_cmdbuf(VkCommandBuffer buf);
38 void vku_reset_cmdbuf(VkCommandBuffer buf);
40 void vku_submit_cmdbuf(VkQueue q, VkCommandBuffer buf, VkFence done_fence);
43 VkSwapchainKHR vku_create_swapchain(VkSurfaceKHR surf, int xsz, int ysz, int n,
44 VkPresentModeKHR pmode, VkSwapchainKHR prev);
45 VkImage *vku_get_swapchain_images(VkSwapchainKHR sc, int *count);
46 int vku_get_next_image(VkSwapchainKHR sc);
47 void vku_present(VkSwapchainKHR sc, int img_idx);
50 vku_buffer *vku_create_buffer(int sz, unsigned int usage);
51 void vku_destroy_buffer(vku_buffer *buf);
53 void vku_cmd_copybuf(VkCommandBuffer cmdbuf, VkBuffer dest, int doffs,
54 VkBuffer src, int soffs, int size);
57 const char *vku_get_vulkan_error_str(VkResult error);