bexxcv 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fingerprints.d.ts +6 -0
- package/dist/fingerprints.js +55 -24
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/dist/plugins/botscore.d.ts +34 -0
- package/dist/plugins/botscore.js +79 -0
- package/dist/plugins/brake.d.ts +4 -0
- package/dist/plugins/brake.js +29 -2
- package/dist/plugins/classify.d.ts +36 -0
- package/dist/plugins/classify.js +174 -0
- package/dist/plugins/ephemeral.d.ts +28 -0
- package/dist/plugins/ephemeral.js +131 -0
- package/dist/plugins/index-reexports.d.ts +14 -0
- package/dist/plugins/index-reexports.js +15 -0
- package/dist/plugins/index.d.ts +26 -13
- package/dist/plugins/index.js +27 -6
- package/dist/plugins/jsd.d.ts +23 -0
- package/dist/plugins/jsd.js +134 -0
- package/dist/plugins/precursor.d.ts +34 -0
- package/dist/plugins/precursor.js +136 -0
- package/dist/webgl/profiles.d.ts +4 -0
- package/dist/webgl/profiles.js +168 -118
- package/package.json +1 -1
package/dist/webgl/profiles.js
CHANGED
|
@@ -1,65 +1,92 @@
|
|
|
1
1
|
import { UAParser } from "ua-parser-js";
|
|
2
|
+
/**
|
|
3
|
+
* Level-max GPU profiles — expanded with 2024–2026 hardware, tighter weight distributions,
|
|
4
|
+
* and OS-specific renderer naming conventions that match real driver strings.
|
|
5
|
+
*/
|
|
2
6
|
export const KNOWN_GPUS = {
|
|
3
7
|
win: [
|
|
4
|
-
// Intel integrated
|
|
5
|
-
{ vendor: "Intel", renderer: "Intel(R) UHD Graphics 630", weight:
|
|
6
|
-
{ vendor: "Intel", renderer: "Intel(R) UHD Graphics 620", weight:
|
|
7
|
-
{ vendor: "Intel", renderer: "Intel(R) Iris Xe Graphics", weight:
|
|
8
|
-
{ vendor: "Intel", renderer: "Intel(R) HD Graphics
|
|
9
|
-
{ vendor: "Intel", renderer: "Intel(R)
|
|
10
|
-
{ vendor: "Intel", renderer: "Intel(R) UHD Graphics
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
{ vendor: "
|
|
14
|
-
{ vendor: "
|
|
15
|
-
{ vendor: "
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{ vendor: "
|
|
19
|
-
{ vendor: "
|
|
20
|
-
{ vendor: "
|
|
21
|
-
|
|
8
|
+
// ── Intel integrated (most common consumer desktops/laptops) ──────────
|
|
9
|
+
{ vendor: "Intel", renderer: "Intel(R) UHD Graphics 630", weight: 26 },
|
|
10
|
+
{ vendor: "Intel", renderer: "Intel(R) UHD Graphics 620", weight: 16 },
|
|
11
|
+
{ vendor: "Intel", renderer: "Intel(R) Iris(R) Xe Graphics", weight: 13 },
|
|
12
|
+
{ vendor: "Intel", renderer: "Intel(R) HD Graphics 630", weight: 7 },
|
|
13
|
+
{ vendor: "Intel", renderer: "Intel(R) UHD Graphics 770", weight: 5 },
|
|
14
|
+
{ vendor: "Intel", renderer: "Intel(R) UHD Graphics 750", weight: 4 },
|
|
15
|
+
{ vendor: "Intel", renderer: "Intel(R) Iris(R) Plus Graphics 650", weight: 3 },
|
|
16
|
+
// ── Intel Arc (2023+, growing market share) ────────────────────────────
|
|
17
|
+
{ vendor: "Intel", renderer: "Intel(R) Arc(TM) A770 Graphics", weight: 4 },
|
|
18
|
+
{ vendor: "Intel", renderer: "Intel(R) Arc(TM) A380 Graphics", weight: 3 },
|
|
19
|
+
{ vendor: "Intel", renderer: "Intel(R) Arc(TM) A580 Graphics", weight: 2 },
|
|
20
|
+
// ── NVIDIA discrete — mainstream gaming / creator ─────────────────────
|
|
21
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce GTX 1650", weight: 11 },
|
|
22
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce GTX 1050 Ti", weight: 6 },
|
|
23
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce RTX 3060", weight: 8 },
|
|
24
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce RTX 3060 Ti", weight: 5 },
|
|
25
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce RTX 3070", weight: 4 },
|
|
26
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce RTX 4060", weight: 4 },
|
|
27
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce RTX 4060 Ti", weight: 3 },
|
|
28
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce RTX 4070", weight: 2 },
|
|
29
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce RTX 2060", weight: 3 },
|
|
30
|
+
// ── AMD discrete ───────────────────────────────────────────────────────
|
|
31
|
+
{ vendor: "AMD", renderer: "AMD Radeon RX 6600", weight: 5 },
|
|
32
|
+
{ vendor: "AMD", renderer: "AMD Radeon RX 580 Series", weight: 3 },
|
|
33
|
+
{ vendor: "AMD", renderer: "AMD Radeon RX 7800 XT", weight: 3 },
|
|
34
|
+
{ vendor: "AMD", renderer: "AMD Radeon RX 7600", weight: 2 },
|
|
35
|
+
{ vendor: "AMD", renderer: "AMD Radeon RX 6700 XT", weight: 2 },
|
|
36
|
+
// ── VM / virtualised fallback ──────────────────────────────────────────
|
|
22
37
|
{ vendor: "Microsoft", renderer: "Microsoft Basic Render Driver", weight: 2 },
|
|
23
38
|
],
|
|
24
39
|
mac: [
|
|
25
|
-
// Apple Silicon
|
|
26
|
-
{ vendor: "Apple", renderer: "Apple
|
|
27
|
-
{ vendor: "Apple", renderer: "Apple
|
|
28
|
-
{ vendor: "Apple", renderer: "Apple
|
|
29
|
-
{ vendor: "Apple", renderer: "Apple
|
|
30
|
-
{ vendor: "Apple", renderer: "Apple
|
|
31
|
-
{ vendor: "Apple", renderer: "Apple M3", weight:
|
|
32
|
-
{ vendor: "Apple", renderer: "Apple
|
|
33
|
-
{ vendor: "Apple", renderer: "Apple
|
|
34
|
-
{ vendor: "Apple", renderer: "Apple
|
|
35
|
-
|
|
36
|
-
{ vendor: "Apple", renderer: "Apple
|
|
37
|
-
{ vendor: "Apple", renderer: "Apple
|
|
40
|
+
// ── Apple Silicon — dominant in 2024+ ────────────────────────────────
|
|
41
|
+
{ vendor: "Apple", renderer: "Apple M4", weight: 18 },
|
|
42
|
+
{ vendor: "Apple", renderer: "Apple M4 Pro", weight: 8 },
|
|
43
|
+
{ vendor: "Apple", renderer: "Apple M4 Max", weight: 4 },
|
|
44
|
+
{ vendor: "Apple", renderer: "Apple M3", weight: 16 },
|
|
45
|
+
{ vendor: "Apple", renderer: "Apple M3 Pro", weight: 8 },
|
|
46
|
+
{ vendor: "Apple", renderer: "Apple M3 Max", weight: 4 },
|
|
47
|
+
{ vendor: "Apple", renderer: "Apple M2", weight: 14 },
|
|
48
|
+
{ vendor: "Apple", renderer: "Apple M2 Pro", weight: 8 },
|
|
49
|
+
{ vendor: "Apple", renderer: "Apple M2 Max", weight: 4 },
|
|
50
|
+
{ vendor: "Apple", renderer: "Apple M1", weight: 10 },
|
|
51
|
+
{ vendor: "Apple", renderer: "Apple M1 Pro", weight: 6 },
|
|
52
|
+
{ vendor: "Apple", renderer: "Apple M1 Max", weight: 3 },
|
|
53
|
+
// ── Intel Macs (legacy enterprise still present) ─────────────────────
|
|
54
|
+
{ vendor: "Apple", renderer: "Apple Integrated GPU", weight: 3 },
|
|
55
|
+
{ vendor: "Apple", renderer: "Apple MacBook Pro GPU", weight: 1 },
|
|
38
56
|
],
|
|
39
57
|
lin: [
|
|
40
|
-
// Intel
|
|
41
|
-
{ vendor: "Intel", renderer: "Intel(R) HD Graphics 630 (KBL GT2)", weight:
|
|
58
|
+
// ── Intel integrated (Linux desktops/servers) ────────────────────────
|
|
59
|
+
{ vendor: "Intel", renderer: "Intel(R) HD Graphics 630 (KBL GT2)", weight: 16 },
|
|
42
60
|
{ vendor: "Intel", renderer: "Intel(R) UHD Graphics 630 (CFL GT2)", weight: 10 },
|
|
43
61
|
{ vendor: "Intel", renderer: "Intel(R) UHD Graphics 770 (ADL GT2)", weight: 7 },
|
|
44
|
-
{ vendor: "Intel", renderer: "Mesa Intel(R) UHD Graphics 620 (KBL GT2)", weight:
|
|
62
|
+
{ vendor: "Intel", renderer: "Mesa Intel(R) UHD Graphics 620 (KBL GT2)", weight: 5 },
|
|
45
63
|
{ vendor: "Intel", renderer: "Mesa Intel(R) UHD Graphics 630 (KBL GT2)", weight: 4 },
|
|
46
|
-
//
|
|
47
|
-
{ vendor: "
|
|
48
|
-
|
|
49
|
-
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce RTX
|
|
50
|
-
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce
|
|
51
|
-
|
|
64
|
+
// ── Intel Arc on Linux ───────────────────────────────────────────────
|
|
65
|
+
{ vendor: "Intel", renderer: "Intel(R) Arc(A770) (DG2)", weight: 3 },
|
|
66
|
+
// ── NVIDIA discrete ──────────────────────────────────────────────────
|
|
67
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce RTX 3060/PCIe/SSE2", weight: 8 },
|
|
68
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce RTX 3080/PCIe/SSE2", weight: 6 },
|
|
69
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce RTX 4090/PCIe/SSE2", weight: 4 },
|
|
70
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce RTX 4060/PCIe/SSE2", weight: 3 },
|
|
71
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce GTX 1650/PCIe/SSE2", weight: 4 },
|
|
72
|
+
{ vendor: "NVIDIA", renderer: "NVIDIA GeForce RTX 3060 Ti/PCIe/SSE2", weight: 3 },
|
|
73
|
+
// ── AMD discrete ─────────────────────────────────────────────────────
|
|
52
74
|
{ vendor: "AMD", renderer: "AMD Radeon RX 6600 (RADV NAVI23)", weight: 5 },
|
|
53
75
|
{ vendor: "AMD", renderer: "AMD Radeon RX 7800 XT (RADV NAVI32)", weight: 4 },
|
|
54
76
|
{ vendor: "AMD", renderer: "AMD Radeon Graphics (RADV NAVI21)", weight: 5 },
|
|
55
77
|
{ vendor: "AMD", renderer: "AMD Radeon RX 7900 XTX (RADV NAVI31)", weight: 3 },
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{ vendor: "llvmpipe", renderer: "llvmpipe (LLVM
|
|
59
|
-
{ vendor: "
|
|
78
|
+
{ vendor: "AMD", renderer: "AMD Radeon RX 6700 XT (RADV NAVI22)", weight: 3 },
|
|
79
|
+
// ── llvmpipe — headless CI / remote desktop / WSL2 ──────────────────
|
|
80
|
+
{ vendor: "llvmpipe", renderer: "llvmpipe (LLVM 17.0.6, 256 bits)", weight: 7 },
|
|
81
|
+
{ vendor: "llvmpipe", renderer: "llvmpipe (LLVM 16.0.6, 256 bits)", weight: 4 },
|
|
82
|
+
{ vendor: "llvmpipe", renderer: "llvmpipe (LLVM 15.0.7, 256 bits)", weight: 3 },
|
|
83
|
+
// ── ANGLE (Chromium-based renderers inside Firefox on Linux) ─────────
|
|
84
|
+
{ vendor: "Google Inc.", renderer: "ANGLE (Intel, Intel(R) UHD Graphics 630, OpenGL 4.6)", weight: 4 },
|
|
85
|
+
// ── WebRender (Firefox native) ───────────────────────────────────────
|
|
60
86
|
{ vendor: "Mozilla", renderer: "WebRender (NVIDIA Corporation -- 4.6 (Compatibility))", weight: 3 },
|
|
61
87
|
],
|
|
62
88
|
};
|
|
89
|
+
// ── WebGL extension pools ──────────────────────────────────────────────────────
|
|
63
90
|
const BASE_WEBGL_EXTENSIONS = [
|
|
64
91
|
"WEBGL_lose_context",
|
|
65
92
|
"WEBGL_compressed_texture_s3tc",
|
|
@@ -77,98 +104,103 @@ const BASE_WEBGL_EXTENSIONS = [
|
|
|
77
104
|
"EXT_texture_compression_rgtc",
|
|
78
105
|
"EXT_texture_filter_anisotropic",
|
|
79
106
|
"KHR_parallel_shader_compile",
|
|
107
|
+
];
|
|
108
|
+
const OPTIONAL_EXTENSIONS_WIN = [
|
|
109
|
+
"WEBGL_sample_variables",
|
|
110
|
+
"EXT_color_buffer_float",
|
|
111
|
+
"WEBGL_clip_cull_distance",
|
|
112
|
+
"EXT_disjoint_timer_query",
|
|
113
|
+
"WEBGL_multisampled_render_to_texture",
|
|
114
|
+
"EXT_texture_compression_rgtc",
|
|
115
|
+
"ANGLE_instanced_arrays",
|
|
80
116
|
"OES_element_index_uint",
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"
|
|
117
|
+
"WEBGL_depth_texture",
|
|
118
|
+
];
|
|
119
|
+
const OPTIONAL_EXTENSIONS_MAC = [
|
|
120
|
+
"WEBGL_sample_variables",
|
|
121
|
+
"EXT_color_buffer_float",
|
|
122
|
+
"WEBGL_clip_cull_distance",
|
|
123
|
+
"EXT_disjoint_timer_query",
|
|
124
|
+
"WEBGL_multisampled_render_to_texture",
|
|
125
|
+
"APPLE_rgba_float",
|
|
126
|
+
"GL_EXT_blend_minmax",
|
|
127
|
+
"ANGLE_instanced_arrays",
|
|
85
128
|
];
|
|
86
|
-
// Optional extensions that some GPUs/drivers support
|
|
87
|
-
const OPTIONAL_EXTENSIONS_WIN = ["WEBGL_sample_variables", "EXT_color_buffer_float"];
|
|
88
|
-
const OPTIONAL_EXTENSIONS_MAC = ["WEBGL_sample_variables", "EXT_color_buffer_float"];
|
|
89
129
|
const OPTIONAL_EXTENSIONS_LIN = [
|
|
90
130
|
"WEBGL_sample_variables",
|
|
91
131
|
"EXT_color_buffer_float",
|
|
92
|
-
"WEBGL_polygon_mode",
|
|
93
|
-
"EXT_shader_texture_lod",
|
|
94
132
|
"WEBGL_clip_cull_distance",
|
|
133
|
+
"EXT_disjoint_timer_query",
|
|
134
|
+
"WEBGL_multisampled_render_to_texture",
|
|
135
|
+
"EXT_shader_texture_lod",
|
|
136
|
+
"OVR_multiview2",
|
|
137
|
+
"_ANGLE_instanced_arrays",
|
|
138
|
+
"NV_conditional_render",
|
|
139
|
+
"EXT_robustness",
|
|
95
140
|
];
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
141
|
+
// GLSL version strings matched to exact driver families seen in the wild
|
|
142
|
+
const GLSL_VERSIONS = {
|
|
143
|
+
Intel: [
|
|
144
|
+
"OpenGL ES GLSL 3.00 (Build 31.0.101.2115)",
|
|
145
|
+
"OpenGL GLSL 4.60",
|
|
146
|
+
"OpenGL ES GLSL 3.00 (Build 31.0.101.2139)",
|
|
147
|
+
"OpenGL GLSL 4.50",
|
|
148
|
+
],
|
|
149
|
+
NVIDIA: [
|
|
150
|
+
"OpenGL GLSL 4.60 NVIDIA",
|
|
151
|
+
"OpenGL ES GLSL 3.00 NVIDIA",
|
|
152
|
+
"OpenGL GLSL 4.50 NVIDIA",
|
|
153
|
+
"OpenGL GLSL 4.60",
|
|
154
|
+
],
|
|
155
|
+
AMD: [
|
|
156
|
+
"OpenGL GLSL 4.60",
|
|
157
|
+
"OpenGL ES GLSL 3.00 (Builder ID:808)",
|
|
158
|
+
"OpenGL GLSL 4.50 AMD",
|
|
159
|
+
"OpenGL GLSL 4.60 (allocator : Amdllp)",
|
|
160
|
+
],
|
|
161
|
+
Mesa: [
|
|
162
|
+
"OpenGL GLSL 4.60 (adapter: Mesa; driver: ",
|
|
163
|
+
"OpenGL ES GLSL 3.00 (Mesa 24.0.2-1.kali2)",
|
|
164
|
+
"OpenGL GLSL 4.50 (Mesa 23.2.1-1debian)",
|
|
165
|
+
"OpenGL ES GLSL 3.00 (Mesa 23.2.1-1debian)",
|
|
166
|
+
],
|
|
167
|
+
Apple: [
|
|
168
|
+
"OpenGL GLSL 4.1",
|
|
169
|
+
"OpenGL ES GLSL 3.00",
|
|
170
|
+
"Metal API GLSL 1.2.0",
|
|
171
|
+
"Metal API GLSL 1.3.0",
|
|
172
|
+
],
|
|
173
|
+
llvmpipe: [
|
|
174
|
+
"OpenGL GLSL 4.50 (Mesa 23.2.1)",
|
|
175
|
+
"OpenGL ES GLSL 3.00 (llvmpipe LLVM 17.0.6)",
|
|
176
|
+
"OpenGL ES GLSL 3.00 (llvmpipe LLVM 16.0.6)",
|
|
177
|
+
],
|
|
178
|
+
Microsoft: ["OpenGL ES GLSL 1.0.0"],
|
|
179
|
+
Mozilla: ["OpenGL GLSL 4.60"],
|
|
180
|
+
"Google Inc.": ["OpenGL ES GLSL 3.00"],
|
|
181
|
+
};
|
|
182
|
+
// ── Public API ────────────────────────────────────────────────────────────────
|
|
108
183
|
export function sampleGPUProfile(os) {
|
|
109
184
|
const pool = KNOWN_GPUS[os];
|
|
110
|
-
const
|
|
111
|
-
const vendorEntry = pool.find(g => g.renderer ===
|
|
185
|
+
const gpuRenderer = pickWeighted(pool.map((g) => g.renderer), pool.map((g) => g.weight));
|
|
186
|
+
const vendorEntry = pool.find((g) => g.renderer === gpuRenderer);
|
|
112
187
|
const vendor = vendorEntry.vendor;
|
|
113
|
-
// Build base extension
|
|
188
|
+
// Build deterministic base + probabilistic optional extension set
|
|
114
189
|
const baseExts = [...BASE_WEBGL_EXTENSIONS];
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
: os === "mac"
|
|
119
|
-
? OPTIONAL_EXTENSIONS_MAC
|
|
120
|
-
: OPTIONAL_EXTENSIONS_LIN;
|
|
121
|
-
const numOptional = cryptoRandInt(0, Math.min(2, optionalPool.length));
|
|
190
|
+
const optionalPool = os === "win" ? OPTIONAL_EXTENSIONS_WIN : os === "mac" ? OPTIONAL_EXTENSIONS_MAC : OPTIONAL_EXTENSIONS_LIN;
|
|
191
|
+
// Max 3 optional extensions for level-max entropy (was 2)
|
|
192
|
+
const numOptional = cryptoRandInt(0, Math.min(3, optionalPool.length));
|
|
122
193
|
for (let i = 0; i < numOptional; i++) {
|
|
123
194
|
const ext = optionalPool[cryptoRandInt(0, optionalPool.length - 1)];
|
|
124
195
|
if (!baseExts.includes(ext))
|
|
125
196
|
baseExts.push(ext);
|
|
126
197
|
}
|
|
127
198
|
baseExts.sort();
|
|
128
|
-
// GLSL version
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
"OpenGL ES GLSL 3.00 (Build 31.0.101.2115)",
|
|
132
|
-
"OpenGL GLSL 4.60",
|
|
133
|
-
"OpenGL ES GLSL 3.00 (Build 31.0.101.2139)",
|
|
134
|
-
],
|
|
135
|
-
NVIDIA: [
|
|
136
|
-
"OpenGL GLSL 4.60 NVIDIA",
|
|
137
|
-
"OpenGL ES GLSL 3.00 NVIDIA",
|
|
138
|
-
"OpenGL GLSL 4.50 NVIDIA",
|
|
139
|
-
],
|
|
140
|
-
AMD: [
|
|
141
|
-
"OpenGL GLSL 4.60",
|
|
142
|
-
"OpenGL ES GLSL 3.00 (Builder ID:808)",
|
|
143
|
-
"OpenGL GLSL 4.50 AMD",
|
|
144
|
-
],
|
|
145
|
-
Mesa: [
|
|
146
|
-
"OpenGL GLSL 4.60 (adapter: Mesa; driver: ",
|
|
147
|
-
"OpenGL ES GLSL 3.00 (Mesa 23.2.1-1debian)",
|
|
148
|
-
"OpenGL GLSL 4.50 (Mesa 22.3.6)",
|
|
149
|
-
],
|
|
150
|
-
Apple: [
|
|
151
|
-
"OpenGL GLSL 4.1",
|
|
152
|
-
"OpenGL ES GLSL 3.00",
|
|
153
|
-
"Metal API GLSL 1.3.0",
|
|
154
|
-
],
|
|
155
|
-
"llvmpipe": [
|
|
156
|
-
"OpenGL GLSL 4.50 (Mesa 23.2.1)",
|
|
157
|
-
"OpenGL ES GLSL 3.00 (llvmpipe LLVM 15.0.7)",
|
|
158
|
-
],
|
|
159
|
-
Microsoft: ["OpenGL ES GLSL 1.0.0"],
|
|
160
|
-
Mozilla: ["OpenGL GLSL 4.60"],
|
|
161
|
-
Google: ["OpenGL ES GLSL 3.00"],
|
|
162
|
-
};
|
|
163
|
-
const vendorGlsl = glslVersionsByVendor[vendor.toLowerCase()] ?? ["OpenGL GLSL 4.60"];
|
|
199
|
+
// GLSL version from vendor-specific pool
|
|
200
|
+
const vendorKey = vendor.toLowerCase();
|
|
201
|
+
const vendorGlsl = GLSL_VERSIONS[vendorKey] ?? GLSL_VERSIONS["intel"] ?? ["OpenGL GLSL 4.60"];
|
|
164
202
|
const glslVersion = vendorGlsl[cryptoRandInt(0, vendorGlsl.length - 1)];
|
|
165
|
-
return { vendor, renderer:
|
|
166
|
-
}
|
|
167
|
-
// Convenience wrapper using crypto-safe random
|
|
168
|
-
function cryptoRandInt(min, max) {
|
|
169
|
-
const buf = new Uint32Array(1);
|
|
170
|
-
crypto.getRandomValues(buf);
|
|
171
|
-
return min + (buf[0] % (max - min + 1));
|
|
203
|
+
return { vendor, renderer: gpuRenderer, webglExtensions: baseExts, glslVersion };
|
|
172
204
|
}
|
|
173
205
|
export function resolveUAOS(userAgent) {
|
|
174
206
|
const parser = new UAParser(userAgent);
|
|
@@ -179,3 +211,21 @@ export function resolveUAOS(userAgent) {
|
|
|
179
211
|
return "win";
|
|
180
212
|
return "lin";
|
|
181
213
|
}
|
|
214
|
+
// ── Helpers ───────────────────────────────────────────────────────────────────
|
|
215
|
+
function cryptoRandInt(min, max) {
|
|
216
|
+
const buf = new Uint32Array(1);
|
|
217
|
+
crypto.getRandomValues(buf);
|
|
218
|
+
return min + (buf[0] % (max - min + 1));
|
|
219
|
+
}
|
|
220
|
+
function pickWeighted(items, weights) {
|
|
221
|
+
const total = weights.reduce((a, b) => a + b, 0);
|
|
222
|
+
const buf = new Uint32Array(1);
|
|
223
|
+
crypto.getRandomValues(buf);
|
|
224
|
+
let threshold = (buf[0] / 0x100000000) * total;
|
|
225
|
+
for (let i = 0; i < items.length; i++) {
|
|
226
|
+
threshold -= weights[i];
|
|
227
|
+
if (threshold <= 0)
|
|
228
|
+
return items[i];
|
|
229
|
+
}
|
|
230
|
+
return items[items.length - 1];
|
|
231
|
+
}
|