Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
IFramebuffer.h
Go to the documentation of this file.
1/* Copyright (C) 2022 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_IFRAMEBUFFER
19#define INCLUDED_RENDERER_BACKEND_IFRAMEBUFFER
20
21#include "graphics/Color.h"
23
24namespace Renderer
25{
26
27namespace Backend
28{
29
30class ITexture;
31
32/**
33 * Load operation is set for each attachment, what should be done with its
34 * content on BeginFramebufferPass.
35 */
37{
38 // Loads the attachment content.
39 LOAD,
40 // Clears the attachment content without loading. Prefer to use that
41 // operation over manual ClearFramebuffer.
42 CLEAR,
43 // After BeginFramebufferPass the attachment content is undefined.
45};
46
47/**
48 * Store operation is set for each attachment, what should be done with its
49 * content on EndFramebufferPass.
50 */
52{
53 // Stores the attachment content.
54 STORE,
55 // After EndFramebufferPass the attachment content is undefined.
57};
58
60{
61 ITexture* texture = nullptr;
65};
66
68{
69 ITexture* texture = nullptr;
72};
73
74/**
75 * IFramebuffer stores attachments which should be used by backend as rendering
76 * destinations. That combining allows to set these destinations at once.
77 * IFramebuffer doesn't own its attachments so clients must keep them alive.
78 * The number of framebuffers ever created for a device during its lifetime
79 * should be as small as possible.
80 *
81 * Framebuffer is a term from OpenGL/Vulkan worlds (D3D synonym is a render
82 * target).
83 */
84class IFramebuffer : public IDeviceObject<IFramebuffer>
85{
86public:
87 /**
88 * Returns a clear color for all color attachments of the framebuffer.
89 * @see IDevice::CreateFramebuffer()
90 */
91 virtual const CColor& GetClearColor() const = 0;
92
93 virtual uint32_t GetWidth() const = 0;
94 virtual uint32_t GetHeight() const = 0;
95};
96
97} // namespace Backend
98
99} // namespace Renderer
100
101#endif // INCLUDED_RENDERER_BACKEND_IFRAMEBUFFER
Definition: IDeviceObject.h:33
IFramebuffer stores attachments which should be used by backend as rendering destinations.
Definition: IFramebuffer.h:85
virtual const CColor & GetClearColor() const =0
Returns a clear color for all color attachments of the framebuffer.
virtual uint32_t GetHeight() const =0
virtual uint32_t GetWidth() const =0
Definition: ITexture.h:34
AttachmentStoreOp
Store operation is set for each attachment, what should be done with its content on EndFramebufferPas...
Definition: IFramebuffer.h:52
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:37
Definition: VideoMode.h:29
Definition: Color.h:43
Definition: IFramebuffer.h:60
AttachmentLoadOp loadOp
Definition: IFramebuffer.h:62
CColor clearColor
Definition: IFramebuffer.h:64
ITexture * texture
Definition: IFramebuffer.h:61
AttachmentStoreOp storeOp
Definition: IFramebuffer.h:63
Definition: IFramebuffer.h:68
ITexture * texture
Definition: IFramebuffer.h:69
AttachmentLoadOp loadOp
Definition: IFramebuffer.h:70
AttachmentStoreOp storeOp
Definition: IFramebuffer.h:71
unsigned int uint32_t
Definition: wposix_types.h:53