diff options
author | Minteck <nekostarfan@gmail.com> | 2021-08-05 17:29:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-05 17:29:18 +0200 |
commit | b865b8f6586ffd4554cdfe45c739030afc882acd (patch) | |
tree | 37bcdf6575d8764b7367f34544658886879c0c5e /views/script/global_compatlayer.js | |
parent | 79edea37d15f88f086f7775bbbce64a57535b043 (diff) | |
parent | 7b541bbf2a8d754d26511895801d90f02cdf99f7 (diff) | |
download | kartik-client-b865b8f6586ffd4554cdfe45c739030afc882acd.tar.gz kartik-client-b865b8f6586ffd4554cdfe45c739030afc882acd.tar.bz2 kartik-client-b865b8f6586ffd4554cdfe45c739030afc882acd.zip |
Merge pull request #4 from Minteck-Projects/devel
Branching 21.08
Diffstat (limited to 'views/script/global_compatlayer.js')
-rw-r--r-- | views/script/global_compatlayer.js | 178 |
1 files changed, 89 insertions, 89 deletions
diff --git a/views/script/global_compatlayer.js b/views/script/global_compatlayer.js index 8545a29..9ef86ed 100644 --- a/views/script/global_compatlayer.js +++ b/views/script/global_compatlayer.js @@ -1,89 +1,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 < 50) { - 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); - } - } -})
\ No newline at end of file +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);
+ }
+ }
+})
|