vulkan_test2

annotate src/vku.h @ 9:5fbfd7f8fc24

minor
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 22 Jun 2018 02:40:22 +0300
parents 1dd2c7398afc
children e17abe477616
rev   line source
nuclear@3 1 #ifndef VKU_H_
nuclear@3 2 #define VKU_H_
nuclear@3 3
nuclear@4 4 #ifdef __unix__
nuclear@4 5 #define VK_USE_PLATFORM_XLIB_KHR
nuclear@4 6 #endif
nuclear@4 7
nuclear@3 8 #include <vulkan/vulkan.h>
nuclear@3 9
nuclear@3 10 VkInstance vk;
nuclear@3 11 VkDevice vkdev;
nuclear@3 12 VkQueue vkq;
nuclear@3 13 VkCommandPool vkcmdpool;
nuclear@4 14 VkCommandBuffer vkcmdbuf; /* primary command buffer */
nuclear@3 15
nuclear@7 16 VkImage *swapchain_images;
nuclear@7 17 int next_swapchain_image;
nuclear@7 18
nuclear@7 19
nuclear@4 20 struct vku_buffer {
nuclear@3 21 VkBuffer buf;
nuclear@3 22 VkDeviceMemory mem_pool;
nuclear@3 23 int mem_start, mem_size;
nuclear@3 24 };
nuclear@3 25
nuclear@4 26 int vku_have_extension(const char *name);
nuclear@4 27 int vku_have_device_extension(const char *name);
nuclear@4 28
nuclear@3 29 int vku_create_dev(void);
nuclear@3 30 void vku_cleanup(void);
nuclear@3 31
nuclear@4 32 VkCommandBuffer vku_alloc_cmdbuf(VkCommandPool pool, VkCommandBufferLevel level);
nuclear@4 33 void vku_free_cmdbuf(VkCommandPool pool, VkCommandBuffer buf);
nuclear@3 34
nuclear@4 35 void vku_begin_cmdbuf(VkCommandBuffer buf, unsigned int flags);
nuclear@4 36 void vku_end_cmdbuf(VkCommandBuffer buf);
nuclear@4 37 void vku_reset_cmdbuf(VkCommandBuffer buf);
nuclear@4 38
nuclear@4 39 void vku_submit_cmdbuf(VkQueue q, VkCommandBuffer buf, VkFence done_fence);
nuclear@4 40
nuclear@5 41 VkSwapchainKHR vku_create_swapchain(VkSurfaceKHR surf, int xsz, int ysz, int n,
nuclear@5 42 VkPresentModeKHR pmode, VkSwapchainKHR prev);
nuclear@6 43 VkImage *vku_get_swapchain_images(VkSwapchainKHR sc, int *count);
nuclear@6 44 int vku_get_next_image(VkSwapchainKHR sc);
nuclear@6 45 void vku_present(VkSwapchainKHR sc, int img_idx);
nuclear@5 46
nuclear@4 47 struct vku_buffer *vku_create_buffer(int sz, unsigned int usage);
nuclear@4 48 void vku_destroy_buffer(struct vku_buffer *buf);
nuclear@4 49
nuclear@4 50 void vku_cmd_copybuf(VkCommandBuffer cmdbuf, VkBuffer dest, int doffs,
nuclear@4 51 VkBuffer src, int soffs, int size);
nuclear@4 52
nuclear@4 53 /* platform-specific */
nuclear@4 54 #ifdef VK_USE_PLATFORM_XLIB_KHR
nuclear@4 55 #include <X11/Xlib.h>
nuclear@4 56 int vku_xlib_usable_visual(Display *dpy, VisualID vid);
nuclear@5 57 VkSurfaceKHR vku_xlib_create_surface(Display *dpy, Window win);
nuclear@4 58 #endif
nuclear@3 59
nuclear@3 60 #endif /* VKU_H_ */