From ff7f48be6f5145f3dc9698ce4e46c2b7c568109c Mon Sep 17 00:00:00 2001 From: Vincent Gee Date: Sun, 30 Nov 2014 20:43:04 -0500 Subject: [PATCH 1/3] Added support for AMD Chips --- Engine/source/platform/platform.h | 5 ++++- Engine/source/platform/platformAssert.h | 4 ++-- Engine/source/platform/platformCPU.cpp | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Engine/source/platform/platform.h b/Engine/source/platform/platform.h index 81f6165c1..cdfe528d0 100644 --- a/Engine/source/platform/platform.h +++ b/Engine/source/platform/platform.h @@ -74,6 +74,9 @@ enum ProcessorType CPU_AMD_K6_2, CPU_AMD_K6_3, CPU_AMD_Athlon, + CPU_AMD_Phenom, + CPU_AMD_PhenomII, + CPU_AMD_Bulldozer, CPU_AMD_Unknown, CPU_Cyrix_6x86, CPU_Cyrix_MediaGX, @@ -510,7 +513,7 @@ extern void* dRealloc_r(void* in_pResize, dsize_t in_size, const char*, const ds extern void* dRealMalloc(dsize_t); extern void dRealFree(void*); -extern void *dMalloc_aligned(dsize_t in_size, S32 alignment); +extern void *dMalloc_aligned(dsize_t in_size, intptr_t alignment); extern void dFree_aligned(void *); diff --git a/Engine/source/platform/platformAssert.h b/Engine/source/platform/platformAssert.h index 60ed7d3d5..325b7984d 100644 --- a/Engine/source/platform/platformAssert.h +++ b/Engine/source/platform/platformAssert.h @@ -92,8 +92,8 @@ public: exit conditions. */ #define AssertFatal(x, y) \ - { if (((bool)(x))==(bool)0) \ - { if ( ::PlatformAssert::processAssert(::PlatformAssert::Fatal, __FILE__, __LINE__, y) ) { ::Platform::debugBreak(); } } } + { if (((bool)(x))==false) \ + { if ( ::PlatformAssert::processAssert(::PlatformAssert::Fatal, __FILE__, __LINE__, y) ) { ::Platform::debugBreak(); } } } #else #define AssertFatal(x, y) { TORQUE_UNUSED(x); TORQUE_UNUSED(y); } diff --git a/Engine/source/platform/platformCPU.cpp b/Engine/source/platform/platformCPU.cpp index 1fc7c0336..7f3dec5f5 100644 --- a/Engine/source/platform/platformCPU.cpp +++ b/Engine/source/platform/platformCPU.cpp @@ -178,6 +178,9 @@ void SetProcessorInfo(Platform::SystemInfo_struct::Processor& pInfo, pInfo.properties |= (properties & BIT_SSE) ? CPU_PROP_SSE : 0; pInfo.properties |= ( properties & BIT_SSE2 ) ? CPU_PROP_SSE2 : 0; pInfo.properties |= (properties & BIT_3DNOW) ? CPU_PROP_3DNOW : 0; + // Phenom and PhenomII support SSE3, SSE4a + pInfo.properties |= ( properties2 & BIT_SSE3 ) ? CPU_PROP_SSE3 : 0; + pInfo.properties |= ( properties2 & BIT_SSE4_1 ) ? CPU_PROP_SSE4_1 : 0; // switch on processor family code switch ((processor >> 8) & 0xf) { @@ -223,6 +226,24 @@ void SetProcessorInfo(Platform::SystemInfo_struct::Processor& pInfo, pInfo.name = StringTable->insert("AMD Athlon"); break; + // Phenom Family + case 15: + pInfo.type = CPU_AMD_Phenom; + pInfo.name = StringTable->insert("AMD Phenom"); + break; + + // Phenom II Family + case 16: + pInfo.type = CPU_AMD_PhenomII; + pInfo.name = StringTable->insert("AMD Phenom II"); + break; + + // Bulldozer Family + case 17: + pInfo.type = CPU_AMD_Bulldozer; + pInfo.name = StringTable->insert("AMD Bulldozer"); + break; + default: pInfo.type = CPU_AMD_Unknown; pInfo.name = StringTable->insert("AMD (unknown)"); From 5dfc2931912a3a38e60f11a422868967feb44e77 Mon Sep 17 00:00:00 2001 From: Vincent Gee Date: Sun, 30 Nov 2014 21:11:32 -0500 Subject: [PATCH 2/3] type fix --- Engine/source/platform/platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/platform/platform.h b/Engine/source/platform/platform.h index cdfe528d0..b60a1152a 100644 --- a/Engine/source/platform/platform.h +++ b/Engine/source/platform/platform.h @@ -513,7 +513,7 @@ extern void* dRealloc_r(void* in_pResize, dsize_t in_size, const char*, const ds extern void* dRealMalloc(dsize_t); extern void dRealFree(void*); -extern void *dMalloc_aligned(dsize_t in_size, intptr_t alignment); +extern void *dMalloc_aligned(dsize_t in_size, S32 alignment); extern void dFree_aligned(void *); From 8e0ae15f74049e393a3408b6c142c795749c5884 Mon Sep 17 00:00:00 2001 From: Vincent Gee Date: Sun, 30 Nov 2014 21:49:41 -0500 Subject: [PATCH 3/3] Tabs... --- Engine/source/platform/platformCPU.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Engine/source/platform/platformCPU.cpp b/Engine/source/platform/platformCPU.cpp index 7f3dec5f5..d2b60e8d7 100644 --- a/Engine/source/platform/platformCPU.cpp +++ b/Engine/source/platform/platformCPU.cpp @@ -178,8 +178,8 @@ void SetProcessorInfo(Platform::SystemInfo_struct::Processor& pInfo, pInfo.properties |= (properties & BIT_SSE) ? CPU_PROP_SSE : 0; pInfo.properties |= ( properties & BIT_SSE2 ) ? CPU_PROP_SSE2 : 0; pInfo.properties |= (properties & BIT_3DNOW) ? CPU_PROP_3DNOW : 0; - // Phenom and PhenomII support SSE3, SSE4a - pInfo.properties |= ( properties2 & BIT_SSE3 ) ? CPU_PROP_SSE3 : 0; + // Phenom and PhenomII support SSE3, SSE4a + pInfo.properties |= ( properties2 & BIT_SSE3 ) ? CPU_PROP_SSE3 : 0; pInfo.properties |= ( properties2 & BIT_SSE4_1 ) ? CPU_PROP_SSE4_1 : 0; // switch on processor family code switch ((processor >> 8) & 0xf) @@ -227,19 +227,19 @@ void SetProcessorInfo(Platform::SystemInfo_struct::Processor& pInfo, break; // Phenom Family - case 15: + case 15: pInfo.type = CPU_AMD_Phenom; pInfo.name = StringTable->insert("AMD Phenom"); break; - // Phenom II Family - case 16: + // Phenom II Family + case 16: pInfo.type = CPU_AMD_PhenomII; pInfo.name = StringTable->insert("AMD Phenom II"); break; - // Bulldozer Family - case 17: + // Bulldozer Family + case 17: pInfo.type = CPU_AMD_Bulldozer; pInfo.name = StringTable->insert("AMD Bulldozer"); break;