1 /+
2 +            Copyright 2022 – 2024 Aya Partridge
3 +          Copyright 2018 - 2022 Michael D. Parker
4 + Distributed under the Boost Software License, Version 1.0.
5 +     (See accompanying file LICENSE_1_0.txt or copy at
6 +           http://www.boost.org/LICENSE_1_0.txt)
7 +/
8 module sdl.cpuinfo;
9 
10 import bindbc.sdl.config;
11 import bindbc.sdl.codegen;
12 
13 import sdl.stdinc: SDL_bool;
14 
15 enum SDL_CACHELINE_SIZE = 128;
16 
17 mixin(joinFnBinds((){
18 	FnBind[] ret = [
19 		{q{int}, q{SDL_GetCPUCount}, q{}},
20 		{q{int}, q{SDL_GetCPUCacheLineSize}, q{}},
21 		{q{SDL_bool}, q{SDL_HasRDTSC}, q{}},
22 		{q{SDL_bool}, q{SDL_HasAltiVec}, q{}},
23 		{q{SDL_bool}, q{SDL_HasMMX}, q{}},
24 		{q{SDL_bool}, q{SDL_Has3DNow}, q{}},
25 		{q{SDL_bool}, q{SDL_HasSSE}, q{}},
26 		{q{SDL_bool}, q{SDL_HasSSE2}, q{}},
27 		{q{SDL_bool}, q{SDL_HasSSE3}, q{}},
28 		{q{SDL_bool}, q{SDL_HasSSE41}, q{}},
29 		{q{SDL_bool}, q{SDL_HasSSE42}, q{}},
30 	];
31 	if(sdlSupport >= SDLSupport.v2_0_1){
32 		FnBind[] add = [
33 			{q{int}, q{SDL_GetSystemRAM}, q{}},
34 		];
35 		ret ~= add;
36 	}
37 	if(sdlSupport >= SDLSupport.v2_0_2){
38 		FnBind[] add = [
39 			{q{SDL_bool}, q{SDL_HasAVX}, q{}},
40 		];
41 		ret ~= add;
42 	}
43 	if(sdlSupport >= SDLSupport.v2_0_4){
44 		FnBind[] add = [
45 			{q{SDL_bool}, q{SDL_HasAVX2}, q{}},
46 		];
47 		ret ~= add;
48 	}
49 	if(sdlSupport >= SDLSupport.v2_0_6){
50 		FnBind[] add = [
51 			{q{SDL_bool}, q{SDL_HasNEON}, q{}},
52 		];
53 		ret ~= add;
54 	}
55 	if(sdlSupport >= SDLSupport.v2_0_9){
56 		FnBind[] add = [
57 			{q{SDL_bool}, q{SDL_HasAVX512F}, q{}},
58 		];
59 		ret ~= add;
60 	}
61 	if(sdlSupport >= SDLSupport.v2_0_10){
62 		FnBind[] add = [
63 			{q{size_t}, q{SDL_SIMDGetAlignment}, q{}},
64 			{q{void*}, q{SDL_SIMDAlloc}, q{const(size_t) len}},
65 			{q{void}, q{SDL_SIMDFree}, q{void*}},
66 		];
67 		ret ~= add;
68 	}
69 	if(sdlSupport >= SDLSupport.v2_0_12){
70 		FnBind[] add = [
71 			{q{SDL_bool}, q{SDL_HasARMSIMD}, q{}},
72 		];
73 		ret ~= add;
74 	}
75 	if(sdlSupport >= SDLSupport.v2_0_14){
76 		FnBind[] add = [
77 			{q{void*}, q{SDL_SIMDRealloc}, q{void* mem, const(size_t) len}},
78 		];
79 		ret ~= add;
80 	}
81 	if(sdlSupport >= SDLSupport.v2_24){
82 		FnBind[] add = [
83 			{q{SDL_bool}, q{SDL_HasLSX}, q{}},
84 			{q{SDL_bool}, q{SDL_HasLASX}, q{}},
85 		];
86 		ret ~= add;
87 	}
88 	return ret;
89 }()));