From adfa3cf418c9ee685b3f72802e47ccea59ed0891 Mon Sep 17 00:00:00 2001 From: scorpioblood <77296181+scorpioblood@users.noreply.github.com> Date: Fri, 24 May 2024 23:44:49 +0200 Subject: [PATCH] Rename OSAL to HAL. --- .../Core/public/{OSAL => HAL}/Platform.h | 72 ++++++++++++++++--- .../Core/public/{OSAL => HAL}/PlatformTypes.h | 0 .../Source/Runtime/Core/public/HAL/README.md | 6 ++ .../Source/Runtime/Core/public/OSAL/README.md | 14 ---- 4 files changed, 68 insertions(+), 24 deletions(-) rename Engine/Source/Runtime/Core/public/{OSAL => HAL}/Platform.h (76%) rename Engine/Source/Runtime/Core/public/{OSAL => HAL}/PlatformTypes.h (100%) create mode 100644 Engine/Source/Runtime/Core/public/HAL/README.md delete mode 100644 Engine/Source/Runtime/Core/public/OSAL/README.md diff --git a/Engine/Source/Runtime/Core/public/OSAL/Platform.h b/Engine/Source/Runtime/Core/public/HAL/Platform.h similarity index 76% rename from Engine/Source/Runtime/Core/public/OSAL/Platform.h rename to Engine/Source/Runtime/Core/public/HAL/Platform.h index b6eb9a4..fed865b 100644 --- a/Engine/Source/Runtime/Core/public/OSAL/Platform.h +++ b/Engine/Source/Runtime/Core/public/HAL/Platform.h @@ -2,26 +2,37 @@ #pragma once + + // Set platform MACRO depending on defined build + +#define P_PLATFORM_WIN 0 +#define P_PLATFORM_LIN 1 +#define P_PLATFORM_MAC 2 +// #define P_PLATFORM_FBSD 3 -> Is planed for eventual PS5 support + // User defines build platform #ifdef P_WIN_BUILD -#define P_PLATFORM 0 +# define P_PLATFORM P_PLATFORM_WIN #elif P_LINUX_BUILD -#define P_PLATFORM 1 -#elif P_APPLE_BUILD -#define P_PLATFORM 2 -#elif P_PS5_BUILD -#define P_PLATFORM 3 +# define P_PLATFORM P_PLATFORM_LIN +# error Linux / Unix system is not yet supported. +#elif P_MAC_BUILD +# define P_PLATFORM P_PLATFORM_MAC +# error Mac target system is not yet supported. +#elif P_PS5_BUILD || P_FBSD_BUILD +# define P_PLATFORM P_PLATFORM_FBSD +# error FreeBSD is not yet supported. #else -#error Your target system is either not supported, or you have yet to define it. +# error Your target system is either not supported, or you have yet to define it. #endif // Set compiler depending on defined compiler // Compiler macro definition -// ID's defines like [0-9][0-x] -// First bracket is compiler, second is the version of the compiler. +// ID's defined like [0-9][0-x] +// First bracket defines compiler, second defines the version of the compiler. // Visual C++ #define P_COMPILER_VC22 001 @@ -122,7 +133,7 @@ // Clang #elif (defined(__clang__)) - +# error PhanesEngine only supports MSVC -> Visual Studio # if defined(__apple_build_version__) # # if (__clang_major__ < 6) @@ -188,6 +199,7 @@ // G++ #elif defined(__GNUC__) || defined(__MINGW32__) +# error PhanesEngine only supports MSVC -> Visual Studio # if __GNUC__ >= 14 # define P_COMPILER P_COMPILER_GCC14 # elif __GNUC__ >= 13 @@ -225,3 +237,43 @@ #endif + + + +// Vector instruction sets + + +// Define also supported instruction sets for Visual Studio, as it only defines the latest (e.g. only __AVX__ not __SSE4__ ...). + +#ifdef __AVX2__ +#define __AVX__ +#endif + +#ifdef __AVX__ +#define __SSE__ +#define P_SSE__ // Defined for Visual C++ -> Does not set __SSE__ automatically +#endif + + +#define P_INTRINSICS_FPU 0 +#define P_INTRINSICS_AVX 1 +#define P_INTRINSICS_AVX2 2 +#define P_INTRINSICS_SSE 3 +#define P_INTRINSICS_NEON 4 + + +#if defined(P_FORCE_FPU) // Force, that no intrinsics may be used. +# define P_INTRINSICS P_INTRINSICS_FPU +#elif !defined(P_FORCE_INTRINSICS) // If P_FORCE_INTRINSICS is defined, user has to define P_INTRINSICS. +# if defined(__AVX__) && !defined(__AVX2__) +# define P_INTRINSICS P_INTRINSICS_AVX +# elif defined(__AVX2__) +# define P_INTRINSICS P_INTRINSICS_AVX2 +# elif (defined(__SSE__) || defined(P_SSE__)) && !defined(__AVX__) +# define P_INTRINSICS P_INTRINSICS_SSE +# elif defined(P_ARM_ARCH) +# define P_INTRINSICS P_INTRINSICS_NEON +# else +# error No SIMD instruction set detected. Use P_FORCE_FPU to disable SIMD extensions. +# endif +#endif \ No newline at end of file diff --git a/Engine/Source/Runtime/Core/public/OSAL/PlatformTypes.h b/Engine/Source/Runtime/Core/public/HAL/PlatformTypes.h similarity index 100% rename from Engine/Source/Runtime/Core/public/OSAL/PlatformTypes.h rename to Engine/Source/Runtime/Core/public/HAL/PlatformTypes.h diff --git a/Engine/Source/Runtime/Core/public/HAL/README.md b/Engine/Source/Runtime/Core/public/HAL/README.md new file mode 100644 index 0000000..42f9442 --- /dev/null +++ b/Engine/Source/Runtime/Core/public/HAL/README.md @@ -0,0 +1,6 @@ +# PhanesCore +## HAL + +### Descritpion + +Contains abstraction necessary for cross platform compatability. Including but not limited to specific datatypes / Vector-intrinsics. diff --git a/Engine/Source/Runtime/Core/public/OSAL/README.md b/Engine/Source/Runtime/Core/public/OSAL/README.md deleted file mode 100644 index 5971a5f..0000000 --- a/Engine/Source/Runtime/Core/public/OSAL/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# PhanesCore -## Operating System Abstraction Layer (OSAL) - -### Descritpion - -Contains abstraction necessary for cross platform compatability. Including but not limited to specific datatypes. - -### Note - -- The PhanesEngine will have no console support in the near future. - -- Testing will only happen for Windows. GCC compatability will be partitally included, but by far not fully. Though support is planed for future versions. - -- Minimum SSE4.1 is required to compile the engine.