mirror of https://github.com/PCSX2/pcsx2.git
GSdx: Purge D3D11 Software
F9 now has the following functionality on Windows: - If the renderer in the config is D3D11, switch between D3D11 and SW - If the renderer in the config is OGL, switch between OGL and SW - If the renderer in the config is SW, switch between SW and the renderer returned by GetBestRenderer()
This commit is contained in:
parent
6c4ac7eb7f
commit
79f2468952
|
@ -57,8 +57,7 @@ static void (*s_irq)() = NULL;
|
||||||
static uint8* s_basemem = NULL;
|
static uint8* s_basemem = NULL;
|
||||||
static int s_vsync = 0;
|
static int s_vsync = 0;
|
||||||
static bool s_exclusive = true;
|
static bool s_exclusive = true;
|
||||||
static const char *s_renderer_name = "";
|
static std::string s_renderer_name;
|
||||||
static const char *s_renderer_type = "";
|
|
||||||
bool gsopen_done = false; // crash guard for GSgetTitleInfo2 and GSKeyEvent (replace with lock?)
|
bool gsopen_done = false; // crash guard for GSgetTitleInfo2 and GSKeyEvent (replace with lock?)
|
||||||
|
|
||||||
EXPORT_C_(uint32) PS2EgetLibType()
|
EXPORT_C_(uint32) PS2EgetLibType()
|
||||||
|
@ -302,48 +301,36 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* renderer_fullname = "";
|
std::string renderer_name;
|
||||||
const char* renderer_mode = "";
|
|
||||||
|
|
||||||
switch (renderer)
|
|
||||||
{
|
|
||||||
case GSRendererType::DX1011_SW:
|
|
||||||
case GSRendererType::OGL_SW:
|
|
||||||
renderer_mode = "(Software renderer)";
|
|
||||||
break;
|
|
||||||
case GSRendererType::Null:
|
|
||||||
renderer_mode = "(Null renderer)";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
renderer_mode = "(Hardware renderer)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (renderer)
|
switch (renderer)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
case GSRendererType::DX1011_HW:
|
case GSRendererType::DX1011_HW:
|
||||||
case GSRendererType::DX1011_SW:
|
|
||||||
dev = new GSDevice11();
|
dev = new GSDevice11();
|
||||||
s_renderer_name = " D3D11";
|
s_renderer_name = "D3D11";
|
||||||
renderer_fullname = "Direct3D 11";
|
renderer_name = "Direct3D 11";
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case GSRendererType::Null:
|
|
||||||
dev = new GSDeviceNull();
|
|
||||||
s_renderer_name = " Null";
|
|
||||||
renderer_fullname = "Null";
|
|
||||||
break;
|
|
||||||
case GSRendererType::OGL_HW:
|
case GSRendererType::OGL_HW:
|
||||||
|
dev = new GSDeviceOGL();
|
||||||
|
s_renderer_name = "OGL";
|
||||||
|
renderer_name = "OpenGL";
|
||||||
|
break;
|
||||||
case GSRendererType::OGL_SW:
|
case GSRendererType::OGL_SW:
|
||||||
dev = new GSDeviceOGL();
|
dev = new GSDeviceOGL();
|
||||||
s_renderer_name = " OGL";
|
s_renderer_name = "SW";
|
||||||
renderer_fullname = "OpenGL";
|
renderer_name = "Software";
|
||||||
|
break;
|
||||||
|
case GSRendererType::Null:
|
||||||
|
dev = new GSDeviceNull();
|
||||||
|
s_renderer_name = "NULL";
|
||||||
|
renderer_name = "Null";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Current Renderer: %s %s\n", renderer_fullname, renderer_mode);
|
printf("Current Renderer: %s\n", renderer_name.c_str());
|
||||||
|
|
||||||
if (dev == NULL)
|
if (dev == NULL)
|
||||||
{
|
{
|
||||||
|
@ -358,21 +345,16 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
case GSRendererType::DX1011_HW:
|
case GSRendererType::DX1011_HW:
|
||||||
s_gs = (GSRenderer*)new GSRendererDX11();
|
s_gs = (GSRenderer*)new GSRendererDX11();
|
||||||
s_renderer_type = " HW";
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case GSRendererType::OGL_HW:
|
case GSRendererType::OGL_HW:
|
||||||
s_gs = (GSRenderer*)new GSRendererOGL();
|
s_gs = (GSRenderer*)new GSRendererOGL();
|
||||||
s_renderer_type = " HW";
|
|
||||||
break;
|
break;
|
||||||
case GSRendererType::DX1011_SW:
|
|
||||||
case GSRendererType::OGL_SW:
|
case GSRendererType::OGL_SW:
|
||||||
s_gs = new GSRendererSW(threads);
|
s_gs = new GSRendererSW(threads);
|
||||||
s_renderer_type = " SW";
|
|
||||||
break;
|
break;
|
||||||
case GSRendererType::Null:
|
case GSRendererType::Null:
|
||||||
s_gs = new GSRendererNull();
|
s_gs = new GSRendererNull();
|
||||||
s_renderer_type = "";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (s_gs == NULL)
|
if (s_gs == NULL)
|
||||||
|
@ -433,35 +415,47 @@ EXPORT_C_(void) GSosdMonitor(const char *key, const char *value, uint32 color)
|
||||||
EXPORT_C_(int) GSopen2(void** dsp, uint32 flags)
|
EXPORT_C_(int) GSopen2(void** dsp, uint32 flags)
|
||||||
{
|
{
|
||||||
static bool stored_toggle_state = false;
|
static bool stored_toggle_state = false;
|
||||||
bool toggle_state = !!(flags & 4);
|
const bool toggle_state = !!(flags & 4);
|
||||||
|
|
||||||
GSRendererType renderer = theApp.GetCurrentRendererType();
|
auto current_renderer = theApp.GetCurrentRendererType();
|
||||||
|
|
||||||
if (renderer != GSRendererType::Undefined && stored_toggle_state != toggle_state)
|
if (current_renderer != GSRendererType::Undefined && stored_toggle_state != toggle_state)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
// SW -> HW and HW -> SW (F9 Switch)
|
||||||
switch (renderer) {
|
switch (current_renderer)
|
||||||
// Use alternative renderer (SW if currently using HW renderer, and vice versa, keeping the same API and API version)
|
{
|
||||||
case GSRendererType::DX1011_SW: renderer = GSRendererType::DX1011_HW; break;
|
#ifdef _WIN32
|
||||||
case GSRendererType::DX1011_HW: renderer = GSRendererType::DX1011_SW; break;
|
case GSRendererType::DX1011_HW:
|
||||||
case GSRendererType::OGL_SW: renderer = GSRendererType::OGL_HW; break;
|
current_renderer = GSRendererType::OGL_SW;
|
||||||
case GSRendererType::OGL_HW: renderer = GSRendererType::OGL_SW; break;
|
break;
|
||||||
default: renderer = GSRendererType::DX1011_SW; break; // If wasn't using one of the above mentioned ones, use best SW renderer.
|
#endif
|
||||||
}
|
case GSRendererType::OGL_SW:
|
||||||
|
#ifdef _WIN32
|
||||||
|
{
|
||||||
|
const auto config_renderer = static_cast<GSRendererType>(
|
||||||
|
theApp.GetConfigI("Renderer")
|
||||||
|
);
|
||||||
|
|
||||||
#endif
|
if (current_renderer == config_renderer)
|
||||||
#if defined(__unix__)
|
current_renderer = GSUtil::GetBestRenderer();
|
||||||
switch(renderer) {
|
else
|
||||||
// Use alternative renderer (SW if currently using HW renderer, and vice versa)
|
current_renderer = config_renderer;
|
||||||
case GSRendererType::OGL_SW: renderer = GSRendererType::OGL_HW; break;
|
}
|
||||||
case GSRendererType::OGL_HW: renderer = GSRendererType::OGL_SW; break;
|
#else
|
||||||
default: renderer = GSRendererType::OGL_SW; break; // fallback to OGL SW
|
current_renderer = GSRendererType::OGL_HW;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case GSRendererType::OGL_HW:
|
||||||
|
current_renderer = GSRendererType::OGL_SW;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
current_renderer = GSRendererType::OGL_SW;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
stored_toggle_state = toggle_state;
|
stored_toggle_state = toggle_state;
|
||||||
|
|
||||||
int retval = _GSopen(dsp, "", renderer);
|
int retval = _GSopen(dsp, "", current_renderer);
|
||||||
|
|
||||||
if (s_gs != NULL)
|
if (s_gs != NULL)
|
||||||
s_gs->SetAspectRatio(0); // PCSX2 manages the aspect ratios
|
s_gs->SetAspectRatio(0); // PCSX2 manages the aspect ratios
|
||||||
|
@ -473,14 +467,6 @@ EXPORT_C_(int) GSopen2(void** dsp, uint32 flags)
|
||||||
|
|
||||||
EXPORT_C_(int) GSopen(void** dsp, const char* title, int mt)
|
EXPORT_C_(int) GSopen(void** dsp, const char* title, int mt)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if(!XInitThreads()) return -1;
|
|
||||||
|
|
||||||
Display* display = XOpenDisplay(0);
|
|
||||||
|
|
||||||
XCloseDisplay(display);
|
|
||||||
*/
|
|
||||||
|
|
||||||
GSRendererType renderer = GSRendererType::Default;
|
GSRendererType renderer = GSRendererType::Default;
|
||||||
|
|
||||||
// Legacy GUI expects to acquire vsync from the configuration files.
|
// Legacy GUI expects to acquire vsync from the configuration files.
|
||||||
|
@ -490,13 +476,6 @@ EXPORT_C_(int) GSopen(void** dsp, const char* title, int mt)
|
||||||
if(mt == 2)
|
if(mt == 2)
|
||||||
{
|
{
|
||||||
// pcsx2 sent a switch renderer request
|
// pcsx2 sent a switch renderer request
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
|
|
||||||
renderer = GSRendererType::DX1011_SW;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mt = 1;
|
mt = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -860,9 +839,8 @@ EXPORT_C GSgetLastTag(uint32* tag)
|
||||||
|
|
||||||
EXPORT_C GSgetTitleInfo2(char* dest, size_t length)
|
EXPORT_C GSgetTitleInfo2(char* dest, size_t length)
|
||||||
{
|
{
|
||||||
std::string s{"GSdx"};
|
std::string s;
|
||||||
s.append(s_renderer_name).append(s_renderer_type);
|
s.append(s_renderer_name);
|
||||||
|
|
||||||
// TODO: this gets called from a different thread concurrently with GSOpen (on linux)
|
// TODO: this gets called from a different thread concurrently with GSOpen (on linux)
|
||||||
if (gsopen_done && s_gs != NULL && s_gs->m_GStitleInfoBuffer[0])
|
if (gsopen_done && s_gs != NULL && s_gs->m_GStitleInfoBuffer[0])
|
||||||
{
|
{
|
||||||
|
|
|
@ -232,7 +232,6 @@ enum class GSRendererType : int8_t
|
||||||
{
|
{
|
||||||
Undefined = -1,
|
Undefined = -1,
|
||||||
DX1011_HW = 3,
|
DX1011_HW = 3,
|
||||||
DX1011_SW,
|
|
||||||
Null = 11,
|
Null = 11,
|
||||||
OGL_HW,
|
OGL_HW,
|
||||||
OGL_SW,
|
OGL_SW,
|
||||||
|
|
|
@ -87,10 +87,10 @@ GSLocalMemory::GSLocalMemory()
|
||||||
m_use_fifo_alloc = theApp.GetConfigB("UserHacks") && theApp.GetConfigB("wrap_gs_mem");
|
m_use_fifo_alloc = theApp.GetConfigB("UserHacks") && theApp.GetConfigB("wrap_gs_mem");
|
||||||
switch (theApp.GetCurrentRendererType()) {
|
switch (theApp.GetCurrentRendererType()) {
|
||||||
case GSRendererType::OGL_SW:
|
case GSRendererType::OGL_SW:
|
||||||
case GSRendererType::DX1011_SW:
|
|
||||||
m_use_fifo_alloc = true;
|
m_use_fifo_alloc = true;
|
||||||
break;
|
break;
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_use_fifo_alloc)
|
if (m_use_fifo_alloc)
|
||||||
|
|
|
@ -205,17 +205,16 @@ void GSdxApp::Init()
|
||||||
m_section = "Settings";
|
m_section = "Settings";
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::DX1011_HW), "Direct3D 11", "Hardware"));
|
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::DX1011_HW), "Direct3D 11", ""));
|
||||||
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_HW), "OpenGL", "Hardware"));
|
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_HW), "OpenGL", ""));
|
||||||
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::DX1011_SW), "Direct3D 11", "Software"));
|
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_SW), "Software", ""));
|
||||||
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_SW), "OpenGL", "Software"));
|
|
||||||
#else // Linux
|
#else // Linux
|
||||||
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_HW), "OpenGL", "Hardware"));
|
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_HW), "OpenGL", ""));
|
||||||
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_SW), "OpenGL", "Software"));
|
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::OGL_SW), "Software", ""));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The null renderer goes third, it has use for benchmarking purposes in a release build
|
// The null renderer goes third, it has use for benchmarking purposes in a release build
|
||||||
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::Null), "None", "Core Benchmark"));
|
m_gs_renderers.push_back(GSSetting(static_cast<uint32>(GSRendererType::Null), "Null", ""));
|
||||||
|
|
||||||
m_gs_interlace.push_back(GSSetting(0, "None", ""));
|
m_gs_interlace.push_back(GSSetting(0, "None", ""));
|
||||||
m_gs_interlace.push_back(GSSetting(1, "Weave tff", "saw-tooth"));
|
m_gs_interlace.push_back(GSSetting(1, "Weave tff", "saw-tooth"));
|
||||||
|
@ -556,7 +555,7 @@ void GSdxApp::SetCurrentRendererType(GSRendererType type)
|
||||||
m_current_renderer_type = type;
|
m_current_renderer_type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
GSRendererType GSdxApp::GetCurrentRendererType()
|
GSRendererType GSdxApp::GetCurrentRendererType() const
|
||||||
{
|
{
|
||||||
return m_current_renderer_type;
|
return m_current_renderer_type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
std::string GetConfigS(const char* entry);
|
std::string GetConfigS(const char* entry);
|
||||||
|
|
||||||
void SetCurrentRendererType(GSRendererType type);
|
void SetCurrentRendererType(GSRendererType type);
|
||||||
GSRendererType GetCurrentRendererType();
|
GSRendererType GetCurrentRendererType() const;
|
||||||
|
|
||||||
void SetConfigDir(const char* dir);
|
void SetConfigDir(const char* dir);
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ GSSettingsDlg::GSSettingsDlg()
|
||||||
{
|
{
|
||||||
auto is_d3d11_renderer = [](const auto &renderer) {
|
auto is_d3d11_renderer = [](const auto &renderer) {
|
||||||
const GSRendererType type = static_cast<GSRendererType>(renderer.value);
|
const GSRendererType type = static_cast<GSRendererType>(renderer.value);
|
||||||
return type == GSRendererType::DX1011_HW || type == GSRendererType::DX1011_SW;
|
return type == GSRendererType::DX1011_HW;
|
||||||
};
|
};
|
||||||
m_renderers.erase(std::remove_if(m_renderers.begin(), m_renderers.end(), is_d3d11_renderer), m_renderers.end());
|
m_renderers.erase(std::remove_if(m_renderers.begin(), m_renderers.end(), is_d3d11_renderer), m_renderers.end());
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ void GSSettingsDlg::OnInit()
|
||||||
__super::OnInit();
|
__super::OnInit();
|
||||||
|
|
||||||
GSRendererType renderer = GSRendererType(theApp.GetConfigI("Renderer"));
|
GSRendererType renderer = GSRendererType(theApp.GetConfigI("Renderer"));
|
||||||
const bool dx11 = renderer == GSRendererType::DX1011_HW || renderer == GSRendererType::DX1011_SW;
|
const bool dx11 = renderer == GSRendererType::DX1011_HW;
|
||||||
if (renderer == GSRendererType::Undefined || m_d3d11_adapters.empty() && dx11)
|
if (renderer == GSRendererType::Undefined || m_d3d11_adapters.empty() && dx11)
|
||||||
renderer = GSUtil::GetBestRenderer();
|
renderer = GSUtil::GetBestRenderer();
|
||||||
ComboBoxInit(IDC_RENDERER, m_renderers, static_cast<int32_t>(renderer));
|
ComboBoxInit(IDC_RENDERER, m_renderers, static_cast<int32_t>(renderer));
|
||||||
|
@ -275,7 +275,7 @@ void GSSettingsDlg::UpdateAdapters()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const GSRendererType renderer = static_cast<GSRendererType>(data);
|
const GSRendererType renderer = static_cast<GSRendererType>(data);
|
||||||
const bool dx11 = renderer == GSRendererType::DX1011_HW || renderer == GSRendererType::DX1011_SW;
|
const bool dx11 = renderer == GSRendererType::DX1011_HW;
|
||||||
|
|
||||||
EnableWindow(GetDlgItem(m_hWnd, IDC_ADAPTER), dx11);
|
EnableWindow(GetDlgItem(m_hWnd, IDC_ADAPTER), dx11);
|
||||||
EnableWindow(GetDlgItem(m_hWnd, IDC_ADAPTER_TEXT), dx11);
|
EnableWindow(GetDlgItem(m_hWnd, IDC_ADAPTER_TEXT), dx11);
|
||||||
|
@ -316,11 +316,11 @@ void GSSettingsDlg::UpdateControls()
|
||||||
{
|
{
|
||||||
const GSRendererType renderer = static_cast<GSRendererType>(i);
|
const GSRendererType renderer = static_cast<GSRendererType>(i);
|
||||||
|
|
||||||
const bool dx11 = renderer == GSRendererType::DX1011_HW || renderer == GSRendererType::DX1011_SW;
|
const bool dx11 = renderer == GSRendererType::DX1011_HW;
|
||||||
const bool ogl = renderer == GSRendererType::OGL_HW || renderer == GSRendererType::OGL_SW;
|
const bool ogl = renderer == GSRendererType::OGL_HW || renderer == GSRendererType::OGL_SW;
|
||||||
|
|
||||||
const bool hw = renderer == GSRendererType::DX1011_HW || renderer == GSRendererType::OGL_HW;
|
const bool hw = renderer == GSRendererType::DX1011_HW || renderer == GSRendererType::OGL_HW;
|
||||||
const bool sw = renderer == GSRendererType::DX1011_SW || renderer == GSRendererType::OGL_SW;
|
const bool sw = renderer == GSRendererType::OGL_SW;
|
||||||
const bool null = renderer == GSRendererType::Null;
|
const bool null = renderer == GSRendererType::Null;
|
||||||
|
|
||||||
const int sw_threads = SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_GETPOS, 0, 0);
|
const int sw_threads = SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_GETPOS, 0, 0);
|
||||||
|
|
Loading…
Reference in New Issue