Debian Codegraph @

Source/Core/VideoBackends/Software/SWTexture.h

raw symbols SCIP
1 // Copyright 2017 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include <memory>
7 #include <vector>
8
9 #include "Common/CommonTypes.h"
10
11 #include "VideoCommon/AbstractFramebuffer.h"
12 #include "VideoCommon/AbstractStagingTexture.h"
13 #include "VideoCommon/AbstractTexture.h"
14
15 namespace SW
16 {
17 class SWTexture final : public AbstractTexture
18 {
19 public:
20 explicit SWTexture(const TextureConfig& tex_config);
21 ~SWTexture() override = default;
22
23 void CopyRectangleFromTexture(const AbstractTexture* src,
24 const MathUtil::Rectangle<int>& src_rect, u32 src_layer,
25 u32 src_level, const MathUtil::Rectangle<int>& dst_rect,
26 u32 dst_layer, u32 dst_level) override;
27 void ResolveFromTexture(const AbstractTexture* src, const MathUtil::Rectangle<int>& rect,
28 u32 layer, u32 level) override;
29 void Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer, size_t buffer_size,
30 u32 layer) override;
31
32 const u8* GetData(u32 layer, u32 level) const;
33 u8* GetData(u32 layer, u32 level);
34
35 private:
36 std::vector<std::vector<std::vector<u8>>> m_data;
37 };
38
39 class SWStagingTexture final : public AbstractStagingTexture
40 {
41 public:
42 explicit SWStagingTexture(StagingTextureType type, const TextureConfig& config);
43 ~SWStagingTexture() override;
44
45 void CopyFromTexture(const AbstractTexture* src, const MathUtil::Rectangle<int>& src_rect,
46 u32 src_layer, u32 src_level,
47 const MathUtil::Rectangle<int>& dst_rect) override;
48 void CopyToTexture(const MathUtil::Rectangle<int>& src_rect, AbstractTexture* dst,
49 const MathUtil::Rectangle<int>& dst_rect, u32 dst_layer,
50 u32 dst_level) override;
51
52 bool Map() override;
53 void Unmap() override;
54 void Flush() override;
55
56 void SetMapStride(size_t stride) { m_map_stride = stride; }
57
58 private:
59 std::vector<u8> m_data;
60 };
61
62 class SWFramebuffer final : public AbstractFramebuffer
63 {
64 public:
65 explicit SWFramebuffer(AbstractTexture* color_attachment, AbstractTexture* depth_attachment,
66 std::vector<AbstractTexture*> additional_color_attachments,
67 AbstractTextureFormat color_format, AbstractTextureFormat depth_format,
68 u32 width, u32 height, u32 layers, u32 samples);
69 ~SWFramebuffer() override = default;
70
71 static std::unique_ptr<SWFramebuffer>
72 Create(SWTexture* color_attachment, SWTexture* depth_attachment,
73 std::vector<AbstractTexture*> additional_color_attachments);
74 };
75
76 } // namespace SW