]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/swapchain.h
Initial implementation of Vulkan backend
[libs/gl.git] / source / backends / vulkan / swapchain.h
diff --git a/source/backends/vulkan/swapchain.h b/source/backends/vulkan/swapchain.h
new file mode 100644 (file)
index 0000000..b34b487
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef MSP_GL_VULKAN_SWAPCHAIN_H_
+#define MSP_GL_VULKAN_SWAPCHAIN_H_
+
+#include "handles.h"
+#include "swapchaintexture.h"
+
+namespace Msp {
+namespace GL {
+
+class Device;
+class Semaphore;
+
+class SwapChain
+{
+       friend class VulkanCommands;
+
+private:
+       Device &device;
+       VkSwapchain handle = 0;
+       VkSurface surface = 0;
+       unsigned width = 0;
+       unsigned height = 0;
+       std::vector<SwapChainTexture> images;
+       int current_index = -1;
+
+public:
+       SwapChain(unsigned, unsigned, unsigned);
+       ~SwapChain();
+
+       unsigned get_n_images() const { return images.size(); }
+       SwapChainTexture &get_image(unsigned i) { return images[i]; }
+
+       unsigned begin_frame(Semaphore &);
+       void present_frame(Semaphore &);
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif