RavEngine
Loading...
Searching...
No Matches
WGSwapchain.hpp
1#pragma once
2#include <RGL/Types.hpp>
3#include <RGL/Swapchain.hpp>
4#include "WGSurface.hpp"
5#include "WGTexture.hpp"
6#include <array>
7
8namespace RGL{
9 struct DeviceWG;
10 struct SwapchainWG : public ISwapchain{
11 WGPUSwapChain swapchain;
12 std::shared_ptr<SurfaceWG> surface;
13 const std::shared_ptr<DeviceWG> owningDevice;
14 SwapchainWG(decltype(surface) surface, uint32_t width, uint32_t height, const std::shared_ptr<DeviceWG> owningDevice);
15 virtual ~SwapchainWG();
16 void Resize(uint32_t width, uint32_t height) final;
17 void GetNextImage(uint32_t* index) final;
18 ITexture* ImageAtIndex(uint32_t index) final;
19 void Present(const SwapchainPresentConfig&) final;
20
21 Dimension currentSize;
22
23 std::array<TextureWG,3> activeTextures;
24 uint32_t idx = 0;
25
26 void SetVsyncMode(bool mode) final;
27 private:
28 WGPUSwapChain makeSwapchain(uint32_t width, uint32_t height);
29 bool vsync = true;
30 };
31}
Definition Texture.hpp:168
Definition Texture.hpp:25
Definition Swapchain.hpp:11
Definition Swapchain.hpp:8
Definition WGSwapchain.hpp:10