Comments (5)
根据https://codepen.io/ShuangLiu/pen/YzEEmLa 的测试,感觉使用
mapAsync
的方式优于writeBuffer
的方式,单独测试mapAsync
与 WebGL的‘bufferSubData’ 几乎差不多,引擎会考虑mapAsync
的方式吗?
mapasync
的理论性能确实好一些,但实际工程化过程中会遇到几个问题:
- 大量同步操作变成异步操作会增加代码结构复杂度,不方便开发调试和维护
- js的单线程队列回调机制在实时渲染这种场景下,异步回调难以保证实时性和顺序,会受到其它异步操作或事件的干扰,即使
mapasync
内部及时很快完成,但异步的回调也无法及时在js主线程中触发,导致实际延迟可能比writebuffer
还高,实际综合表现就是 fps 很不稳定,尤其在有ui操作,网络通信时会有突发的高延迟、卡帧等现象。所以mapasync
比较难优化,一般较适合一个大内存临时写入或读取时用一下,一般基础的每帧都要更新的buffer,比如 transform 这种,还是用writebuffer
这种比较有确定性的同步操作更合适 - Chrome
mapasync
内部 (Dawn) 的优化机制也不算完善,https://codepen.io/ShuangLiu/pen/YzEEmLa 这个例子已经说明问题,当有其他 webgpu api 操作时,mapasync
的延迟会大大增加,它内部机制也是等待GPU
空闲状态下才会去进行操作,如果有其他操作正在进行,mapasync
的延迟就会不稳定,尤其是有大量compute shader
运行时,实际工程中的延迟基本和writebuffer
相同甚至更大,远不如webgl
的bufferSubData
的性能
综上,目前用 mapasync
效果可能还不如 writebuffer
,这需要 webgpu
标准的迭代和优化,比如支持多线程的gpu内存写入操作,也需要 Chrome 的内部的实现去优化,释放更多的底层性能,后续我们也会跟进尝试更多的使用 mapasync
的操作场景
from orillusion.
感谢测试反馈
初次内存申请时间长的问题我们已经收到,后续会改进
性能问题来自两个方面:
- 目前 wasm 在 devtools 开启时会有额外的消耗,性能会降低,可以关掉devtools后进行测试
- chrome webgpu 目前对于写入 gpu 内存的性能存在问题,比如 https://bugs.chromium.org/p/chromium/issues/detail?id=1298309&no_tracker_redirect=1
目前性能是比不上 webgl 的API的,所以对于大量transfrom的更新,速度可能比 three 还慢一些,这个需要chrome底层去优化更新
from orillusion.
感谢Orillusion团队的重视,后续的使用学习中希望能得到更多的帮助!
from orillusion.
根据https://codepen.io/ShuangLiu/pen/YzEEmLa 的测试,感觉使用mapAsync
的方式优于 writeBuffer
的方式,单独测试mapAsync
与 WebGL的‘bufferSubData’ 几乎差不多,引擎会考虑 mapAsync
的方式吗?
from orillusion.
感谢 @lslzl3000,您解释的很清楚,学到了。很高兴能得到您的解答.
from orillusion.
Related Issues (20)
- [BUG]: 这里的代码似乎有问题 HOT 1
- [BUG]: 加载GLTF模型,模型显示错误 HOT 1
- [BUG]: 鼠标右键点击事件无效 HOT 1
- [BUG]: 设置PCF阴影,报错
- [BUG]: 加载obj文件失败
- [FR]: 给assets库添加了四个字体
- [BUG]: Blend首次打开页面不生效 HOT 1
- [BUG]: 控制台发出警告 HOT 2
- [FR]: 请问现在orillusion在绘制场景时,支持的模型文件最大是多少?单场景中模型的面数最大是多少? HOT 4
- [BUG]: The LoaderFunctions.OnUrl doesn't seem to be called HOT 3
- [BUG]: 设置拾取模式为pixel后,添加bloompost报错 HOT 3
- [BUG]: 景深会影响2DUI HOT 1
- [BUG]: SSR,Fog会影响2DUI HOT 1
- [FR]: 关于属性动画,怎么导出json
- [BUG]: ConduitGeometry相关 HOT 1
- [BUG]: 天空盒bitmapcube加载注释错误
- [FR]: HoverCameraController可否增加pitch旋转的限制角度
- [BUG]: HoverCameraController在顶视图的时候鼠标上下移动,场景不位移 HOT 2
- [FR]: Support EXT_meshopt_compression and EXT_texture_webp glTF extension HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orillusion.