WebGLQuery

这是 实验性技术
检查 浏览器兼容性表格 在生产中使用这之前。

WebGLQuery interface is part of the WebGL 2 API and provides ways to asynchronously query for information. By default, occlusion queries and primitive queries are available.

Another kind of queries are disjoint timer queries, which allow you to measure performance and profiling of your GPU. Disjoint timer queries are available with the EXT_disjoint_timer_query extension only.

When working with WebGLQuery objects, the following methods of the WebGL2RenderingContext are useful:

范例

Creating a WebGLQuery object

in this example, gl 必须是 WebGL2RenderingContext . WebGLQuery objects are not available in WebGL 1.

var query = gl.createQuery();
					

规范

规范 状态 Comment
WebGL 2.0
The definition of 'WebGLQuery' in that specification.
编者草案 初始定义。

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
WebGLQuery Chrome 56 Edge 79 Firefox 51 IE No Opera 43 Safari No WebView Android 58 Chrome Android 58 Firefox Android 51 Opera Android 43 Safari iOS No Samsung Internet Android 7.0

图例

完整支持
完整支持
不支持
不支持

另请参阅