Debian Codegraph @

Source/Core/VideoCommon/AbstractFramebuffer.h

raw symbols SCIP
1 // Copyright 2018 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include <vector>
7
8 #include "Common/CommonTypes.h"
9 #include "Common/MathUtil.h"
10 #include "VideoCommon/TextureConfig.h"
11
12 class AbstractTexture;
13
14 // An abstract framebuffer wraps a backend framebuffer/view object, which can be used to
15 // draw onto a texture. Currently, only single-level textures are supported. Multi-layer
16 // textures will render by default only to the first layer, however, multiple layers
17 // be rendered in parallel using geometry shaders and layer variable.
18
19 class AbstractFramebuffer
20 {
21 public:
22 AbstractFramebuffer(AbstractTexture* color_attachment, AbstractTexture* depth_attachment,
23 std::vector<AbstractTexture*> additional_color_attachments,
24 AbstractTextureFormat color_format, AbstractTextureFormat depth_format,
25 u32 width, u32 height, u32 layers, u32 samples);
26 virtual ~AbstractFramebuffer();
27
28 static bool ValidateConfig(const AbstractTexture* color_attachment,
29 const AbstractTexture* depth_attachment,
30 const std::vector<AbstractTexture*>& additional_color_attachments);
31
32 AbstractTexture* GetColorAttachment() const { return m_color_attachment; }
33 AbstractTexture* GetDepthAttachment() const { return m_depth_attachment; }
34 AbstractTextureFormat GetColorFormat() const { return m_color_format; }
35 AbstractTextureFormat GetDepthFormat() const { return m_depth_format; }
36 bool HasColorBuffer() const { return m_color_format != AbstractTextureFormat::Undefined; }
37 bool HasDepthBuffer() const { return m_depth_format != AbstractTextureFormat::Undefined; }
38 u32 GetWidth() const { return m_width; }
39 u32 GetHeight() const { return m_height; }
40 u32 GetLayers() const { return m_layers; }
41 u32 GetSamples() const { return m_samples; }
42 MathUtil::Rectangle<int> GetRect() const;
43
44 protected:
45 AbstractTexture* m_color_attachment;
46 AbstractTexture* m_depth_attachment;
47 std::vector<AbstractTexture*> m_additional_color_attachments;
48 AbstractTextureFormat m_color_format;
49 AbstractTextureFormat m_depth_format;
50 u32 m_width;
51 u32 m_height;
52 u32 m_layers;
53 u32 m_samples;
54 };