Debian Codegraph @

Source/Core/VideoBackends/Software/SWmain.cpp

raw symbols SCIP
1 // Copyright 2009 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #include "VideoBackends/Software/VideoBackend.h"
5
6 #include <memory>
7 #include <string>
8 #include <utility>
9
10 #include "Common/Common.h"
11 #include "Common/CommonTypes.h"
12
13 #include "VideoBackends/Software/Clipper.h"
14 #include "VideoBackends/Software/Rasterizer.h"
15 #include "VideoBackends/Software/SWBoundingBox.h"
16 #include "VideoBackends/Software/SWEfbInterface.h"
17 #include "VideoBackends/Software/SWGfx.h"
18 #include "VideoBackends/Software/SWOGLWindow.h"
19 #include "VideoBackends/Software/SWVertexLoader.h"
20 #include "VideoBackends/Software/TextureCache.h"
21
22 #include "VideoCommon/VideoCommon.h"
23 #include "VideoCommon/VideoConfig.h"
24
25 namespace SW
26 {
27 class PerfQuery : public PerfQueryBase
28 {
29 public:
30 PerfQuery() {}
31 ~PerfQuery() override {}
32 void EnableQuery(PerfQueryGroup type) override {}
33 void DisableQuery(PerfQueryGroup type) override {}
34 void ResetQuery() override { EfbInterface::ResetPerfQuery(); }
35 u32 GetQueryResult(PerfQueryType type) override { return EfbInterface::GetPerfQueryResult(type); }
36 void FlushResults() override {}
37 bool IsFlushed() const override { return true; }
38 };
39
40 std::string VideoSoftware::GetConfigName() const
41 {
42 return CONFIG_NAME;
43 }
44
45 std::string VideoSoftware::GetDisplayName() const
46 {
47 return _trans("Software Renderer");
48 }
49
50 std::optional<std::string> VideoSoftware::GetWarningMessage() const
51 {
52 return _trans("The software renderer is significantly slower than other "
53 "backends and is only recommended for debugging purposes.\n\nDo you "
54 "really want to enable software rendering? If unsure, select 'No'.");
55 }
56
57 void VideoSoftware::InitBackendInfo(const WindowSystemInfo& wsi)
58 {
59 g_backend_info.api_type = APIType::Nothing;
60 g_backend_info.MaxTextureSize = 16384;
61 g_backend_info.bUsesLowerLeftOrigin = false;
62 g_backend_info.bSupports3DVision = false;
63 g_backend_info.bSupportsDualSourceBlend = true;
64 g_backend_info.bSupportsEarlyZ = true;
65 g_backend_info.bSupportsPrimitiveRestart = false;
66 g_backend_info.bSupportsMultithreading = false;
67 g_backend_info.bSupportsComputeShaders = false;
68 g_backend_info.bSupportsGPUTextureDecoding = false;
69 g_backend_info.bSupportsST3CTextures = false;
70 g_backend_info.bSupportsBPTCTextures = false;
71 g_backend_info.bSupportsCopyToVram = false;
72 g_backend_info.bSupportsLargePoints = false;
73 g_backend_info.bSupportsDepthReadback = false;
74 g_backend_info.bSupportsPartialDepthCopies = false;
75 g_backend_info.bSupportsFramebufferFetch = false;
76 g_backend_info.bSupportsBackgroundCompiling = false;
77 g_backend_info.bSupportsLogicOp = true;
78 g_backend_info.bSupportsShaderBinaries = false;
79 g_backend_info.bSupportsPipelineCacheData = false;
80 g_backend_info.bSupportsBBox = true;
81 g_backend_info.bSupportsCoarseDerivatives = false;
82 g_backend_info.bSupportsTextureQueryLevels = false;
83 g_backend_info.bSupportsLodBiasInSampler = false;
84 g_backend_info.bSupportsSettingObjectNames = false;
85 g_backend_info.bSupportsPartialMultisampleResolve = true;
86 g_backend_info.bSupportsDynamicVertexLoader = false;
87
88 // aamodes
89 g_backend_info.AAModes = {1};
90 }
91
92 bool VideoSoftware::Initialize(const WindowSystemInfo& wsi)
93 {
94 std::unique_ptr<SWOGLWindow> window = SWOGLWindow::Create(wsi);
95 if (!window)
96 return false;
97
98 Clipper::Init();
99 Rasterizer::Init();
100
101 return InitializeShared(std::make_unique<SWGfx>(std::move(window)),
102 std::make_unique<SWVertexLoader>(), std::make_unique<PerfQuery>(),
103 std::make_unique<SWBoundingBox>(), std::make_unique<SWEFBInterface>(),
104 std::make_unique<TextureCache>());
105 }
106
107 void VideoSoftware::Shutdown()
108 {
109 ShutdownShared();
110 }
111 } // namespace SW