gsdx: Defer GSdxApp initialisation on Linux only

vector push_back causes a SIGILL signal on a Nehalem (SSE4.2) QEMU VM
when compiled with GCC 6.1.1.

However, an empty constructor causes illegal instruction exceptions to be
generated on a Windows VM.

So here's an inbetween that looks stupid but works on what I've tested.
This commit is contained in:
Jonathan Li 2016-07-23 23:13:04 +01:00
parent 9f53987e3b
commit 46ba9aa117
4 changed files with 25 additions and 1 deletions

View File

@ -127,6 +127,8 @@ EXPORT_C_(int) GSinit()
// can crash if the CPU does not support the instruction set.
// Initialise it here instead - it's not ideal since we have to strip the
// const type qualifier from all the affected variables.
theApp.Init();
GSBlock::InitVectors();
GSClut::InitVectors();
GSDrawScanlineCodeGenerator::InitVectors();
@ -815,6 +817,8 @@ EXPORT_C GSconfigure()
{
if(!GSUtil::CheckSSE()) return;
theApp.Init();
#ifdef _WIN32
GSDialog::InitCommonControls();
if(GSSettingsDlg().DoModal() == IDOK)

View File

@ -127,6 +127,21 @@ GSdxApp theApp;
GSdxApp::GSdxApp()
{
// Empty constructor causes an illegal instruction exception on an SSE4.2 machine on Windows.
// Non-empty doesn't, but raises a SIGILL signal when compiled against GCC 6.1.1.
// So here's a compromise.
#ifdef _WIN32
Init();
#endif
}
void GSdxApp::Init()
{
static bool is_initialised = false;
if (is_initialised)
return;
is_initialised = true;
m_ini = "inis/GSdx.ini";
m_section = "Settings";

View File

@ -35,7 +35,8 @@ class GSdxApp
public:
GSdxApp();
void* GetModuleHandlePtr();
void Init();
void* GetModuleHandlePtr();
#ifdef _WIN32
HMODULE GetModuleHandle() {return (HMODULE)GetModuleHandlePtr();}

View File

@ -59,6 +59,8 @@ EXPORT_C_(uint32) PSEgetLibVersion()
EXPORT_C_(int32) GPUinit()
{
theApp.Init();
GSVector4i::InitVectors();
GSVector4::InitVectors();
#if _M_SSE >= 0x500
@ -153,6 +155,8 @@ EXPORT_C_(int32) GPUopen(void* hWnd)
EXPORT_C_(int32) GPUconfigure()
{
theApp.Init();
#ifdef _WIN32
GPUSettingsDlg dlg;