Skip to content

Commit a960f3b

Browse files
committed
v9.4
1 parent e371845 commit a960f3b

File tree

6 files changed

+197
-48
lines changed

6 files changed

+197
-48
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
BasedOnStyle: LLVM # use LLVM defauls
33
IndentWidth: 4
4+
ColumnLimit: 80
45

56
# reset if not set
67
AllowShortFunctionsOnASingleLine: None

include/pal/pal_opengl.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ freely, subject to the following restrictions:
5252
typedef struct PalGLContext PalGLContext;
5353

5454
/**
55-
* @enum PalGLExtension
55+
* @enum PalGLExtensions
5656
* @brief Opengl system extensions.
5757
*
58-
* @note All opengl extensions follow the format `PAL_GL_EXTENSION**` for
58+
* @note All opengl extensions follow the format `PAL_GL_EXTENSION_**` for
5959
* consistency and API use.
6060
*
6161
* @sa PalGLInfo
@@ -94,13 +94,13 @@ typedef enum {
9494

9595
/** Standard red, green and blue.*/
9696
PAL_GL_EXTENSION_COLORSPACE_SRGB = PAL_BIT(9)
97-
} PalGLExtension;
97+
} PalGLExtensions;
9898

9999
/**
100100
* @enum PalGLProfile
101-
* @brief Oepngl context creation profiles. This is not a bitmask.
101+
* @brief Opengl context creation profiles. This is not a bitmask.
102102
*
103-
* @note All opengl profiles follow the format `PAL_GL_PROFILE**` for
103+
* @note All opengl profiles follow the format `PAL_GL_PROFILE_**` for
104104
* consistency and API use.
105105
*
106106
* @since Added in version 1.0.0.
@@ -125,9 +125,9 @@ typedef enum {
125125

126126
/**
127127
* @enum PalGLContextReset
128-
* @brief Oepngl context reset behavior. This is not a bitmask.
128+
* @brief Opengl context reset behavior. This is not a bitmask.
129129
*
130-
* @note All context reset behavior follow the format `PAL_GL_CONTEXT_RESET**`
130+
* @note All context reset behavior follow the format `PAL_GL_CONTEXT_RESET_**`
131131
* for consistency and API use.
132132
*
133133
* @since Added in version 1.0.0.
@@ -148,10 +148,10 @@ typedef enum {
148148

149149
/**
150150
* @enum PalGLRelease
151-
* @brief Oepngl context release behavior. This is not a bitmask.
151+
* @brief Opengl context release behavior. This is not a bitmask.
152152
*
153153
* @note All opengl context release behavior follow the format
154-
* `PAL_GL_RELEASE_BEHAVIOR**` for consistency and API use.
154+
* `PAL_GL_RELEASE_BEHAVIOR_**` for consistency and API use.
155155
*
156156
* @since Added in version 1.0.0.
157157
* @ingroup opengl
@@ -175,8 +175,8 @@ typedef enum {
175175
* @ingroup opengl
176176
*/
177177
typedef struct {
178-
/** Supported opengl extensions. see PalGLExtension.*/
179-
PalGLExtension extensions;
178+
/** Supported opengl extensions. see PalGLExtensions.*/
179+
PalGLExtensions extensions;
180180

181181
/** Highest supported opengl major.*/
182182
Uint32 major;

include/pal/pal_system.h

Lines changed: 170 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
*/
4154
typedef 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+
*/
4984
typedef 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+
*/
64135
typedef 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+
*/
72165
typedef 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+
*/
78185
typedef 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+
*/
87215
typedef 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
*/
114259
PAL_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
*/
131279
PAL_API PalResult PAL_CALL palGetCPUInfo(

src/opengl/pal_opengl_win32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ PalResult PAL_CALL palInitGL(const PalAllocator* allocator)
300300

301301
s_Wgl.wglMakeCurrent =
302302
(wglMakeCurrentFn)GetProcAddress(s_Wgl.opengl, "wglMakeCurrent");
303-
303+
304304
s_Wgl.wglShareLists =
305305
(wglShareListsFn)GetProcAddress(s_Wgl.opengl, "wglShareLists");
306306

0 commit comments

Comments
 (0)