electron关闭硬件加速

错误代码:

error:angle_platform_impl.cc[44] renderegl_utils.cpp:188 (ClearErrors): Preexisring GL error

0x00000500 as of ../../third_party/angle/src/libangle/renderer/gl/textureGl.cpp, setImageHelper

:256. error:gpu_memory_buffer_support_x11.cc(44) dri3 extension not supported.

异常表现:

electron 的硬件加速功能,在 win7 或者 Linux 系统上,容易出现黑屏或者卡死。

解决办法:

app.disableHardwareAcceleration ()

禁用当前应用程序的硬件加速。

这个方法只能在应用程序准备就绪(ready)之前调用。

如果你使用的是 electron-egg 框架

那么,在 main.js 文件的 ready () 方法中添加 伪代码:

const isWin7 = os.release ().startsWith ('6.1'); 
const isLinux = true; 
if (isWin7 || isLinux) 
{ 
    app.disableHardwareAcceleration (); 
}

猜你喜欢

转载自blog.csdn.net/qq_32660241/article/details/124737796
今日推荐