RavEngine
Loading...
Searching...
No Matches
D3D12Swapchain.hpp
1#pragma once
2#include <RGL/Types.hpp>
3#include <RGL/Swapchain.hpp>
4#include "D3D12DynamicDescriptorHeap.hpp"
5#include "RGLD3D12.hpp"
6#include <directx/d3d12.h>
7#include <dxgi1_5.h>
8
9namespace RGL {
10 struct DeviceD3D12;
11 struct SurfaceD3D12;
12 struct TextureD3D12;
13 struct CommandQueueD3D12;
14
15 struct SwapchainD3D12 : public ISwapchain {
16 constexpr static uint8_t g_NumFrames = 3;
17
18 Microsoft::WRL::ComPtr<IDXGISwapChain4> swapchain;
19 const std::shared_ptr<DeviceD3D12> owningDevice;
20 Microsoft::WRL::ComPtr<ID3D12Resource> backbuffers[g_NumFrames];
21 std::vector<TextureD3D12> backbufferTextures;
22 D3D12DynamicDescriptorHeap<0>::index_t rtvIndices[g_NumFrames];
23
24 bool tearingSupported = false;
25 bool initialized = false;
26
27 SwapchainD3D12(decltype(owningDevice), std::shared_ptr<SurfaceD3D12>, int width, int height, std::shared_ptr<CommandQueueD3D12> presentQueue);
28 void UpdateRenderTargetViews(Microsoft::WRL::ComPtr<ID3D12Device2> device,
29 Microsoft::WRL::ComPtr<IDXGISwapChain4> swapChain, D3D12DynamicDescriptorHeap<2048>& descriptorHeap);
30
31
32
33 // ISwapchain
34 void Resize(uint32_t width, uint32_t height) final;
35 void GetNextImage(uint32_t* index) final;
36 ITexture* ImageAtIndex(uint32_t index) final;
37 void Present(const SwapchainPresentConfig&) final;
38 void SetVsyncMode(bool mode) final;
39 virtual ~SwapchainD3D12();
40 private:
41 bool vsync = true;
42 };
43}
Definition Texture.hpp:168
Definition D3D12DynamicDescriptorHeap.hpp:11
Definition Swapchain.hpp:11
Definition D3D12Swapchain.hpp:15
Definition Swapchain.hpp:8