Jeff Hutchinson 3 роки тому
батько
коміт
960ea2aa5a

+ 1 - 0
Engine/source/platform/platform.h

@@ -80,6 +80,7 @@ enum ProcessorProperties
    CPU_PROP_MP        = (1<<11), ///< This is a multi-processor system.
    CPU_PROP_LE        = (1<<12), ///< This processor is LITTLE ENDIAN.  
    CPU_PROP_64bit     = (1<<13), ///< This processor is 64-bit capable
+   CPU_PROP_NEON      = (1<<14), ///< Supports the Arm Neon instruction set extension.
 };
 
 /// Processor info manager. 

+ 15 - 4
Engine/source/platformMac/macCPU.mm

@@ -94,6 +94,11 @@ static void detectCpuFeatures(U32 &procflags)
    int err;
    U32 lraw;
    
+   // All Cpus have fpu
+   procflags = CPU_PROP_FPU;
+   
+#if defined(TORQUE_CPU_X86) || defined(TORQUE_CPU_X64)
+   
    // List of chip-specific features
    err = _getSysCTLvalue<U32>("hw.optional.mmx", &lraw);
    if ((err==0)&&(lraw==1))
@@ -119,6 +124,12 @@ static void detectCpuFeatures(U32 &procflags)
    err = _getSysCTLvalue<U32>("hw.optional.avx1_0", &lraw);
    if ((err==0)&&(lraw==1))
       procflags |= CPU_PROP_AVX;
+   
+#elif defined(TORQUE_CPU_ARM64)
+   // All Apple Cpus have Neon
+   procflags |= CPU_PROP_NEON;
+   
+#endif
 
    err = _getSysCTLvalue<U32>("hw.ncpu", &lraw);
    if ((err==0)&&(lraw>1))
@@ -129,12 +140,11 @@ static void detectCpuFeatures(U32 &procflags)
    err = _getSysCTLvalue<U32>("hw.byteorder", &lraw);
    if ((err==0)&&(lraw==1234))
       procflags |= CPU_PROP_LE;
-   
 }
 
 void Processor::init()
 {
-	U32 procflags;
+	U32 procflags = 0;
 	int err, cpufam, cputype, cpusub;
 	char buf[255];
 	U32 lraw;
@@ -170,7 +180,6 @@ void Processor::init()
 	}
 	Platform::SystemInfo.processor.mhz = (unsigned int)llraw;
 	
-   procflags = CPU_PROP_FPU;
    detectCpuFeatures(procflags);
    
    Platform::SystemInfo.processor.properties = procflags;
@@ -197,7 +206,9 @@ void Processor::init()
 		Con::printf("      SSE4.2 detected");
    if (Platform::SystemInfo.processor.properties & CPU_PROP_AVX)
       Con::printf("      AVX detected");
-	
+	if (Platform::SystemInfo.processor.properties & CPU_PROP_NEON)
+      Con::printf("      Neon detected");
+   
 	Con::printf( "" );
    
    // Trigger the signal