[Scummvm-git-logs] scummvm master -> a52202a1a80d65dbb924b11cc55abf5d25671d90

grisenti noreply at scummvm.org
Thu Sep 7 06:30:59 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a52202a1a8 HPL1: Remove unused platform specific code


Commit: a52202a1a80d65dbb924b11cc55abf5d25671d90
    https://github.com/scummvm/scummvm/commit/a52202a1a80d65dbb924b11cc55abf5d25671d90
Author: grisenti (emanuele at grisenti.net)
Date: 2023-09-07T08:30:43+02:00

Commit Message:
HPL1: Remove unused platform specific code

Changed paths:
    engines/hpl1/engine/libraries/newton/Newton.cpp
    engines/hpl1/engine/libraries/newton/core/dgTypes.cpp
    engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp


diff --git a/engines/hpl1/engine/libraries/newton/Newton.cpp b/engines/hpl1/engine/libraries/newton/Newton.cpp
index 94947a982af..53a4d83ce3e 100644
--- a/engines/hpl1/engine/libraries/newton/Newton.cpp
+++ b/engines/hpl1/engine/libraries/newton/Newton.cpp
@@ -23,6 +23,7 @@
 #include "Newton.h"
 #include "NewtonClass.h"
 #include "NewtonStdAfx.h"
