关于electron:electron-关闭硬件加速

9次阅读

共计 549 个字符,预计需要花费 2 分钟才能阅读完成。

错误代码:

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 (); 
}
正文完
 0