aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/webglsync/index.html
blob: cd1661d51b3607a396308893208c2efcd0f9a34b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
title: WebGLSync
slug: Web/API/WebGLSync
translation_of: Web/API/WebGLSync
---
<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 is 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="示例">示例</h2>

<h3 id="创建一个WebGLSync对象">创建一个WebGLSync对象</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="浏览器兼容性">浏览器兼容性</h2>

<p>{{Compat("api.WebGLSync.WebGLSync")}}</p>

<h2 id="相关链接">相关链接</h2>

<ul>
 <li>{{domxref("WebGLRenderingContext.finish()")}}</li>
</ul>