{{APIRef("WebGL")}} {{SeeCompatTable}}
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 {{domxref("WebGL2RenderingContext")}} are useful:
- {{domxref("WebGL2RenderingContext.fenceSync()")}}
- {{domxref("WebGL2RenderingContext.deleteSync()")}}
- {{domxref("WebGL2RenderingContext.isSync()")}}
- {{domxref("WebGL2RenderingContext.clientWaitSync()")}}
- {{domxref("WebGL2RenderingContext.waitSync()")}}
- {{domxref("WebGL2RenderingContext.getSyncParameter()")}}
Examples
Creating a WebGLSync
object
in this example, gl
must be a {{domxref("WebGL2RenderingContext")}}. WebGLSync
objects are not available in WebGL 1.
var sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('WebGL2', "#3.4", "WebGLSync")}} | {{Spec2('WebGL2')}} | Initial definition. |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{CompatNo}} [2] | {{CompatNightly}} [1] | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
[1] WebGL 2 is enabled by default in Firefox Nightly. To enable it in a release version of Firefox, set the preference webgl.enable-prototype-webgl2
to true
in about:config.
[2] To use an experimental implementation of WebGL 2 in Chrome, you have to start Chrome with the runtime flag --enable-unsafe-es3-apis
.
See also
- {{domxref("WebGLRenderingContext.finish()")}}