antvis / g-device-api

A Device API references WebGPU implementations
https://observablehq.com/@antv/g-device-api
12 stars 3 forks source link

WebGL2 异步读取纹理数据速度很慢 #195

Open xiaoiver opened 5 months ago

xiaoiver commented 5 months ago

目前异步 readTexture 方法使用了 gl.fenceSync,按说是比较推荐的非阻塞做法(Babylon.js 也使用了该做法),但在 L7 中实测相比同步方法要慢很多。

https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#use_non-blocking_async_data_readback

https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/Engines/engine.ts#L1016C12-L1016C28 https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/Engines/Extensions/engine.readTexture.ts#L179

Issues-translate-bot commented 5 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Title: WebGL2 asynchronous reading of texture data is slow

Currently, the asynchronous readTexture method uses gl.fenceSync, which is said to be a more recommended non-blocking method (Babylon.js also uses this method), but in L7 it is much slower than the synchronous method.

https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#use_non-blocking_async_data_readback