可以在 Electron 中禁用 failIfMajorPerformanceCaveat 安全措施吗?

Can the failIfMajorPerformanceCaveat security measure be disabled in Electron?

获取WebGL上下文时,可以指定failIfMajorPerformanceCaveat属性:

var context = canvas.getContext('webgl', {'failIfMajorPerformanceCaveat': true});

this page关于该属性的引述:

Because of the direct access to the GPU allowed by WebGL, browsers must ensure that running your code will not cause a major security issue. For some specific drivers that are not perfectly secure, the browser can prevent hardware acceleration in order to prevent security issues. [...] On these devices, WebGL will software rendering instead, resulting in a slower but safer experience.

如果我没有在我的应用程序中使用任何外部、远程、第三方代码,是否可以在 Electron 中轻松禁用安全措施?

实际上关于 failIfMajorPerformanceCaveat 的正确引用是:

Context creation will fail if the implementation determines that the performance of the created WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.

您引用的段落正下方指出:

To enforce this, IE has a block-list of drivers that are not safe for use with hardware acceleration. On these devices, WebGL will software rendering instead, resulting in a slower but safer experience.

Chromium(因此 electron)具有相同的功能,可以通过设置 #ignore-gpu-blacklist 标志来禁用:

Overrides the built-in software rendering list and enables GPU-acceleration on unsupported system configurations.

请注意,尽管这些已被列入 reasons

的黑名单