19 #include <vulkan/vulkan.h>
21 #include "VulkanTools.h"
24 #include "VulkanAndroid.h"
28 #include <sys/utsname.h>
31 typedef struct _SwapChainBuffers {
39 vks::Context *_context {
nullptr};
42 VkExtent2D extent{0, 0};
44 VkColorSpaceKHR colorSpace;
45 VkSwapchainKHR swapChain = VK_NULL_HANDLE;
47 std::vector<VkImage> images;
48 std::vector<SwapChainBuffer> buffers;
49 uint32_t queueNodeIndex = UINT32_MAX;
51 #if defined(VK_USE_PLATFORM_WIN32_KHR)
52 void initSurface(
void* platformHandle,
void* platformWindow);
53 #elif defined(VK_USE_PLATFORM_ANDROID_KHR)
54 void initSurface(ANativeWindow* window);
55 #elif defined(VK_USE_PLATFORM_DIRECTFB_EXT)
56 void initSurface(IDirectFB* dfb, IDirectFBSurface* window);
57 #elif defined(VK_USE_PLATFORM_WAYLAND_KHR)
58 void initSurface(wl_display* display, wl_surface* window);
59 #elif defined(VK_USE_PLATFORM_XCB_KHR)
60 void initSurface(xcb_connection_t* connection, xcb_window_t window);
61 #elif (defined(VK_USE_PLATFORM_IOS_MVK) || defined(VK_USE_PLATFORM_MACOS_MVK))
62 void initSurface(
void* view);
63 #elif defined(VK_USE_PLATFORM_METAL_EXT)
64 void initSurface(CAMetalLayer* metalLayer);
65 #elif (defined(_DIRECT2DISPLAY) || defined(VK_USE_PLATFORM_HEADLESS_EXT))
66 void initSurface(uint32_t width, uint32_t height);
67 #if defined(_DIRECT2DISPLAY)
68 void createDirect2DisplaySurface(uint32_t width, uint32_t height);
70 #elif defined(VK_USE_PLATFORM_SCREEN_QNX)
71 void initSurface(screen_context_t screen_context, screen_window_t screen_window);
74 void setContext(vks::Context *context);
82 void create(uint32_t* width, uint32_t* height,
bool vsync =
false,
bool fullscreen =
false);
93 VkResult acquireNextImage(VkSemaphore presentCompleteSemaphore, uint32_t* imageIndex);
103 VkResult queuePresent(VkQueue queue, uint32_t imageIndex, VkSemaphore waitSemaphore = VK_NULL_HANDLE);