This commit is contained in:
ramapcsx2 2014-07-12 20:23:01 +02:00
commit 0121366f65
14 changed files with 49 additions and 18 deletions

View File

@ -30,6 +30,7 @@ do
--gles ) flags="$flags -DGLES_API=TRUE" ;;
--sdl2 ) flags="$flags -DSDL2_API=TRUE" ;;
--extra ) flags="$flags -DEXTRA_PLUGINS=TRUE" ;;
--asan ) flags="$flags -DUSE_ASAN=TRUE";;
--clang ) use_clang=1; flags="$flags -DUSE_CLANG=TRUE" ;;
--clean ) clean_build=1 ;;
@ -40,8 +41,11 @@ do
echo "--debug : Build PCSX2 as a Debug build."
echo "--release : Build PCSX2 as a Release build."
echo "--clean : Do a clean build."
echo "--extra : Build all plugins"
echo "** Developper option **"
echo "--clang : Build with Clang/llvm"
echo "--extra : Build all plugins"
echo "--asan : Enable with Address sanitizer"
echo ""
echo "--glsl : Replace CG backend of ZZogl by GLSL"
echo "--egl : Replace GLX by EGL (ZZogl plugins only)"
echo "--sdl2 : Build with SDL2 (crash if wx is linked to SDL1)"

View File

@ -49,6 +49,12 @@ if(PACKAGE_MODE)
add_definitions(-DPLUGIN_DIR_COMPILATION=${PLUGIN_DIR} -DGAMEINDEX_DIR_COMPILATION=${GAMEINDEX_DIR})
endif(PACKAGE_MODE)
#-------------------------------------------------------------------------------
# Compiler extra
#-------------------------------------------------------------------------------
option(USE_CLANG "Use llvm/clang to build PCSX2 (developer option)")
option(USE_ASAN "Enable address sanitizer")
#-------------------------------------------------------------------------------
# Select the architecture
#-------------------------------------------------------------------------------
@ -184,16 +190,28 @@ set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
# -Wno-missing-field-initializers: standard allow to init only the begin of struct/array in static init. Just a silly warning.
# -Wno-unused-function: warn for function not used in release build
# -Wno-unused-variable: just annoying to manage different level of logging, a couple of extra var won't kill any serious compiler.
# -Wno-deprecated-register: glib issue...
set(DEFAULT_WARNINGS "-Wall -Wno-attributes -Wstrict-aliasing -Wno-missing-field-initializers -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable")
if (USE_CLANG)
set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-deprecated-register")
endif()
set(HARDENING_FLAG "-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security")
set(COMMON_FLAG "-pipe -std=c++0x -fvisibility=hidden -pthread")
if(CMAKE_BUILD_TYPE MATCHES "Debug|Devel")
set(DEBUG_FLAG "-g")
else()
set(DEBUG_FLAG "")
endif()
set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${HARDENING_FLAG} ${DEBUG_FLAG}")
if (USE_ASAN)
set(ASAN_FLAG "-fsanitize=address -fno-omit-frame-pointer -g -mpreferred-stack-boundary=4 -mincoming-stack-boundary=2 -DASAN_WORKAROUND")
else()
set(ASAN_FLAG "")
endif()
set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${HARDENING_FLAG} ${DEBUG_FLAG} ${ASAN_FLAG}")
# c++ only flags
set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -Wno-invalid-offsetof")

View File

@ -116,7 +116,7 @@ namespace Exception
virtual u32 GetPc() const=0;
virtual bool IsDelaySlot() const=0;
virtual wxString Message() const { return m_message; }
virtual wxString& Message() { return m_message; }
virtual void Rethrow() const=0;
virtual Ps2Generic* Clone() const=0;

View File

