3D 图形批处理
很多网站/文章都说“批量!”批!批!'。有人可以解释一下着色器中的“批处理”代表什么吗?
也就是说,
- 改变纹理
- 改变任意着色器变量
是否意味着某些东西不能被“批处理”?
A lot of sites/articles say 'batch! batch! batch!'. Can someone explain what 'batching' represents with respect to shaders?
Namely, does
- changing textures
- changing arbitrary shader variables
mean something can't be 'batched'?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的总结方法就是尝试尽可能少地调用 API 来绘制您需要绘制的内容。使用顶点数组或 VBO(在现代 API 中甚至不是可选的)、纹理图集以及避免状态更改的需要都有助于实现这一点。令人惊奇的是,现代 GPU 在您转身并设置下一个绘图调用的时间内可以绘制多少个三角形。
The easiest way to summarize it is to try to make as few API calls as you can to draw what you need to draw. Using vertex arrays or VBOs (not even optional in modern APIs), texture atlases and avoiding the need for state changes all contribute to that. It's really amazing how many triangles a modern GPU can draw in the time it takes you to turn around and set up the next drawing call.
周围有一些很好的信息。来自 Tom Forsyth:
http: //home.comcast.net/~tom_forsyth/blog.wiki.html#%5B%5BRenderstate%20change%20costs%5D%5D
Shawn Hargreaves(关于精灵批处理):
克里斯特·埃里克森:
http://realtimecollisiondetection.net/blog/?p =86
There is some good info around and about. From Tom Forsyth:
http://home.comcast.net/~tom_forsyth/blog.wiki.html#%5B%5BRenderstate%20change%20costs%5D%5D
Shawn Hargreaves (On Sprite batching):
Christer Ericson:
http://realtimecollisiondetection.net/blog/?p=86