4 #include <vulkan/vulkan.h>
7 extern VkPipeline *vkgparent_pipeline;
8 extern VkDescriptorSet *vkdescset;
9 extern VkFramebuffer *vkfbufs;
10 extern VkRenderPass vkrpass;
11 extern VkInstance vkinst;
12 extern VkPhysicalDevice vkpdev;
13 extern VkDevice vkdev;
15 extern VkCommandPool vkcmdpool;
16 extern VkCommandBuffer vkcmdbuf; /* primary command buffer */
20 extern VkSurfaceKHR vksurface;
21 extern VkSwapchainKHR vkswapchain;
22 extern int vknum_swapchain_images;
23 extern VkImage *vkswapchain_images;
24 extern VkImageView *vkswapchain_views;
25 extern int vk_curr_swapchain_image;
26 extern VkSemaphore vk_img_avail_sema;
27 extern VkSemaphore vk_rend_done_sema;
31 VkDeviceMemory mem_pool;
32 int mem_start, mem_size;
36 bool vku_have_extension(const char *name);
37 bool vku_have_device_extension(const char *name);
40 bool vku_create_device();
44 bool vku_create_semaphores();
47 VkCommandBuffer vku_alloc_cmdbuf(VkCommandPool pool, VkCommandBufferLevel level);
48 void vku_free_cmdbuf(VkCommandPool pool, VkCommandBuffer buf);
50 void vku_begin_cmdbuf(VkCommandBuffer buf, unsigned int flags);
51 void vku_end_cmdbuf(VkCommandBuffer buf);
52 void vku_reset_cmdbuf(VkCommandBuffer buf);
53 void vku_submit_cmdbuf(VkQueue q, VkCommandBuffer buf, VkFence done_fence);
56 VkSwapchainKHR vku_create_swapchain(VkSurfaceKHR surf, int xsz, int ysz, int n,
57 VkPresentModeKHR pmode, VkSwapchainKHR prev);
58 VkImage *vku_get_swapchain_images(VkSwapchainKHR sc, int *count);
59 VkImageView *vku_create_image_views(VkImage *images, int count);
60 int vku_get_next_image(VkSwapchainKHR sc);
61 void vku_present(VkSwapchainKHR sc, int img_idx);
64 bool vku_create_renderpass();
67 bool vku_create_framebuffers(VkImageView *image_views, int count, int w, int h);
70 vku_buffer *vku_create_buffer(int sz, unsigned int usage);
71 void vku_destroy_buffer(vku_buffer *buf);
72 void vku_cmd_copybuf(VkCommandBuffer cmdbuf, VkBuffer dest, int doffs,
73 VkBuffer src, int soffs, int size);
76 const char *vku_get_vulkan_error_str(VkResult error);
79 bool vku_create_graphics_pipeline(VkPipelineLayout *layout);
82 //bool vku_create_descriptor_set()