Files
dolphin/Source/Core/VideoBackends/Software/SWmain.cpp
T

118 lines
3.4 KiB
C++
Raw Normal View History

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