Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
SwapChain.h
Go to the documentation of this file.
1/* Copyright (C) 2026 Wildfire Games.
2 * This file is part of 0 A.D.
3 *
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef INCLUDED_RENDERER_BACKEND_DUMMY_SWAPCHAIN
19#define INCLUDED_RENDERER_BACKEND_DUMMY_SWAPCHAIN
20
22
23#include <cstdint>
24#include <memory>
25
26namespace Renderer
27{
28
29namespace Backend
30{
31
32namespace Dummy
33{
34
35class CDevice;
36
37class CSwapChain : public ISwapChain
38{
39public:
40 ~CSwapChain() override;
41
42 IDevice* GetDevice() override;
43
44 bool IsValid() const override { return true; }
45
46 bool AcquireNextBackbuffer() override;
47
49 const AttachmentLoadOp colorAttachmentLoadOp,
50 const AttachmentStoreOp colorAttachmentStoreOp,
51 const AttachmentLoadOp depthStencilAttachmentLoadOp,
52 const AttachmentStoreOp depthStencilAttachmentStoreOp) override;
53
54 void Present() override;
55
56private:
57 friend class CDevice;
58
59 static std::unique_ptr<ISwapChain> Create(CDevice* device);
60
62
63 CDevice* m_Device{nullptr};
64
65 std::unique_ptr<IFramebuffer> m_Backbuffer;
66};
67
68} // namespace Dummy
69
70} // namespace Backend
71
72} // namespace Renderer
73
74#endif // INCLUDED_RENDERER_BACKEND_DUMMY_SWAPCHAIN
Definition: Device.h:46
Definition: SwapChain.h:38
IDevice * GetDevice() override
Definition: SwapChain.cpp:48
bool IsValid() const override
Definition: SwapChain.h:44
static std::unique_ptr< ISwapChain > Create(CDevice *device)
Definition: SwapChain.cpp:35
CDevice * m_Device
Definition: SwapChain.h:63
bool AcquireNextBackbuffer() override
Acquires a backbuffer for rendering a frame.
Definition: SwapChain.cpp:53
void Present() override
Presents the backbuffer to the swapchain queue to be flipped on a screen.
Definition: SwapChain.cpp:66
IFramebuffer * GetCurrentBackbuffer(const AttachmentLoadOp colorAttachmentLoadOp, const AttachmentStoreOp colorAttachmentStoreOp, const AttachmentLoadOp depthStencilAttachmentLoadOp, const AttachmentStoreOp depthStencilAttachmentStoreOp) override
Returns a framebuffer for the current backbuffer with the required attachment operations.
Definition: SwapChain.cpp:59
std::unique_ptr< IFramebuffer > m_Backbuffer
Definition: SwapChain.h:65
Definition: IDevice.h:64
IFramebuffer stores attachments which should be used by backend as rendering destinations.
Definition: IFramebuffer.h:87
Definition: ISwapChain.h:33
AttachmentStoreOp
Store operation is set for each attachment, what should be done with its content on EndFramebufferPas...
Definition: IFramebuffer.h:54
Backend
Definition: Backend.h:28
AttachmentLoadOp
Load operation is set for each attachment, what should be done with its content on BeginFramebufferPa...
Definition: IFramebuffer.h:39
Definition: Canvas2D.h:30