@ -30,7 +30,7 @@ void* __fastcall pcsx2_aligned_malloc(size_t size, size_t align)
{
pxAssert( align < 0x10000 );
#ifdef __USE_ISOC11
#if defined(__USE_ISOC11) && !defined(ASAN_WORKAROUND) // not supported yet on gcc 4.9
return aligned_alloc(align, size);
#else
u8* p = (u8*)malloc(size+align+headsize);
@ -57,7 +57,7 @@ void* __fastcall pcsx2_aligned_realloc(void* handle, size_t size, size_t align)
if( handle != NULL )
{
#ifdef __USE_ISOC11
#if defined(__USE_ISOC11) && !defined(ASAN_WORKAROUND) // not supported yet on gcc 4.9
memcpy_fast( newbuf, handle, size );
free( handle );
#else
@ -71,7 +71,7 @@ void* __fastcall pcsx2_aligned_realloc(void* handle, size_t size, size_t align)
__fi void pcsx2_aligned_free(void* pmem)
{
#ifdef __USE_ISOC11
#if defined(__USE_ISOC11) && !defined(ASAN_WORKAROUND) // not supported yet on gcc 4.9
free(pmem);
#else
if( pmem == NULL ) return;

View File

@ -397,7 +397,7 @@ s32 CALLBACK ISOreadSector(u8* tempbuffer, u32 lsn, int mode)
u8 *pbuffer = cdbuffer;
int psize;
int psize = 0;
switch (mode)
{

View File

@ -19,6 +19,7 @@ set(CommonFlags
-Wno-parentheses
-Wstrict-aliasing # Allow to track strict aliasing issue.
-Wno-char-subscripts # only impact svu which is deprecated
-Wno-missing-braces
)
# set optimization flags

View File

@ -1016,7 +1016,7 @@ void SysCorePlugins::Load( const wxString (&folders)[PluginId_Count] )
(int)x86caps.LogicalCores,
sizeof(wchar_t),
0,0,0,0,0,0,
{ 0,0,0,0,0,0 },
pcsx2_GetInt,
pcsx2_GetBoolean,

View File

@ -478,6 +478,8 @@ mem32_t __fastcall iopHwRead32_Page8( u32 addr )
else if( masked_addr >= pgmsk(HW_FW_START) && masked_addr <= pgmsk(HW_FW_END) )
{
ret = FWread32( addr );
} else {
ret = psxHu32(addr);
}
}
else ret = psxHu32(addr);

View File

@ -105,7 +105,7 @@ public:
m_reserve.Release();
}
virtual void Reserve( sptr hostptr );
void Reserve( sptr hostptr );
virtual void Release();
virtual void Commit();
@ -172,8 +172,8 @@ public:
Release();
}
virtual void Reserve();
virtual void Release();
void Reserve();
void Release();
void Reset();
};

View File

@ -265,7 +265,7 @@ static u8* GetIndirectDispatcherPtr( int mode, int operandsize, int sign = 0 )
//
static void DynGen_IndirectDispatch( int mode, int bits, bool sign = false )
{
int szidx;
int szidx = 0;
switch( bits )
{
case 8: szidx=0; break;

View File

@ -2425,6 +2425,8 @@ __forceinline void GSState::VertexKick(uint32 skip)
pmin = v2.min_i16(v1.min_i16(v3));
pmax = v2.max_i16(v1.max_i16(v3));
break;
default:
break;
}
GSVector4i test = pmax.lt16(m_scissor) | pmin.gt16(m_scissor.zwzwl());
@ -2437,6 +2439,8 @@ __forceinline void GSState::VertexKick(uint32 skip)
case GS_SPRITE:
test |= m_nativeres ? pmin.eq16(pmax).zwzwl() : pmin.eq16(pmax);
break;
default:
break;
}
switch(prim)
@ -2460,6 +2464,8 @@ __forceinline void GSState::VertexKick(uint32 skip)
*/
test = (test | v3 == v1) | (v1 == v2 | v3 == v2);
break;
default:
break;
}
skip |= test.mask() & 15;

View File

@ -107,7 +107,7 @@ void vmfree(void* ptr, size_t size)
// declare linux equivalents (alignment must be power of 2 (1,2,4...2^15)
#if !defined(__USE_ISOC11)
#if !defined(__USE_ISOC11) || defined(ASAN_WORKAROUND)
void* _aligned_malloc(size_t size, size_t alignment)
{

View File

@ -358,10 +358,10 @@ struct aligned_free_second {template<class T> void operator()(T& p) {_aligned_fr
#if !defined(_MSC_VER)
#if defined(__USE_ISOC11)
#if defined(__USE_ISOC11) && !defined(ASAN_WORKAROUND) // not supported yet on gcc 4.9
#define _aligned_malloc(size, a) aligned_alloc(a, size)
static void _aligned_free(void* p) { free(p); }
static inline void _aligned_free(void* p) { free(p); }
#elif !defined(HAVE_ALIGNED_MALLOC)

View File

@ -82,8 +82,8 @@ void ProcessDplIISample32( const StereoOut32& src, Stereo51Out32DplII * s)
float R = IR - C;
// Peak L/R
float PL = abs(L);
float PR = abs(R);
float PL = std::abs(L);
float PR = std::abs(R);
AccL += (PL-AccL)*0.1f;
AccR += (PR-AccR)*0.1f;
@ -92,7 +92,7 @@ void ProcessDplIISample32( const StereoOut32& src, Stereo51Out32DplII * s)
float Balance = (AccR-AccL); // -1 .. 1
// If the power levels are different, then the audio is meant for the front speakers
float Frontness = abs(Balance);
float Frontness = std::abs(Balance);
float Rearness = 1-Frontness; // And the other way around
// Equalize the power levels for L/R