这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。
The WebGLSync
interface is part of the WebGL 2 API and is used to synchronize activities between the GPU and the application.
When working with WebGLSync
objects, the following methods of the WebGL2RenderingContext
are useful:
WebGL2RenderingContext.fenceSync()
WebGL2RenderingContext.deleteSync()
WebGL2RenderingContext.isSync()
WebGL2RenderingContext.clientWaitSync()
WebGL2RenderingContext.waitSync()
WebGL2RenderingContext.getSyncParameter()
示例
创建一个WebGLSync对象
in this example, gl
must be a WebGL2RenderingContext
. WebGLSync
objects are not available in WebGL 1.
var sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
Specifications
Specification | Status | Comment |
---|---|---|
WebGL 2.0 WebGLSync |
Editor's Draft | Initial definition. |
浏览器兼容性
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Feature | Chrome | Firefox | Edge | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic Support | 56 | 51.0 | (No) | (No) | 43 | (No) |
Feature | Android | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic Support | (No) | (No) | (No) | (No) | (No) | (No) | (No) |