+#include "hpl1/debug.h"
 
 void NewtonInitGlobals() {
 	dgInitMemoryGlobals();
@@ -261,9 +262,7 @@ void NewtonInvalidateCache(NewtonWorld *const newtonWorld) {
 // See also: NewtonGetPlatformArchitecture
 void NewtonSetPlatformArchitecture(NewtonWorld *const newtonWorld,
                                    int mode) {
-	TRACE_FUNTION(__FUNCTION__);
-	Newton *const world = (Newton *)newtonWorld;
-	world->SetHardwareMode(mode);
+	HPL1_UNIMPLEMENTED(NewtonSetPlatformArchitecture);
 }
 
 // Name: NewtonGetPlatformArchitecture
diff --git a/engines/hpl1/engine/libraries/newton/core/dgTypes.cpp b/engines/hpl1/engine/libraries/newton/core/dgTypes.cpp
index 3048817f3ba..2de7748e07a 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgTypes.cpp
+++ b/engines/hpl1/engine/libraries/newton/core/dgTypes.cpp
@@ -74,164 +74,6 @@ void GetMinMax(dgBigVector &minOut, dgBigVector &maxOut,
 	}
 }
 
-#ifdef _MSC_VER
-
-#ifdef DG_BUILD_SIMD_CODE
-#if (_MSC_VER >= 1400)
-static bool DetectSSE_3() {
-	__try {
-		__m128 i;
-		i = _mm_set_ps(dgFloat32(1.0f), dgFloat32(2.0f), dgFloat32(3.0f), dgFloat32(4.0f));
-		i = _mm_hadd_ps(i, i);
-		i = _mm_hadd_ps(i, i);
-		i = i;
-//					i = _mm_dp_ps(i, i, 0);
-//					i = _mm_dp_ps(i, i, 0);
-//					i = _mm_hadd_ps(i, i);
-	} __except (EXCEPTION_EXECUTE_HANDLER) {
-		return false;
-	}
-
-	return true;
-}
-#else
-static bool DetectSSE_3() {
-	return false;
-}
-#endif // _MSC_VER >= 1400
-static bool DetectSSE() {
-	__try {
-		__m128 i;
-		i = _mm_set_ps(dgFloat32(1.0f), dgFloat32(2.0f), dgFloat32(3.0f), dgFloat32(4.0f));
-		i = _mm_add_ps(i, i);
-		i = i;
-	} __except (EXCEPTION_EXECUTE_HANDLER) {
-		return false;
-	}
-
-	return true;
-}
-#else
-static bool DetectSSE_3() {
-	return false;
-}
-
-static bool DetectSSE() {
-	return false;
-}
-#endif // DG_BUILD_SIMD_CODE
-
-dgCpuClass dgApi dgGetCpuType() {
-	if (DetectSSE_3()) {
-		return dgSimdPresent;
-	}
-
-	if (DetectSSE()) {
-		return dgSimdPresent;
-	}
-
-	return dgNoSimdPresent;
-}
-
-#elif defined(__APPLE__)
-
-dgCpuClass dgApi dgGetCpuType() {
-#ifdef __ppc__
-
-	return dgNoSimdPresent;
-	/*
- #ifdef   _SCALAR_AROTHMETIC_ONLY
-	 return dgNoSimdPresent;
- #else
-	 dgInt32 error;
-	 dgInt32 hasSimd;
-	 size_t length = sizeof( hasSimd );
-
-	 hasSimd = 0;
-	 error = sysctlbyname("hw.optional.altivec", & hasSimd, &length, NULL, 0);
-	 if (error) {
-	 return dgNoSimdPresent;
-	 }
-	 if (hasSimd) {
-	 return dgSimdPresent;
-	 }
-	 return dgNoSimdPresent;
- #endif
-	 */
-#else
-	dgInt32 error;
-	dgInt32 hasSimd;
-	size_t length = sizeof(hasSimd);
-
-	hasSimd = 0;
-	error = sysctlbyname("hw.optional.sse2", & hasSimd, &length, NULL, 0);
-	if (error) {
-		return dgNoSimdPresent;
-	}
-	if (hasSimd) {
-		return dgSimdPresent;
-	}
-	return dgNoSimdPresent;
-#endif
-
-}
-
-#elif defined(HAVE_X86) || defined(HAVE_AMD64)
-/*  #define cpuid(func,ax,bx,cx,dx) __asm__ __volatile__ ("cpuid": "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func)); */
-
-void cpuid(dgUnsigned32 op, dgUnsigned32 reg[4]) {
-	asm volatile(
-#ifdef __x86_64__
-	    "pushq %%rbx      \n\t" /* save %rbx */
-#else
-	    "pushl %%ebx      \n\t" /* save %ebx */
-#endif
-
-	    "cpuid            \n\t"
-	    "movl %%ebx, %1   \n\t" /* save what cpuid just put in %ebx */
-
-#ifdef __x86_64__
-	    "popq %%rbx       \n\t" /* restore the old %rbx */
-#else
-	    "popl %%ebx       \n\t" /* restore the old %ebx */
-#endif
-	    : "=a"(reg[0]), "=r"(reg[1]), "=c"(reg[2]), "=d"(reg[3])
-	    : "a"(op)
-	    : "cc");
-}
-
-static dgInt32 cpuid(void) {
-//		int a, b, c, d;
-//		cpuid(1,a,b,c,d);
-//		return d;
-
-	dgUnsigned32 reg[4];
-	cpuid(1, reg);
-	return reg[3];
-}
-
-dgCpuClass dgApi dgGetCpuType() {
-#define bit_MMX (1 << 23)
-#define bit_SSE (1 << 25)
-#define bit_SSE2 (1 << 26)
-
-#ifndef __USE_DOUBLE_PRECISION__
-	if (cpuid() & bit_SSE) {
-		return dgSimdPresent;
-	}
-#endif
-
-	return dgNoSimdPresent;
-}
-
-#else // defined(HAVE_X86) || defined(HAVE_AMD64)
-
-dgCpuClass dgApi dgGetCpuType() {
-	return dgNoSimdPresent;
-}
-
-
-#endif
 
 static inline dgInt32 cmp_vertex(const dgFloat64 *const v1,
                                  const dgFloat64 *const v2, dgInt32 firstSortAxis) {
diff --git a/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp b/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
index 681aa38cbdb..a6a92b186ca 100644
--- a/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
+++ b/engines/hpl1/engine/libraries/newton/physics/dgWorld.cpp
@@ -20,9 +20,9 @@
  */
 
 #include "dgWorld.h"
+#include "hpl1/debug.h"
 #include "hpl1/engine/libraries/newton/core/dg.h"
 
-
 #include "dgCollisionBox.h"
 #include "dgCollisionCapsule.h"
 #include "dgCollisionChamferCylinder.h"
@@ -288,13 +288,7 @@ dgWorld::dgWorld(dgMemoryAllocator *allocator) : // dgThreadHive(),
 
 	m_cpu = dgNoSimdPresent;
 	m_numberOfTheads = 1;
-
-	SetHardwareMode(1);
-	SetThreadsCount(DG_MAXIMUN_THREADS);
-	m_maxTheads = m_numberOfTheads;
-
-	SetHardwareMode(0);
-	SetThreadsCount(1);
+	m_maxTheads = 1;
 
 	dgBroadPhaseCollision::Init();
 	dgCollidingPairCollector::Init();
@@ -350,10 +344,7 @@ void dgWorld::SetFrictionMode(dgInt32 mode) {
 }
 
 void dgWorld::SetHardwareMode(dgInt32 mode) {
-	m_cpu = dgNoSimdPresent;
-	if (mode) {
-		m_cpu = dgGetCpuType();
-	}
+	HPL1_UNIMPLEMENTED(dgWorld::SetHardwareMode);
 }
 
 dgInt32 dgWorld::GetHardwareMode(char *description) const {




More information about the Scummvm-git-logs mailing list