From d4b300a8ac1842ce79524d26a291ae392e0b4517 Mon Sep 17 00:00:00 2001 From: gabest11 Date: Sat, 19 Feb 2011 23:41:52 +0000 Subject: [PATCH] GSdx: gcc build runs, and judging by the frame rate it may even draw something. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4321 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GPU.cpp | 2 +- plugins/GSdx/GS.cpp | 12 +++-- plugins/GSdx/GSRenderer.cpp | 8 ++-- plugins/GSdx/GSUtil.cpp | 91 +++++++++++++++++++++---------------- plugins/GSdx/GSUtil.h | 2 +- plugins/GSdx/GSdx.gcc.cbp | 21 +++++++-- plugins/GSdx/stdafx.h | 6 +-- 7 files changed, 85 insertions(+), 57 deletions(-) diff --git a/plugins/GSdx/GPU.cpp b/plugins/GSdx/GPU.cpp index ce07fa8b6a..c38f3d45d0 100644 --- a/plugins/GSdx/GPU.cpp +++ b/plugins/GSdx/GPU.cpp @@ -44,7 +44,7 @@ EXPORT_C_(uint32) PSEgetLibType() return PSE_LT_GPU; } -EXPORT_C_(char*) PSEgetLibName() +EXPORT_C_(const char*) PSEgetLibName() { return GSUtil::GetLibName(); } diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index fc1f5280e9..7b80a049c3 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -58,7 +58,7 @@ EXPORT_C_(uint32) PS2EgetLibType() return PS2E_LT_GS; } -EXPORT_C_(char*) PS2EgetLibName() +EXPORT_C_(const char*) PS2EgetLibName() { return GSUtil::GetLibName(); } @@ -194,12 +194,12 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1) case 0: case 1: case 2: dev = new GSDevice9(); break; case 3: case 4: case 5: dev = new GSDevice11(); break; #endif - case 12: case 13: new GSDeviceNull(); break; + case 12: case 13: dev = new GSDeviceNull(); break; } if(dev == NULL) { - return -1; + return -1; } if(s_gs == NULL) @@ -214,10 +214,10 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1) case 3: s_gs = new GSRendererDX11(); break; + #endif case 1: case 4: case 7: case 10: case 12: s_gs = new GSRendererSW(threads); break; - #endif case 2: case 5: case 8: case 11: case 13: s_gs = new GSRendererNull(); break; @@ -290,7 +290,7 @@ EXPORT_C_(int) GSopen2(void** dsp, uint32 flags) if(flags & 4) { #ifdef _WINDOWS - renderer = s_isdx11avail ? 4 : 1; // dx11 / dx9 sw + renderer = s_isdx11avail ? 4 : 1; // dx11 / dx9 sw #endif } @@ -542,6 +542,8 @@ EXPORT_C GSgetTitleInfo2(char* dest, size_t length) { string s = "GSdx"; + if(s_gs != NULL) // TODO: this gets called from a different thread concurrently with GSOpen (on linux) + if(s_gs->m_GStitleInfoBuffer[0]) { GSAutoLock lock(&s_gs->m_pGSsetTitle_Crit); diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index 4d1cc0d9b7..95041d7453 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -386,13 +386,13 @@ void GSRenderer::VSync(int field) if(!m_snapshot.empty()) { - bool shift = false; + bool shift = false; - #ifdef _WINDOWS + #ifdef _WINDOWS - shift = !!(::GetAsyncKeyState(VK_SHIFT) & 0x8000); + shift = !!(::GetAsyncKeyState(VK_SHIFT) & 0x8000); - #endif + #endif if(!m_dump && shift) { diff --git a/plugins/GSdx/GSUtil.cpp b/plugins/GSdx/GSUtil.cpp index 21d5114c0b..9fe3cc9456 100644 --- a/plugins/GSdx/GSUtil.cpp +++ b/plugins/GSdx/GSUtil.cpp @@ -22,56 +22,69 @@ #include "stdafx.h" #include "GS.h" #include "GSUtil.h" -//#include "svnrev.h" #include "xbyak/xbyak_util.h" +#ifdef _WINDOWS +#include "svnrev.h" +#else #define SVN_REV 0 #define SVN_MODS 0 +#endif -char* GSUtil::GetLibName() +const char* GSUtil::GetLibName() { + // TODO: critsec + static string str; - str = format("GSdx %d", SVN_REV); - - if(SVN_MODS) str += "m"; - - #if _M_AMD64 - str += " 64-bit"; - #endif - - list sl; - - // TODO: linux (gcc) - - #ifdef __INTEL_COMPILER - sl.push_back(format("Intel C++ %d.%02d", __INTEL_COMPILER / 100, __INTEL_COMPILER % 100)); - #elif _MSC_VER - sl.push_back(format("MSVC %d.%02d", _MSC_VER / 100, _MSC_VER % 100)); - #endif - - #if _M_SSE >= 0x500 - sl.push_back("AVX"); - #elif _M_SSE >= 0x402 - sl.push_back("SSE42"); - #elif _M_SSE >= 0x401 - sl.push_back("SSE41"); - #elif _M_SSE >= 0x301 - sl.push_back("SSSE3"); - #elif _M_SSE >= 0x200 - sl.push_back("SSE2"); - #elif _M_SSE >= 0x100 - sl.push_back("SSE"); - #endif - - for(list::iterator i = sl.begin(); i != sl.end(); ) + if(str.empty()) { - if(i == sl.begin()) str += " ("; - str += *i; - str += ++i != sl.end() ? ", " : ")"; + str = "GSdx"; + + #ifdef _WINDOWS + str += format(" %d", SVN_REV); + if(SVN_MODS) str += "m"; + #endif + + #if _M_AMD64 + str += " 64-bit"; + #endif + + list sl; + + // TODO: linux (gcc) + + #ifdef __INTEL_COMPILER + sl.push_back(format("Intel C++ %d.%02d", __INTEL_COMPILER / 100, __INTEL_COMPILER % 100)); + #elif _MSC_VER + sl.push_back(format("MSVC %d.%02d", _MSC_VER / 100, _MSC_VER % 100)); + #elif __GNUC__ + sl.push_back(format("GCC %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)); + #endif + + #if _M_SSE >= 0x500 + sl.push_back("AVX"); + #elif _M_SSE >= 0x402 + sl.push_back("SSE42"); + #elif _M_SSE >= 0x401 + sl.push_back("SSE41"); + #elif _M_SSE >= 0x301 + sl.push_back("SSSE3"); + #elif _M_SSE >= 0x200 + sl.push_back("SSE2"); + #elif _M_SSE >= 0x100 + sl.push_back("SSE"); + #endif + + for(list::iterator i = sl.begin(); i != sl.end(); ) + { + if(i == sl.begin()) str += " ("; + str += *i; + str += ++i != sl.end() ? ", " : ")"; + } } - return (char*)str.c_str(); + return str.c_str(); } static class GSUtilMaps diff --git a/plugins/GSdx/GSUtil.h b/plugins/GSdx/GSUtil.h index 09ae943309..d009df6374 100644 --- a/plugins/GSdx/GSUtil.h +++ b/plugins/GSdx/GSUtil.h @@ -26,7 +26,7 @@ class GSUtil { public: - static char* GetLibName(); + static const char* GetLibName(); static GS_PRIM_CLASS GetPrimClass(uint32 prim); diff --git a/plugins/GSdx/GSdx.gcc.cbp b/plugins/GSdx/GSdx.gcc.cbp index 72eca79dad..45b0be7aeb 100644 --- a/plugins/GSdx/GSdx.gcc.cbp +++ b/plugins/GSdx/GSdx.gcc.cbp @@ -7,10 +7,12 @@