2015-05-24 07:55:12 +03:00
|
|
|
// Copyright 2009 Dolphin Emulator Project
|
2015-05-18 02:08:10 +03:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 06:29:41 +03:00
|
|
|
// Refer to the license.txt file included.
|
2010-06-09 04:37:08 +03:00
|
|
|
|
2017-09-09 22:52:35 +03:00
|
|
|
#include <cstring>
|
2015-10-09 21:50:36 +03:00
|
|
|
#include <memory>
|
2014-03-12 21:33:41 +02:00
|
|
|
#include <string>
|
2017-02-03 19:31:20 +02:00
|
|
|
#include <utility>
|
2014-03-12 21:33:41 +02:00
|
|
|
|
2014-09-08 04:06:58 +03:00
|
|
|
#include "Common/CommonTypes.h"
|
2017-05-30 01:02:09 +03:00
|
|
|
#include "Common/GL/GLInterfaceBase.h"
|
2014-02-17 12:18:15 +02:00
|
|
|
|
|
|
|
#include "VideoBackends/Software/Clipper.h"
|
|
|
|
#include "VideoBackends/Software/DebugUtil.h"
|
|
|
|
#include "VideoBackends/Software/EfbInterface.h"
|
|
|
|
#include "VideoBackends/Software/Rasterizer.h"
|
2015-09-26 11:07:48 +03:00
|
|
|
#include "VideoBackends/Software/SWOGLWindow.h"
|
2014-02-19 13:14:09 +02:00
|
|
|
#include "VideoBackends/Software/SWRenderer.h"
|
2017-04-23 07:44:34 +03:00
|
|
|
#include "VideoBackends/Software/SWTexture.h"
|
2014-02-17 12:18:15 +02:00
|
|
|
#include "VideoBackends/Software/SWVertexLoader.h"
|
2017-05-30 01:02:09 +03:00
|
|
|
#include "VideoBackends/Software/TextureCache.h"
|
2014-02-17 12:18:15 +02:00
|
|
|
#include "VideoBackends/Software/VideoBackend.h"
|
|
|
|
|
2016-01-17 23:54:31 +02:00
|
|
|
#include "VideoCommon/FramebufferManagerBase.h"
|
2014-02-17 12:18:15 +02:00
|
|
|
#include "VideoCommon/OnScreenDisplay.h"
|
2015-10-09 21:50:36 +03:00
|
|
|
#include "VideoCommon/TextureCacheBase.h"
|
2016-07-22 02:04:57 +03:00
|
|
|
#include "VideoCommon/VideoCommon.h"
|
2015-10-09 21:50:36 +03:00
|
|
|
#include "VideoCommon/VideoConfig.h"
|
2010-06-09 04:37:08 +03:00
|
|
|
|
2012-12-17 22:54:20 +02:00
|
|
|
#define VSYNC_ENABLED 0
|
|
|
|
|
2011-01-31 03:28:32 +02:00
|
|
|
namespace SW
|
2010-06-09 04:37:08 +03:00
|
|
|
{
|
2015-10-09 21:50:36 +03:00
|
|
|
class PerfQuery : public PerfQueryBase
|
2010-06-09 04:37:08 +03:00
|
|
|
{
|
2015-10-09 21:50:36 +03:00
|
|
|
public:
|
2016-06-24 11:43:46 +03:00
|
|
|
PerfQuery() {}
|
|
|
|
~PerfQuery() {}
|
|
|
|
void EnableQuery(PerfQueryGroup type) override {}
|
|
|
|
void DisableQuery(PerfQueryGroup type) override {}
|
2018-05-18 22:13:03 +03:00
|
|
|
void ResetQuery() override { EfbInterface::ResetPerfQuery(); }
|
|
|
|
u32 GetQueryResult(PerfQueryType type) override { return EfbInterface::GetPerfQueryResult(type); }
|
2016-06-24 11:43:46 +03:00
|
|
|
void FlushResults() override {}
|
2017-07-30 22:56:12 +03:00
|
|
|
bool IsFlushed() const override { return true; }
|
2015-10-09 21:50:36 +03:00
|
|
|
};
|
2010-06-09 04:37:08 +03:00
|
|
|
|
2015-10-09 21:50:36 +03:00
|
|
|
std::string VideoSoftware::GetName() const
|
2013-02-26 17:42:32 +02:00
|
|
|
{
|
2016-06-24 11:43:46 +03:00
|
|
|
return "Software Renderer";
|
2013-02-26 17:42:32 +02:00
|
|
|
}
|
|
|
|
|
2015-10-09 21:50:36 +03:00
|
|
|
std::string VideoSoftware::GetDisplayName() const
|
2012-12-17 22:54:20 +02:00
|
|
|
{
|
2016-06-24 11:43:46 +03:00
|
|
|
return "Software Renderer";
|
2010-06-09 04:37:08 +03:00
|
|
|
}
|
|
|
|
|
2016-01-13 22:38:11 +02:00
|
|
|
void VideoSoftware::InitBackendInfo()
|
2013-10-29 07:23:17 +02:00
|
|
|
{
|
2016-07-22 02:04:57 +03:00
|
|
|
g_Config.backend_info.api_type = APIType::Nothing;
|
2017-03-09 16:01:23 +02:00
|
|
|
g_Config.backend_info.MaxTextureSize = 16384;
|
2016-06-24 11:43:46 +03:00
|
|
|
g_Config.backend_info.bSupports3DVision = false;
|
|
|
|
g_Config.backend_info.bSupportsDualSourceBlend = true;
|
|
|
|
g_Config.backend_info.bSupportsEarlyZ = true;
|
|
|
|
g_Config.backend_info.bSupportsOversizedViewports = true;
|
|
|
|
g_Config.backend_info.bSupportsPrimitiveRestart = false;
|
2016-08-13 15:08:46 +03:00
|
|
|
g_Config.backend_info.bSupportsMultithreading = false;
|
2016-11-27 10:14:55 +02:00
|
|
|
g_Config.backend_info.bSupportsComputeShaders = false;
|
2016-11-27 10:14:57 +02:00
|
|
|
g_Config.backend_info.bSupportsGPUTextureDecoding = false;
|
2017-04-16 12:30:11 +03:00
|
|
|
g_Config.backend_info.bSupportsST3CTextures = false;
|
2017-07-27 15:00:04 +03:00
|
|
|
g_Config.backend_info.bSupportsBPTCTextures = false;
|
2017-05-30 01:02:09 +03:00
|
|
|
g_Config.backend_info.bSupportsCopyToVram = false;
|
2017-10-26 08:44:39 +03:00
|
|
|
g_Config.backend_info.bSupportsFramebufferFetch = false;
|
2018-02-25 09:56:09 +02:00
|
|
|
g_Config.backend_info.bSupportsBackgroundCompiling = false;
|
2018-05-25 17:04:18 +03:00
|
|
|
g_Config.backend_info.bSupportsLogicOp = true;
|
2016-06-24 11:43:46 +03:00
|
|
|
|
|
|
|
// aamodes
|
|
|
|
g_Config.backend_info.AAModes = {1};
|
2010-06-09 04:37:08 +03:00
|
|
|
}
|
|
|
|
|
2016-06-24 11:43:46 +03:00
|
|
|
bool VideoSoftware::Initialize(void* window_handle)
|
2010-06-09 04:37:08 +03:00
|
|
|
{
|
2016-06-24 11:43:46 +03:00
|
|
|
InitBackendInfo();
|
2016-01-13 22:14:20 +02:00
|
|
|
InitializeShared();
|
2013-04-14 06:54:02 +03:00
|
|
|
|
2016-06-24 11:43:46 +03:00
|
|
|
SWOGLWindow::Init(window_handle);
|
2013-04-14 06:54:02 +03:00
|
|
|
|
2016-06-24 11:43:46 +03:00
|
|
|
Clipper::Init();
|
|
|
|
Rasterizer::Init();
|
|
|
|
DebugUtil::Init();
|
2013-04-14 06:54:02 +03:00
|
|
|
|
2018-01-26 07:09:07 +02:00
|
|
|
GLInterface->MakeCurrent();
|
|
|
|
SWOGLWindow::s_instance->Prepare();
|
|
|
|
|
|
|
|
g_renderer = std::make_unique<SWRenderer>();
|
|
|
|
g_vertex_manager = std::make_unique<SWVertexLoader>();
|
|
|
|
g_perf_query = std::make_unique<PerfQuery>();
|
|
|
|
g_texture_cache = std::make_unique<TextureCache>();
|
2018-02-24 17:15:35 +02:00
|
|
|
g_shader_cache = std::make_unique<VideoCommon::ShaderCache>();
|
|
|
|
return g_shader_cache->Initialize();
|
2013-02-17 01:50:40 +02:00
|
|
|
}
|
|
|
|
|
2015-10-09 21:50:36 +03:00
|
|
|
void VideoSoftware::Shutdown()
|
2014-11-14 00:26:49 +02:00
|
|
|
{
|
2018-02-24 17:15:35 +02:00
|
|
|
if (g_shader_cache)
|
|
|
|
g_shader_cache->Shutdown();
|
|
|
|
|
2018-01-26 07:09:07 +02:00
|
|
|
if (g_renderer)
|
|
|
|
g_renderer->Shutdown();
|
2016-01-13 22:14:20 +02:00
|
|
|
|
|
|
|
DebugUtil::Shutdown();
|
2018-01-26 07:09:07 +02:00
|
|
|
SWOGLWindow::Shutdown();
|
2016-01-13 22:14:20 +02:00
|
|
|
g_framebuffer_manager.reset();
|
|
|
|
g_texture_cache.reset();
|
|
|
|
g_perf_query.reset();
|
|
|
|
g_vertex_manager.reset();
|
|
|
|
g_renderer.reset();
|
2018-01-26 07:09:07 +02:00
|
|
|
ShutdownShared();
|
2014-02-02 15:16:43 +02:00
|
|
|
}
|
2011-03-17 00:58:24 +02:00
|
|
|
}
|