@@ -38,94 +38,242 @@ freely, subject to the following restrictions:
3838#define PAL_CPU_VENDOR_NAME_SIZE 16
3939#define PAL_CPU_MODEL_NAME_SIZE 64
4040
41+ /**
42+ * @enum PalCpuArch
43+ * @brief CPU achitecture This is not a bitmask.
44+ *
45+ * This is a build time achitecture. Example: Generating your project with x64
46+ * will reflect PAL_CPU_ARCH_X86_64.
47+ *
48+ * @note All CPU achitectures follow the format `PAL_CPU_ARCH_**` for
49+ * consistency and API use.
50+ *
51+ * @since Added in version 1.0.0.
52+ * @ingroup system
53+ */
4154typedef enum {
55+ /** Unknown Architecture.*/
4256 PAL_CPU_ARCH_UNKNOWN ,
43- PAL_CPU_ARCH_X86 , /** < 32 bit Architecture.*/
44- PAL_CPU_ARCH_X86_64 , /** < 64 bit Architecture.*/
57+
58+ /** 32 bit Architecture.*/
59+ PAL_CPU_ARCH_X86 ,
60+
61+ /** 64 bit Architecture.*/
62+ PAL_CPU_ARCH_X86_64 ,
63+
64+ /** Arm Architecture.*/
4565 PAL_CPU_ARCH_ARM ,
66+
67+ /** Arm64 Architecture.*/
4668 PAL_CPU_ARCH_ARM64
4769} PalCpuArch ;
4870
71+ /**
72+ * @enum PalCpuFeatures
73+ * @brief CPU features (instruction sets).
74+ *
75+ * @note All CPU features sets follow the format `PAL_CPU_FEATURE_**` for
76+ * consistency and API use.
77+ *
78+ * @sa PalCPUInfo
79+ * @sa palGetCPUInfo()
80+ *
81+ * @since Added in version 1.0.0.
82+ * @ingroup system
83+ */
4984typedef enum {
85+ /** SSE (SIMD operations) instruction set.*/
5086 PAL_CPU_FEATURE_SSE = PAL_BIT (0 ),
87+
88+ /** SSE2 (SIMD operations) instruction set.*/
5189 PAL_CPU_FEATURE_SSE2 = PAL_BIT (1 ),
90+
91+ /** SSE3 (SIMD operations) instruction set.*/
5292 PAL_CPU_FEATURE_SSE3 = PAL_BIT (2 ),
93+
94+ /** SSSE3 (SIMD operations) instruction set.*/
5395 PAL_CPU_FEATURE_SSSE3 = PAL_BIT (3 ),
54- PAL_CPU_FEATURE_SSE41 = PAL_BIT (4 ), /** < SSE4.1 instruction set.*/
55- PAL_CPU_FEATURE_SSE42 = PAL_BIT (5 ), /** < SSE4.2 instruction set.*/
96+
97+ /** SSE4.1 (SIMD operations) instruction set.*/
98+ PAL_CPU_FEATURE_SSE41 = PAL_BIT (4 ),
99+
100+ /** SSE4.2 (SIMD operations) instruction set.*/
101+ PAL_CPU_FEATURE_SSE42 = PAL_BIT (5 ),
102+
103+ /** AVX (SIMD operations) instruction set.*/
56104 PAL_CPU_FEATURE_AVX = PAL_BIT (6 ),
105+
106+ /** AVX2 (SIMD operations) instruction set.*/
57107 PAL_CPU_FEATURE_AVX2 = PAL_BIT (7 ),
108+
109+ /** AVX512F (SIMD operations) instruction set.*/
58110 PAL_CPU_FEATURE_AVX512F = PAL_BIT (8 ),
111+
112+ /** FMA3 instruction set.*/
59113 PAL_CPU_FEATURE_FMA3 = PAL_BIT (9 ),
114+
115+ /** BMI1 instruction set.*/
60116 PAL_CPU_FEATURE_BMI1 = PAL_BIT (10 ),
117+
118+ /** BMI2 instruction set.*/
61119 PAL_CPU_FEATURE_BMI2 = PAL_BIT (11 )
62120} PalCpuFeatures ;
63121
122+ /**
123+ * @enum PalPlatformType
124+ * @brief Platform types. This is not a bitmask.
125+ *
126+ * This is the family name (eg. This does not show if its Windows 7 or Windows 8
127+ * etc)
128+ *
129+ * @note All platform types follow the format `PAL_PLATFORM_**` for
130+ * consistency and API use.
131+ *
132+ * @since Added in version 1.0.0.
133+ * @ingroup system
134+ */
64135typedef enum {
136+ /** Windows Platform (OS).*/
65137 PAL_PLATFORM_WINDOWS ,
138+
139+ /** Linux Platform (OS).*/
66140 PAL_PLATFORM_LINUX ,
141+
142+ /** MacOS Platform (OS).*/
67143 PAL_PLATFORM_MACOS ,
144+
145+ /** Android Platform (OS).*/
68146 PAL_PLATFORM_ANDROID ,
147+
148+ /** IOS Platform (OS).*/
69149 PAL_PLATFORM_IOS
70150} PalPlatformType ;
71151
152+ /**
153+ * @enum PalPlatformApiType
154+ * @brief Platform API types. This is not a bitmask.
155+ *
156+ * This is the API the playform uses. Most platforms support only one (eg.
157+ * Windows)
158+ *
159+ * @note All platform API types follow the format `PAL_PLATFORM_API_**` for
160+ * consistency and API use.
161+ *
162+ * @since Added in version 1.0.0.
163+ * @ingroup system
164+ */
72165typedef enum {
166+ /** Win32 API.*/
73167 PAL_PLATFORM_API_WIN32 ,
168+
169+ /** Wayland API.*/
74170 PAL_PLATFORM_API_WAYLAND ,
171+
172+ /** X11 API.*/
75173 PAL_PLATFORM_API_X11
76174} PalPlatformApiType ;
77175
176+ /**
177+ * @struct PalPlatformInfo
178+ * @brief Information about a platform (OS).
179+ *
180+ * @sa palGetPlatformInfo()
181+ *
182+ * @since Added in version 1.0.0.
183+ * @ingroup system
184+ */
78185typedef struct {
186+ /** Platform family type. See PalPlatformType.*/
79187 PalPlatformType type ;
188+
189+ /** Platform API type. See PalPlatformApiType.*/
80190 PalPlatformApiType apiType ;
81- Uint32 totalMemory ; /** < Total Disk memory*/
82- Uint32 totalRAM ; /** < Total CPU memory*/
83- PalVersion version ; /** < Platform version*/
191+
192+ /** Total Disk space (memory) in GB.*/
193+ Uint32 totalMemory ;
194+
195+ /** Total CPU RAM (memory) in MB.*/
196+ Uint32 totalRAM ;
197+
198+ /** < Use this to check a specific platform aside the family.*/
199+ PalVersion version ;
200+
201+ /** < This is the platform name with the version combined as a UTF-8
202+ * encoding string. (eg. Windows 11.22000)*/
84203 char name [PAL_PLATFORM_NAME_SIZE ];
85204} PalPlatformInfo ;
86205
206+ /**
207+ * @struct PalCPUInfo
208+ * @brief Information about a CPU.
209+ *
210+ * @sa palGetCPUInfo()
211+ *
212+ * @since Added in version 1.0.0.
213+ * @ingroup system
214+ */
87215typedef struct {
88- Uint32 numCores ; /** < Number of cores*/
89- Uint32 cache1 ; /** < L1 cache in KB*/
90- Uint32 cache2 ; /** < L2 cache in KB*/
91- Uint32 cache3 ; /** < L3 cache in KB*/
92- Uint32 numLogicalProcessors ; /** < Number of threads that can run
93- simultaneously*/
94- PalCpuArch architecture ; /** < Build architecture. Based on how the project
95- will be built.*/
96- PalCpuFeatures features ; /** < Supported instruction sets*/
216+ /** Number of CPU cores.*/
217+ Uint32 numCores ;
218+
219+ /** L1 cache in KB.*/
220+ Uint32 cacheL1 ;
221+
222+ /** L2 cache in KB.*/
223+ Uint32 cacheL2 ;
224+
225+ /** L3 cache in KB.*/
226+ Uint32 cacheL3 ;
227+
228+ /** Number of threads that can run simultaneously (CPUs).*/
229+ Uint32 numLogicalProcessors ;
230+
231+ /** Based on how the project will be or built. See PalCpuArch.*/
232+ PalCpuArch architecture ;
233+
234+ /** Supported CPU instruction sets.*/
235+ PalCpuFeatures features ;
236+
237+ /** CPU vendor name. (eg. GenuineIntel).*/
97238 char vendor [PAL_CPU_VENDOR_NAME_SIZE ];
239+
240+ /** CPU modal name.*/
98241 char model [PAL_CPU_MODEL_NAME_SIZE ];
99242} PalCPUInfo ;
100243
101244/**
102245 * @brief Get platform (OS) information.
103246 *
104- * @param[out] info Pointer to receive the platform info.
247+ * @param[out] info Pointer to a PalPlatformInfo to receive the platform info.
105248 *
106249 * @return `PAL_RESULT_SUCCESS` on success or an appropriate result code on
107- * failure.
250+ * failure. Call palFormatResult() for more information.
108251 *
109252 * @note This function is not thread-safe.
110253 *
111254 * @sa PalPlatformInfo
255+ *
256+ * @since Added in version 1.0.0.
112257 * @ingroup system
113258 */
114259PAL_API PalResult PAL_CALL palGetPlatformInfo (PalPlatformInfo * info );
115260
116261/**
117262 * @brief Get CPU information.
118263 *
119- * @param[in] allocator Optional user provided allocator. Set to ` nullptr` to
264+ * @param[in] allocator Optional user provided allocator. Set to nullptr to
120265 * use default.
121- * @param[out] info Pointer to receive the CPU info.
266+ * @param[out] info Pointer to a PalCPUInfo to receive the CPU info.
122267 *
123268 * @return `PAL_RESULT_SUCCESS` on success or an appropriate result code on
124- * failure.
269+ * failure. Call palFormatResult() for more information.
125270 *
126271 * @note This function is not thread-safe.
127272 *
128- * @sa PalAllocator, PalCPUInfo
273+ * @sa PalAllocator
274+ * @sa PalCPUInfo
275+ *
276+ * @since Added in version 1.0.0.
129277 * @ingroup system
130278 */
131279PAL_API PalResult PAL_CALL palGetCPUInfo (
0 commit comments