2015-05-24 06:55:12 +02:00
|
|
|
// Copyright 2009 Dolphin Emulator Project
|
2021-07-05 03:22:19 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2010-06-09 03:37:08 +02:00
|
|
|
|
2021-12-10 03:22:16 +01:00
|
|
|
#include "VideoBackends/Software/VideoBackend.h"
|
|
|
|
|
2017-09-09 21:52:35 +02:00
|
|
|
#include <cstring>
|
2015-10-09 20:50:36 +02:00
|
|
|
#include <memory>
|
2014-03-12 20:33:41 +01:00
|
|
|
#include <string>
|
2017-02-03 18:31:20 +01:00
|
|
|
#include <utility>
|
2014-03-12 20:33:41 +01:00
|
|
|
|
2018-06-30 10:53:24 +02:00
|
|
|
#include "Common/Common.h"
|
2014-09-08 03:06:58 +02:00
|
|
|
#include "Common/CommonTypes.h"
|
2018-10-03 15:02:45 +02:00
|
|
|
#include "Common/GL/GLContext.h"
|
2019-02-15 02:59:50 +01:00
|
|
|
#include "Common/MsgHandler.h"
|
2014-02-17 11:18:15 +01:00
|
|
|
|
|
|
|
#include "VideoBackends/Software/Clipper.h"
|
|
|
|
#include "VideoBackends/Software/EfbInterface.h"
|
|
|
|
#include "VideoBackends/Software/Rasterizer.h"
|
2023-01-27 03:07:05 +01:00
|
|
|
#include "VideoBackends/Software/SWBoundingBox.h"
|
|
|
|
#include "VideoBackends/Software/SWGfx.h"
|
2015-09-26 10:07:48 +02:00
|
|
|
#include "VideoBackends/Software/SWOGLWindow.h"
|
2014-02-19 12:14:09 +01:00
|
|
|
#include "VideoBackends/Software/SWRenderer.h"
|
2017-04-23 06:44:34 +02:00
|
|
|
#include "VideoBackends/Software/SWTexture.h"
|
2014-02-17 11:18:15 +01:00
|
|
|
#include "VideoBackends/Software/SWVertexLoader.h"
|
2017-05-30 00:02:09 +02:00
|
|
|
#include "VideoBackends/Software/TextureCache.h"
|
2014-02-17 11:18:15 +01:00
|
|
|
|
2019-02-15 02:59:50 +01:00
|
|
|
#include "VideoCommon/FramebufferManager.h"
|
2023-01-27 03:07:05 +01:00
|
|
|
#include "VideoCommon/Present.h"
|
2015-10-09 20:50:36 +02:00
|
|
|
#include "VideoCommon/TextureCacheBase.h"
|
2016-07-22 01:04:57 +02:00
|
|
|
#include "VideoCommon/VideoCommon.h"
|
2015-10-09 20:50:36 +02:00
|
|
|
#include "VideoCommon/VideoConfig.h"
|
2010-06-09 03:37:08 +02:00
|
|
|
|
2011-01-31 02:28:32 +01:00
|
|
|
namespace SW
|
2009-10-12 02:48:24 +02:00
|
|
|
{
|
2015-10-09 20:50:36 +02:00
|
|
|
class PerfQuery : public PerfQueryBase
|
2009-10-12 02:48:24 +02:00
|
|
|
{
|
2015-10-09 20:50:36 +02:00
|
|
|
public:
|
|
|
|
PerfQuery() {}
|
|
|
|
~PerfQuery() {}
|
|
|
|
void EnableQuery(PerfQueryGroup type) override {}
|
|
|
|
void DisableQuery(PerfQueryGroup type) override {}
|
2018-05-18 21:13:03 +02:00
|
|
|
void ResetQuery() override { EfbInterface::ResetPerfQuery(); }
|
|
|
|
u32 GetQueryResult(PerfQueryType type) override { return EfbInterface::GetPerfQueryResult(type); }
|
2015-10-09 20:50:36 +02:00
|
|
|
void FlushResults() override {}
|
2017-07-30 21:56:12 +02:00
|
|
|
bool IsFlushed() const override { return true; }
|
2015-10-09 20:50:36 +02:00
|
|
|
};
|
2010-06-09 03:37:08 +02:00
|
|
|
|
2015-10-09 20:50:36 +02:00
|
|
|
std::string VideoSoftware::GetName() const
|
2013-02-26 16:42:32 +01:00
|
|
|
{
|
2020-09-06 12:56:45 +02:00
|
|
|
return NAME;
|
2013-02-26 16:42:32 +01:00
|
|
|
}
|
|
|
|
|
2015-10-09 20:50:36 +02:00
|
|
|
std::string VideoSoftware::GetDisplayName() const
|
2012-12-17 21:54:20 +01:00
|
|
|
{
|
2018-06-30 10:53:24 +02:00
|
|
|
return _trans("Software Renderer");
|
2009-10-12 02:48:24 +02:00
|
|
|
}
|
2010-06-09 03:37:08 +02:00
|
|
|
|
2019-07-21 00:57:50 +02:00
|
|
|
std::optional<std::string> VideoSoftware::GetWarningMessage() const
|
|
|
|
{
|
|
|
|
return _trans("The software renderer is significantly slower than other "
|
|
|
|
"backends and is only recommended for debugging purposes.\n\nDo you "
|
|
|
|
"really want to enable software rendering? If unsure, select 'No'.");
|
|
|
|
}
|
|
|
|
|
2023-03-26 01:16:53 +01:00
|
|
|
void VideoSoftware::InitBackendInfo(const WindowSystemInfo& wsi)
|
2009-10-12 02:48:24 +02:00
|
|
|
{
|
2016-07-22 01:04:57 +02:00
|
|
|
g_Config.backend_info.api_type = APIType::Nothing;
|
2017-03-09 15:01:23 +01:00
|
|
|
g_Config.backend_info.MaxTextureSize = 16384;
|
2019-02-15 02:59:50 +01:00
|
|
|
g_Config.backend_info.bUsesLowerLeftOrigin = false;
|
2015-10-09 20:50:36 +02:00
|
|
|
g_Config.backend_info.bSupports3DVision = false;
|
|
|
|
g_Config.backend_info.bSupportsDualSourceBlend = true;
|
|
|
|
g_Config.backend_info.bSupportsEarlyZ = true;
|
|
|
|
g_Config.backend_info.bSupportsPrimitiveRestart = false;
|
2016-08-13 14:08:46 +02:00
|
|
|
g_Config.backend_info.bSupportsMultithreading = false;
|
2016-11-27 09:14:55 +01:00
|
|
|
g_Config.backend_info.bSupportsComputeShaders = false;
|
2016-11-27 09:14:57 +01:00
|
|
|
g_Config.backend_info.bSupportsGPUTextureDecoding = false;
|
2017-04-16 11:30:11 +02:00
|
|
|
g_Config.backend_info.bSupportsST3CTextures = false;
|
2017-07-27 14:00:04 +02:00
|
|
|
g_Config.backend_info.bSupportsBPTCTextures = false;
|
2017-05-30 00:02:09 +02:00
|
|
|
g_Config.backend_info.bSupportsCopyToVram = false;
|
2019-02-15 02:59:50 +01:00
|
|
|
g_Config.backend_info.bSupportsLargePoints = false;
|
2020-05-24 08:11:10 +02:00
|
|
|
g_Config.backend_info.bSupportsDepthReadback = false;
|
2019-03-02 06:03:49 +01:00
|
|
|
g_Config.backend_info.bSupportsPartialDepthCopies = false;
|
2017-10-26 07:44:39 +02:00
|
|
|
g_Config.backend_info.bSupportsFramebufferFetch = false;
|
2018-02-25 08:56:09 +01:00
|
|
|
g_Config.backend_info.bSupportsBackgroundCompiling = false;
|
2018-05-25 16:04:18 +02:00
|
|
|
g_Config.backend_info.bSupportsLogicOp = true;
|
2019-04-15 13:55:26 +02:00
|
|
|
g_Config.backend_info.bSupportsShaderBinaries = false;
|
|
|
|
g_Config.backend_info.bSupportsPipelineCacheData = false;
|
2021-06-09 13:42:21 +02:00
|
|
|
g_Config.backend_info.bSupportsBBox = true;
|
2021-11-14 05:10:20 +01:00
|
|
|
g_Config.backend_info.bSupportsCoarseDerivatives = false;
|
2021-11-14 05:10:55 +01:00
|
|
|
g_Config.backend_info.bSupportsTextureQueryLevels = false;
|
2021-08-07 05:26:51 +02:00
|
|
|
g_Config.backend_info.bSupportsLodBiasInSampler = false;
|
2022-01-31 03:44:57 +01:00
|
|
|
g_Config.backend_info.bSupportsSettingObjectNames = false;
|
2022-06-21 09:07:35 +02:00
|
|
|
g_Config.backend_info.bSupportsPartialMultisampleResolve = true;
|
2022-06-18 08:09:35 +02:00
|
|
|
g_Config.backend_info.bSupportsDynamicVertexLoader = false;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2015-10-09 20:50:36 +02:00
|
|
|
// aamodes
|
|
|
|
g_Config.backend_info.AAModes = {1};
|
2009-10-12 02:48:24 +02:00
|
|
|
}
|
2010-06-09 03:37:08 +02:00
|
|
|
|
2018-10-03 15:03:22 +02:00
|
|
|
bool VideoSoftware::Initialize(const WindowSystemInfo& wsi)
|
2009-10-12 02:48:24 +02:00
|
|
|
{
|
2018-10-03 15:03:26 +02:00
|
|
|
std::unique_ptr<SWOGLWindow> window = SWOGLWindow::Create(wsi);
|
|
|
|
if (!window)
|
|
|
|
return false;
|
2013-04-14 05:54:02 +02:00
|
|
|
|
2015-10-09 20:50:36 +02:00
|
|
|
Clipper::Init();
|
|
|
|
Rasterizer::Init();
|
2013-04-14 05:54:02 +02:00
|
|
|
|
2023-01-28 02:53:19 +01:00
|
|
|
return InitializeShared(std::make_unique<SWGfx>(std::move(window)),
|
|
|
|
std::make_unique<SWVertexLoader>(), std::make_unique<PerfQuery>(),
|
|
|
|
std::make_unique<SWBoundingBox>(), std::make_unique<SWRenderer>(),
|
|
|
|
std::make_unique<TextureCache>());
|
2013-02-17 00:50:40 +01:00
|
|
|
}
|
|
|
|
|
2015-10-09 20:50:36 +02:00
|
|
|
void VideoSoftware::Shutdown()
|
2014-11-13 23:26:49 +01:00
|
|
|
{
|
2018-01-26 06:09:07 +01:00
|
|
|
ShutdownShared();
|
2014-02-02 14:16:43 +01:00
|
|
|
}
|
2018-10-03 15:02:45 +02:00
|
|
|
} // namespace SW
|