3D Graphics Batching

筅森魡賤 提交于 2019-12-06 01:05:46

问题


A lot of sites/articles say 'batch! batch! batch!'. Can someone explain what 'batching' represents with respect to shaders?

Namely, does

  1. changing textures
  2. changing arbitrary shader variables

mean something can't be 'batched'?

(Sorry if this is a retarded question :D)


回答1:


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.




回答2:


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):

1) http://blogs.msdn.com/b/shawnhar/archive/2006/12/13/spritebatch-and-spritesortmode.aspx
2) http://blogs.msdn.com/b/shawnhar/archive/2006/12/14/spritebatch-sorting-part-2.aspxv 3) http://blogs.msdn.com/b/shawnhar/archive/2006/12/14/return-of-the-spritebatch-sorting-part-3.aspx

Christer Ericson:

http://realtimecollisiondetection.net/blog/?p=86



来源:https://stackoverflow.com/questions/4151065/3d-graphics-batching

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!