Pyrogenesis
trunk
source
renderer
backend
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
"
22
#include "
renderer/backend/IDeviceObject.h
"
23
24
namespace
Renderer
25
{
26
27
namespace
Backend
28
{
29
30
class
ITexture;
31
32
/**
33
* Load operation is set for each attachment, what should be done with its
34
* content on BeginFramebufferPass.
35
*/
36
enum class
AttachmentLoadOp
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.
44
DONT_CARE
45
};
46
47
/**
48
* Store operation is set for each attachment, what should be done with its
49
* content on EndFramebufferPass.
50
*/
51
enum class
AttachmentStoreOp
52
{
53
// Stores the attachment content.
54
STORE
,
55
// After EndFramebufferPass the attachment content is undefined.
56
DONT_CARE
57
};
58
59
struct
SColorAttachment
60
{
61
ITexture
* texture =
nullptr
;
62
AttachmentLoadOp
loadOp =
AttachmentLoadOp::DONT_CARE
;
63
AttachmentStoreOp
storeOp =
AttachmentStoreOp::DONT_CARE
;
64
CColor
clearColor
;
65
};
66
67
struct
SDepthStencilAttachment
68
{
69
ITexture
* texture =
nullptr
;
70
AttachmentLoadOp
loadOp =
AttachmentLoadOp::DONT_CARE
;
71
AttachmentStoreOp
storeOp =
AttachmentStoreOp::DONT_CARE
;
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
*/
84
class
IFramebuffer
:
public
IDeviceObject
<IFramebuffer>
85
{
86
public
:
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
Renderer::Backend::AttachmentLoadOp
AttachmentLoadOp
Load operation is set for each attachment, what should be done with its content on BeginFramebufferPa...
Definition:
IFramebuffer.h:36
Renderer::Backend::ITexture
Definition:
ITexture.h:33
Renderer::Backend::AttachmentStoreOp
AttachmentStoreOp
Store operation is set for each attachment, what should be done with its content on EndFramebufferPas...
Definition:
IFramebuffer.h:51
Renderer::Backend::SColorAttachment::clearColor
CColor clearColor
Definition:
IFramebuffer.h:64
CColor
Definition:
Color.h:42
Renderer::Backend::AttachmentLoadOp::CLEAR
Renderer::Backend::SDepthStencilAttachment
Definition:
IFramebuffer.h:67
Renderer::Backend::Backend
Backend
Definition:
Backend.h:27
Renderer::Backend::AttachmentLoadOp::DONT_CARE
IDeviceObject.h
Color.h
uint32_t
unsigned int uint32_t
Definition:
wposix_types.h:53
Renderer
Definition:
VideoMode.h:28
Renderer::Backend::IDeviceObject
Definition:
IDeviceObject.h:32
Renderer::Backend::AttachmentStoreOp::STORE
Renderer::Backend::AttachmentLoadOp::LOAD
Renderer::Backend::SColorAttachment
Definition:
IFramebuffer.h:59
Renderer::Backend::IFramebuffer
IFramebuffer stores attachments which should be used by backend as rendering destinations.
Definition:
IFramebuffer.h:84
Generated by
1.8.13