Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1044870 of WebGLSync

  • Revision slug: Web/API/WebGLSync
  • Revision title: WebGLSync
  • Revision id: 1044870
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment

Revision Content

{{APIRef("WebGL")}} {{SeeCompatTable}}

The WebGLSync interface is part of the WebGL 2 API and are 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()")}}

Revision Source

<div>{{APIRef("WebGL")}} {{SeeCompatTable}}</div>

<p>The <strong><code>WebGLSync</code></strong> interface is part of the <a href="/en-US/docs/Web/API/WebGL_API">WebGL 2</a> API and are used to synchronize activities between the GPU and the application.</p>

<p>When working with <code>WebGLSync</code> objects, the following methods of the {{domxref("WebGL2RenderingContext")}} are useful:</p>

<ul>
 <li>{{domxref("WebGL2RenderingContext.fenceSync()")}}</li>
 <li>{{domxref("WebGL2RenderingContext.deleteSync()")}}</li>
 <li>{{domxref("WebGL2RenderingContext.isSync()")}}</li>
 <li>{{domxref("WebGL2RenderingContext.clientWaitSync()")}}</li>
 <li>{{domxref("WebGL2RenderingContext.waitSync()")}}</li>
 <li>{{domxref("WebGL2RenderingContext.getSyncParameter()")}}</li>
</ul>

<h2 id="Examples">Examples</h2>

<h3 id="Creating_a_WebGLSync_object">Creating a <code>WebGLSync</code> object</h3>

<p>in this example, <code>gl</code> must be a {{domxref("WebGL2RenderingContext")}}. <code>WebGLSync</code> objects are not available in WebGL 1.</p>

<pre class="brush: js">
var sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('WebGL2', "#3.4", "WebGLSync")}}</td>
   <td>{{Spec2('WebGL2')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<div>{{CompatibilityTable}}</div>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatNo}} [2]</td>
   <td>{{CompatNightly}} [1]</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] WebGL 2 is enabled by default in Firefox Nightly. To enable it in a release version of Firefox, set the preference <code>webgl.enable-prototype-webgl2</code> to <code>true</code> in about:config.</p>

<p>[2] To use an experimental implementation of WebGL 2 in Chrome, you have to start Chrome with the runtime flag <code>--enable-unsafe-es3-apis</code>.</p>

<h2 id="See_also">See also</h2>

<ul>
 <li>{{domxref("WebGLRenderingContext.finish()")}}</li>
</ul>
Revert to this revision