blob: 7431cea447d6b06fde1efd3faa1c2887d125b003 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
window.addEventListener("load", () => {
if (require('os').platform !== "darwin") {
gpuinfo = require('@electron/remote').app.getGPUFeatureStatus();
gpuscore = 0;
maxscore = 10;
if (gpuinfo['2d_canvas'].startsWith("enabled")) {
if (gpuinfo['2d_canvas'] === "enabled") {
gpuscore++;
} else {
gpuscore += 0.5;
}
}
if (gpuinfo['gpu_compositing'].startsWith("enabled")) {
if (gpuinfo['gpu_compositing'] === "enabled") {
gpuscore++;
} else {
gpuscore += 0.5;
}
}
if (gpuinfo['video_decode'].startsWith("enabled")) {
if (gpuinfo['video_decode'] === "enabled") {
gpuscore++;
} else {
gpuscore += 0.5;
}
}
if (gpuinfo['multiple_raster_threads'].startsWith("enabled")) {
if (gpuinfo['multiple_raster_threads'] === "enabled") {
gpuscore++;
} else {
gpuscore += 0.5;
}
}
if (gpuinfo['oop_rasterization'].startsWith("enabled")) {
if (gpuinfo['oop_rasterization'] === "enabled") {
gpuscore++;
} else {
gpuscore += 0.5;
}
}
if (gpuinfo['rasterization'].startsWith("enabled")) {
if (gpuinfo['rasterization'] === "enabled") {
gpuscore++;
} else {
gpuscore += 0.5;
}
}
if (gpuinfo['opengl'].startsWith("enabled")) {
if (gpuinfo['opengl'] === "enabled") {
gpuscore++;
} else {
gpuscore += 0.5;
}
}
if (gpuinfo['skia_renderer'].startsWith("enabled")) {
if (gpuinfo['skia_renderer'] === "enabled") {
gpuscore++;
} else {
gpuscore += 0.5;
}
}
if (gpuinfo['vulkan'].startsWith("enabled")) {
if (gpuinfo['vulkan'] === "enabled") {
gpuscore++;
} else {
gpuscore += 0.5;
}
}
if (gpuinfo['webgl'].startsWith("enabled")) {
if (gpuinfo['webgl'] === "enabled") {
gpuscore++;
} else {
gpuscore += 0.5;
}
}
gpuperct = (gpuscore / maxscore) * 100;
if (gpuperct < 30) {
console.warn("Bad GPU support, disabling GPU-accelerated content");
var head = document.getElementsByTagName('HEAD')[0];
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = './common/compatibilityMode.css';
head.appendChild(link);
}
}
})
|