]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/windowview_backend.h
Initial implementation of Vulkan backend
[libs/gl.git] / source / backends / vulkan / windowview_backend.h
diff --git a/source/backends/vulkan/windowview_backend.h b/source/backends/vulkan/windowview_backend.h
new file mode 100644 (file)
index 0000000..1d42374
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef MSP_GL_WINDOWVIEW_BACKEND_H_
+#define MSP_GL_WINDOWVIEW_BACKEND_H_
+
+#include "device.h"
+#include "framebuffer.h"
+#include "semaphore.h"
+#include "swapchain.h"
+#include "view.h"
+
+namespace Msp {
+namespace GL {
+
+class VulkanWindowView: public View
+{
+protected:
+       SwapChain *swap_chain = 0;
+       std::vector<Framebuffer> framebuffers;
+       Framebuffer *current_target = 0;
+       Semaphore semaphores[MAX_FRAMES_IN_FLIGHT*2];
+       unsigned frame_index = 0;
+
+       VulkanWindowView() = default;
+       ~VulkanWindowView();
+
+       virtual void render();
+       virtual const Framebuffer &get_target() const { return *current_target; }
+
+       void resize_framebuffer(unsigned, unsigned);
+};
+
+using WindowViewBackend = VulkanWindowView;
+
+} // namespace GL
+} // namespace Msp
+
+#endif