RavEngine
Loading...
Searching...
No Matches
VkSwapchain.hpp
1#pragma once
2#include <RGL/Types.hpp>
3#include <RGL/Swapchain.hpp>
4#include "VkDevice.hpp"
5#include "VkSurface.hpp"
6#include "VkTexture.hpp"
7#include <vector>
8
9namespace RGL {
10 struct SwapchainVK : public ISwapchain {
11 std::shared_ptr<RGL::DeviceVk> owningDevice;
12 std::shared_ptr<SurfaceVk> owningSurface;
13 VkSwapchainKHR swapChain = VK_NULL_HANDLE;
14 VkSemaphore imageAvailableSemaphore = VK_NULL_HANDLE, renderCompleteSemaphore = VK_NULL_HANDLE;
15 std::vector<VkImage> swapChainImages;
16 std::vector<VkImageView> swapChainImageViews;
17 std::vector<TextureVk> RGLTextureResources;
18 VkExtent2D swapChainExtent;
19 VkFormat swapChainImageFormat;
20
21 virtual ~SwapchainVK();
22 SwapchainVK(decltype(owningSurface), decltype(owningDevice), int width, int height);
23 void Resize(uint32_t, uint32_t) final;
24 void GetNextImage(uint32_t* index) final;
25 ITexture* ImageAtIndex(uint32_t index) final {
26 return &(RGLTextureResources[index]);
27 }
28
29 void Present(const SwapchainPresentConfig&) final;
30
31 void SetVsyncMode(bool mode) final;
32
33 private:
34 bool vsync = true;
35 void DestroySwapchainIfNeeded();
36 };
37}
Definition Texture.hpp:168
Definition Swapchain.hpp:11
Definition Swapchain.hpp:8
Definition VkSwapchain.hpp:10