diff options
author | Minteck <46352972+Minteck@users.noreply.github.com> | 2021-07-07 17:01:51 +0200 |
---|---|---|
committer | Minteck <46352972+Minteck@users.noreply.github.com> | 2021-07-07 17:01:51 +0200 |
commit | adabd5f0b2d7326958126dc960bf4ef09c9a4e4f (patch) | |
tree | cce44ad2c805c5c05a5e89f0aa63ca64b2c9fc30 /views/script/global_compatlayer.js | |
parent | ce99cfa3de0a74c8ab09c47d9a5295212021d769 (diff) | |
download | kartik-client-adabd5f0b2d7326958126dc960bf4ef09c9a4e4f.tar.gz kartik-client-adabd5f0b2d7326958126dc960bf4ef09c9a4e4f.tar.bz2 kartik-client-adabd5f0b2d7326958126dc960bf4ef09c9a4e4f.zip |
Update!
Diffstat (limited to 'views/script/global_compatlayer.js')
-rw-r--r-- | views/script/global_compatlayer.js | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/views/script/global_compatlayer.js b/views/script/global_compatlayer.js new file mode 100644 index 0000000..8545a29 --- /dev/null +++ b/views/script/global_compatlayer.js @@ -0,0 +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 |