问题描述
我是桌面GL开发人员,并且我开始探索移动世界.
I am a desktop GL developer, and I am starting to explore the mobile world.
为避免引起误解或欢迎但微不足道的答复,我可以谦虚地说,我对GL和GL | ES机器非常了解.
To avoid misunderstandings, or welcome-but-trivial replies, I can humbly say that I am pretty well aware of the GL and GL|ES machinery.
简短的问题是:如果我们在共享内存体系结构中使用GL | ES 2.0,对客户端阵列使用VBO的意义何在?
The short question is: if we are using GL|ES 2.0 in a shared memory architecture, what's the point behind using VBOs against client-side arrays?
更多详细信息:
-
顶点缓冲区是内存的原始块,驱动程序无法以任何方式 进行任何优化,因为访问模式取决于:1)应用程序如何配置顶点数据布局,2)顶点着色器消耗缓冲区内容,并且3)我们可以有很多顶点着色器以不同的方式运行,并且以不同的方式提供相同的缓冲区.
Vertex buffers are raw chunks of memory, the driver cannot in any way optimize anything because the access pattern depends on: 1) how the application configures vertex data layout, 2) how a vertex shader consumes buffer content, and 3) we can have lots of vertex shaders operating in different ways, and differently sourcing the same buffer.
对齐方式:单个VBO存储可以从最适合基础GL系统的地址开始;如果我只是强制(例如,遵循对齐最佳实践)将客户端数组分配给这些边界,怎么办?
Alignment: individual VBO storage could start at addresses that are optimal to the underlying GL system; what if I just force (e.g, respect alignment best practices) client-side arrays allocation to these boundaries?
基于瓦片的渲染与即时模式体系结构不应发挥作用:据我了解,这与我的问题(即内存访问)无关.
Tile-Based Rendering vs. Immediate Mode architectures should not come into play: to my understanding, this is not related to my question (i.e., memory access).
我了解使用VBO可以使您的代码在未来平台/硬件中更好/更快地运行,而无需对其进行修改,但这不是此问题的重点.
I understand that using VBOs can have your code run better/faster in future platforms/hardware without modifying it, but this is not the focus of this question.
此外,我还意识到在共享内存体系结构中使用VBO会使内存使用量增加一倍(如果出于某种原因,您必须保留顶点数据供您使用),并且会花费您大量的数据.
Alongside, I also realize that using VBOs in a shared memory architecture doubles memory usage (if you, for some reason, have to keep vertex data at your disposal), and it costs you a memcpy of the data.
与交错的顶点数组一样,在开发人员的论坛/博客/official_technotes中,VBO的使用引起了很大的炒作",而没有任何数据支持这些语句(即基准).
As with interleaved vertex arrays, VBO usage has got a great "hype" in developers' forums/blogs/official_technotes without any data supporting those statements (i.e., benchmarks).
- 在共享内存体系结构上使用VBO是否值得?
- 客户端数组工作正常吗?
- 您对此有何看法?
推荐答案
我可以报告说,使用VBO在Android设备上存储顶点数据使我的性能提高了零.在Adreno,Mali400和PowerVR GPU上进行了尝试.但是,考虑到这是OpenGL ES的最佳做法,我们使用VBO.
I can report that using of VBOs to store vertex data on Android devices gave me zero performance improvement. Tried it on Adreno, Mali400 and PowerVR GPUs. However, we use VBOs considering that it is the best practice for OpenGL ES.
您可以在我们的文章(顶点缓冲对象段落).
You can find notes about this in our article (Vertex Buffer Objects paragraph).
这篇关于共享内存体系结构中的OpenGL(ES 2.0)VBO性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!