summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/AbstractFramebuffer.h
diff options
context:
space:
mode:
authorStenzek <stenzek@users.noreply.github.com>2018-03-08 00:52:49 +1000
committerGitHub <noreply@github.com>2018-03-08 00:52:49 +1000
commit24a46dc6af007ba5085a0425de7a7937623eb333 (patch)
tree05f61d35ff03d15e07455c458ae2069af455264f /Source/Core/VideoCommon/AbstractFramebuffer.h
parentaee977e32a0054e6a32a750c90c941d979db9d5a (diff)
parent4c24a697106471b33973da619a43167c947276aa (diff)
Merge pull request #6315 from stenzek/abstract-framebuffers
Abstract Framebuffers
Diffstat (limited to 'Source/Core/VideoCommon/AbstractFramebuffer.h')
-rw-r--r--Source/Core/VideoCommon/AbstractFramebuffer.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/AbstractFramebuffer.h b/Source/Core/VideoCommon/AbstractFramebuffer.h
new file mode 100644
index 0000000000..9d4b2d29cd
--- /dev/null
+++ b/Source/Core/VideoCommon/AbstractFramebuffer.h
@@ -0,0 +1,45 @@
+// Copyright 2018 Dolphin Emulator Project
+// Licensed under GPLv2+
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "Common/CommonTypes.h"
+#include "Common/MathUtil.h"
+#include "VideoCommon/TextureConfig.h"
+
+class AbstractTexture;
+
+// An abstract framebuffer wraps a backend framebuffer/view object, which can be used to
+// draw onto a texture. Currently, only single-level textures are supported. Multi-layer
+// textures will render by default only to the first layer, however, multiple layers
+// be rendered in parallel using geometry shaders and layer variable.
+
+class AbstractFramebuffer
+{
+public:
+ AbstractFramebuffer(AbstractTextureFormat color_format, AbstractTextureFormat depth_format,
+ u32 width, u32 height, u32 layers, u32 samples);
+ virtual ~AbstractFramebuffer();
+
+ static bool ValidateConfig(const AbstractTexture* color_attachment,
+ const AbstractTexture* depth_attachment);
+
+ AbstractTextureFormat GetColorFormat() const { return m_color_format; }
+ AbstractTextureFormat GetDepthFormat() const { return m_depth_format; }
+ bool HasColorBuffer() const { return m_color_format != AbstractTextureFormat::Undefined; }
+ bool HasDepthBuffer() const { return m_depth_format != AbstractTextureFormat::Undefined; }
+ u32 GetWidth() const { return m_width; }
+ u32 GetHeight() const { return m_height; }
+ u32 GetLayers() const { return m_layers; }
+ u32 GetSamples() const { return m_samples; }
+ MathUtil::Rectangle<int> GetRect() const;
+
+protected:
+ AbstractTextureFormat m_color_format;
+ AbstractTextureFormat m_depth_format;
+ u32 m_width;
+ u32 m_height;
+ u32 m_layers;
+ u32 m_samples;
+};