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
This commit is contained in:
gabest11 2011-02-19 23:41:52 +00:00
parent 052cd4d45e
commit d4b300a8ac
7 changed files with 85 additions and 57 deletions

View File

@ -44,7 +44,7 @@ EXPORT_C_(uint32) PSEgetLibType()
return PSE_LT_GPU; return PSE_LT_GPU;
} }
EXPORT_C_(char*) PSEgetLibName() EXPORT_C_(const char*) PSEgetLibName()
{ {
return GSUtil::GetLibName(); return GSUtil::GetLibName();
} }

View File

@ -58,7 +58,7 @@ EXPORT_C_(uint32) PS2EgetLibType()
return PS2E_LT_GS; return PS2E_LT_GS;
} }
EXPORT_C_(char*) PS2EgetLibName() EXPORT_C_(const char*) PS2EgetLibName()
{ {
return GSUtil::GetLibName(); 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 0: case 1: case 2: dev = new GSDevice9(); break;
case 3: case 4: case 5: dev = new GSDevice11(); break; case 3: case 4: case 5: dev = new GSDevice11(); break;
#endif #endif
case 12: case 13: new GSDeviceNull(); break; case 12: case 13: dev = new GSDeviceNull(); break;
} }
if(dev == NULL) if(dev == NULL)
{ {
return -1; return -1;
} }
if(s_gs == NULL) if(s_gs == NULL)
@ -214,10 +214,10 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
case 3: case 3:
s_gs = new GSRendererDX11(); s_gs = new GSRendererDX11();
break; break;
#endif
case 1: case 4: case 7: case 10: case 12: case 1: case 4: case 7: case 10: case 12:
s_gs = new GSRendererSW(threads); s_gs = new GSRendererSW(threads);
break; break;
#endif
case 2: case 5: case 8: case 11: case 13: case 2: case 5: case 8: case 11: case 13:
s_gs = new GSRendererNull(); s_gs = new GSRendererNull();
break; break;
@ -290,7 +290,7 @@ EXPORT_C_(int) GSopen2(void** dsp, uint32 flags)
if(flags & 4) if(flags & 4)
{ {
#ifdef _WINDOWS #ifdef _WINDOWS
renderer = s_isdx11avail ? 4 : 1; // dx11 / dx9 sw renderer = s_isdx11avail ? 4 : 1; // dx11 / dx9 sw
#endif #endif
} }
@ -542,6 +542,8 @@ EXPORT_C GSgetTitleInfo2(char* dest, size_t length)
{ {
string s = "GSdx"; 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]) if(s_gs->m_GStitleInfoBuffer[0])
{ {
GSAutoLock lock(&s_gs->m_pGSsetTitle_Crit); GSAutoLock lock(&s_gs->m_pGSsetTitle_Crit);

View File

@ -386,13 +386,13 @@ void GSRenderer::VSync(int field)
if(!m_snapshot.empty()) 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) if(!m_dump && shift)
{ {

View File

@ -22,56 +22,69 @@
#include "stdafx.h" #include "stdafx.h"
#include "GS.h" #include "GS.h"
#include "GSUtil.h" #include "GSUtil.h"
//#include "svnrev.h"
#include "xbyak/xbyak_util.h" #include "xbyak/xbyak_util.h"
#ifdef _WINDOWS
#include "svnrev.h"
#else
#define SVN_REV 0 #define SVN_REV 0
#define SVN_MODS 0 #define SVN_MODS 0
#endif
char* GSUtil::GetLibName() const char* GSUtil::GetLibName()
{ {
// TODO: critsec
static string str; static string str;
str = format("GSdx %d", SVN_REV); if(str.empty())
if(SVN_MODS) str += "m";
#if _M_AMD64
str += " 64-bit";
#endif
list<string> 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<string>::iterator i = sl.begin(); i != sl.end(); )
{ {
if(i == sl.begin()) str += " ("; str = "GSdx";
str += *i;
str += ++i != sl.end() ? ", " : ")"; #ifdef _WINDOWS
str += format(" %d", SVN_REV);
if(SVN_MODS) str += "m";
#endif
#if _M_AMD64
str += " 64-bit";
#endif
list<string> 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<string>::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 static class GSUtilMaps

View File

@ -26,7 +26,7 @@
class GSUtil class GSUtil
{ {
public: public:
static char* GetLibName(); static const char* GetLibName();
static GS_PRIM_CLASS GetPrimClass(uint32 prim); static GS_PRIM_CLASS GetPrimClass(uint32 prim);

View File

@ -7,10 +7,12 @@
<Option compiler="gcc" /> <Option compiler="gcc" />
<Build> <Build>
<Target title="Debug"> <Target title="Debug">
<Option output="bin/Debug/libGSdx" prefix_auto="1" extension_auto="1" /> <Option output="../../bin/plugins/libGSdx" prefix_auto="1" extension_auto="1" />
<Option working_dir="../../bin" />
<Option object_output="obj/Debug/" /> <Option object_output="obj/Debug/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
<Option host_application="../../pcsx2/bin/pcsx2" />
<Option createDefFile="1" /> <Option createDefFile="1" />
<Option createStaticLib="1" /> <Option createStaticLib="1" />
<Compiler> <Compiler>
@ -18,10 +20,12 @@
</Compiler> </Compiler>
</Target> </Target>
<Target title="Release"> <Target title="Release">
<Option output="bin/Release/libGSdx" prefix_auto="1" extension_auto="1" /> <Option output="../../bin/plugins/libGSdx" prefix_auto="1" extension_auto="1" />
<Option working_dir="../../bin" />
<Option object_output="obj/Release/" /> <Option object_output="obj/Release/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
<Option host_application="../../pcsx2/bin/pcsx2" />
<Option createDefFile="1" /> <Option createDefFile="1" />
<Option createStaticLib="1" /> <Option createStaticLib="1" />
<Compiler> <Compiler>
@ -30,10 +34,15 @@
</Target> </Target>
</Build> </Build>
<Compiler> <Compiler>
<Add option="-march=pentium4" />
<Add option="-fno-operator-names" /> <Add option="-fno-operator-names" />
<Add option="-msse2" />
<Add option="-m32" />
<Add option="-mpreferred-stack-boundary=2" />
<Add option="-D_LINUX" /> <Add option="-D_LINUX" />
</Compiler> </Compiler>
<Linker>
<Add option="-lpthread" />
</Linker>
<Unit filename="GPU.cpp" /> <Unit filename="GPU.cpp" />
<Unit filename="GPU.h" /> <Unit filename="GPU.h" />
<Unit filename="GPUDrawScanline.cpp" /> <Unit filename="GPUDrawScanline.cpp" />
@ -139,7 +148,11 @@
<envvars /> <envvars />
<code_completion /> <code_completion />
<lib_finder disable_auto="1" /> <lib_finder disable_auto="1" />
<debugger /> <debugger>
<remote_debugging>
<options conn_type="0" serial_baud="115200" additional_cmds_before="handle SIGSEGV nostop" />
</remote_debugging>
</debugger>
</Extensions> </Extensions>
</Project> </Project>
</CodeBlocks_project_file> </CodeBlocks_project_file>

View File

@ -104,8 +104,8 @@ using namespace stdext;
#ifdef __GNUC__ #ifdef __GNUC__
// #define __forceinline __attribute__((always_inline,unused)) #define __forceinline __inline__ __attribute__((always_inline,unused))
#define __forceinline __inline__ __attribute__((__always_inline__,__gnu_inline__)) // #define __forceinline __inline__ __attribute__((__always_inline__,__gnu_inline__))
#define __assume(c) ((void)0) #define __assume(c) ((void)0)
#endif #endif
@ -156,7 +156,7 @@ typedef signed long long int64;
#endif #endif
#if defined(_DEBUG) && defined(_MSC_VER) #if defined(_DEBUG) //&& defined(_MSC_VER)
#include <assert.h> #include <assert.h>
#define ASSERT assert #define ASSERT assert