|
Bicameral Engine
GPU-resident engine for a magic-research open-world game
|
#include <swap_chain.h>
Classes | |
| struct | HandleCloser |
Public Member Functions | |
| bool | WaitForFrame (uint32_t timeoutMs) const |
| uint32_t | CurrentIndex () const |
| ID3D12Resource * | BackBuffer (uint32_t index) const |
| D3D12_CPU_DESCRIPTOR_HANDLE | RenderTargetView (uint32_t index) const |
| uint32_t | Width () const |
| uint32_t | Height () const |
| bool | Present (bool vsync) const |
| bool | Resize (ID3D12Device *device, uint32_t width, uint32_t height) |
Static Public Member Functions | |
| static std::expected< SwapChain, std::string > | Create (ID3D12Device *device, IDXGIFactory6 *factory, ID3D12CommandQueue *directQueue, HWND window, uint32_t maxFrameLatency) |
Static Public Attributes | |
| static constexpr uint32_t | BUFFER_COUNT = 3 |
| static constexpr DXGI_FORMAT | FORMAT = DXGI_FORMAT_R8G8B8A8_UNORM |
Private Member Functions | |
| SwapChain ()=default | |
| bool | AcquireBuffers (ID3D12Device *device) |
Private Attributes | |
| ComPtr< IDXGISwapChain3 > | m_swapChain |
| ComPtr< ID3D12DescriptorHeap > | m_rtvHeap |
| std::array< ComPtr< ID3D12Resource >, BUFFER_COUNT > | m_buffers |
| uint32_t | m_rtvStride = 0 |
| std::unique_ptr< void, HandleCloser > | m_frameLatencyWaitable |
| uint32_t | m_width = 0 |
| uint32_t | m_height = 0 |
| bool | m_tearingSupported = false |
Definition at line 19 of file swap_chain.h.
|
privatedefault |
|
private |
Definition at line 73 of file swap_chain.cpp.
References BICAMERAL_CHECK_HR, BUFFER_COUNT, bicameral::Gpu, m_buffers, m_height, m_swapChain, m_width, and RenderTargetView().
Referenced by Create(), and Resize().
|
inlinenodiscard |
Definition at line 32 of file swap_chain.h.
References m_buffers.
|
staticnodiscard |
Definition at line 22 of file swap_chain.cpp.
References AcquireBuffers(), BUFFER_COUNT, bicameral::DescribeHresult(), FORMAT, bicameral::Gpu, bicameral::Info, bicameral::Log(), m_frameLatencyWaitable, m_height, m_rtvHeap, m_rtvStride, m_swapChain, m_tearingSupported, m_width, and SwapChain().
Referenced by bicameral::frame::anonymous_namespace{frame_loop.cpp}::CreateParts().
|
inlinenodiscard |
Definition at line 31 of file swap_chain.h.
References m_swapChain.
|
inlinenodiscard |
Definition at line 35 of file swap_chain.h.
References m_height.
| bool bicameral::gpu::SwapChain::Present | ( | bool | vsync | ) | const |
Definition at line 102 of file swap_chain.cpp.
References BICAMERAL_CHECK_HR, bicameral::Gpu, m_swapChain, and m_tearingSupported.
|
nodiscard |
Definition at line 91 of file swap_chain.cpp.
References m_rtvHeap, and m_rtvStride.
Referenced by AcquireBuffers().
| bool bicameral::gpu::SwapChain::Resize | ( | ID3D12Device * | device, |
| uint32_t | width, | ||
| uint32_t | height ) |
Definition at line 107 of file swap_chain.cpp.
References AcquireBuffers(), BICAMERAL_CHECK_HR, BUFFER_COUNT, FORMAT, bicameral::Gpu, m_buffers, m_swapChain, and m_tearingSupported.
| bool bicameral::gpu::SwapChain::WaitForFrame | ( | uint32_t | timeoutMs | ) | const |
Definition at line 98 of file swap_chain.cpp.
References m_frameLatencyWaitable.
|
inlinenodiscard |
Definition at line 34 of file swap_chain.h.
References m_width.
|
staticconstexpr |
Definition at line 21 of file swap_chain.h.
Referenced by AcquireBuffers(), Create(), and Resize().
|
staticconstexpr |
Definition at line 22 of file swap_chain.h.
Referenced by Create(), bicameral::frame::anonymous_namespace{frame_loop.cpp}::FrameLoop::CreateEditor(), bicameral::frame::anonymous_namespace{frame_loop.cpp}::CreateParts(), and Resize().
|
private |
Definition at line 55 of file swap_chain.h.
Referenced by AcquireBuffers(), BackBuffer(), and Resize().
|
private |
Definition at line 59 of file swap_chain.h.
Referenced by Create(), and WaitForFrame().
|
private |
Definition at line 63 of file swap_chain.h.
Referenced by AcquireBuffers(), Create(), and Height().
|
private |
Definition at line 54 of file swap_chain.h.
Referenced by Create(), and RenderTargetView().
|
private |
Definition at line 56 of file swap_chain.h.
Referenced by Create(), and RenderTargetView().
|
private |
Definition at line 53 of file swap_chain.h.
Referenced by AcquireBuffers(), Create(), CurrentIndex(), Present(), and Resize().
|
private |
Definition at line 64 of file swap_chain.h.
|
private |
Definition at line 62 of file swap_chain.h.
Referenced by AcquireBuffers(), Create(), and Width().