summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/AbstractFramebuffer.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2023-06-09 13:40:21 +0200
committerGitHub <noreply@github.com>2023-06-09 13:40:21 +0200
commit092773ad0cd31cb0f3d111254e4e0bdb24f2c795 (patch)
tree817b91a21f01b8fdeacfdbc084f5aa6b9bad312b /Source/Core/VideoCommon/AbstractFramebuffer.cpp
parente16791f2ca5b6db29a54bc3b189d168632e4974b (diff)
parent8c3dc5b0d69bbe8a11b9cb0499f25f1164176f7c (diff)
Merge pull request #11859 from iwubcode/backend-multi-output
VideoBackends: add support to allow rendering to multiple output targets
Diffstat (limited to 'Source/Core/VideoCommon/AbstractFramebuffer.cpp')
-rw-r--r--Source/Core/VideoCommon/AbstractFramebuffer.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/AbstractFramebuffer.cpp b/Source/Core/VideoCommon/AbstractFramebuffer.cpp
index 982357e691..beb6c6752b 100644
--- a/Source/Core/VideoCommon/AbstractFramebuffer.cpp
+++ b/Source/Core/VideoCommon/AbstractFramebuffer.cpp
@@ -6,10 +6,12 @@
AbstractFramebuffer::AbstractFramebuffer(AbstractTexture* color_attachment,
AbstractTexture* depth_attachment,
+ std::vector<AbstractTexture*> additional_color_attachments,
AbstractTextureFormat color_format,
AbstractTextureFormat depth_format, u32 width, u32 height,
u32 layers, u32 samples)
: m_color_attachment(color_attachment), m_depth_attachment(depth_attachment),
+ m_additional_color_attachments(std::move(additional_color_attachments)),
m_color_format(color_format), m_depth_format(depth_format), m_width(width), m_height(height),
m_layers(layers), m_samples(samples)
{
@@ -17,13 +19,18 @@ AbstractFramebuffer::AbstractFramebuffer(AbstractTexture* color_attachment,
AbstractFramebuffer::~AbstractFramebuffer() = default;
-bool AbstractFramebuffer::ValidateConfig(const AbstractTexture* color_attachment,
- const AbstractTexture* depth_attachment)
+bool AbstractFramebuffer::ValidateConfig(
+ const AbstractTexture* color_attachment, const AbstractTexture* depth_attachment,
+ const std::vector<AbstractTexture*>& additional_color_attachments)
{
// Must have at least a color or depth attachment.
if (!color_attachment && !depth_attachment)
return false;
+ // Must have a color attachment if additional color attachments are defined
+ if (!color_attachment && !additional_color_attachments.empty())
+ return false;
+
// Currently we only expose a single mip level for render target textures.
// MSAA textures are not supported with mip levels on most backends, and it simplifies our
// handling of framebuffers.
@@ -36,6 +43,14 @@ bool AbstractFramebuffer::ValidateConfig(const AbstractTexture* color_attachment
return false;
}
+ for (auto* attachment : additional_color_attachments)
+ {
+ if (!CheckAttachment(attachment))
+ {
+ return false;
+ }
+ }
+
// If both color and depth are present, their attributes must match.
if (color_attachment && depth_attachment)
{
@@ -48,6 +63,16 @@ bool AbstractFramebuffer::ValidateConfig(const AbstractTexture* color_attachment
}
}
+ for (auto* attachment : additional_color_attachments)
+ {
+ if (color_attachment->GetConfig().width != attachment->GetConfig().width ||
+ color_attachment->GetConfig().height != attachment->GetConfig().height ||
+ color_attachment->GetConfig().samples != attachment->GetConfig().samples)
+ {
+ return false;
+ }
+ }
+
return true;
}