问题描述
我使用OpenGL4.X。最近我阅读了 Apple OpenGLES2 doc其中声明使用交错属性数组提高了IOS移动设备的性能,是推荐的方法(而不是使用属性块)。
I work with OpenGL4.X .Recently I read this Apple OpenGLES2 doc where it is stated that using interleaved attribute arrays improves performance on IOS mobile devices and is the recommended way (instead of using blocks of attributes).
对于那些不明白我在这里的意思的例子:
For those who didn't understand what I mean here is an example:
单一属性数组中的属性块:
float vertices[]{
//Triangle vertices:
v0x , v0y , v0z ,
v1x , v1y , v1z ,
v2x , v2y , v2z ,
//Triangle UVs:
uv0s , uv0t ,
uv1s , uv1t ,
uv2s , uv2t ,
//Triangle Normals:
n0x , n0y , n0z ,
n1x , n1y , n1z ,
n2x , n2y , n2z
}
交错属性数组
float vertices[]{
v0x , v0y , v0z ,
uv0s , uv0t , ////vertex 1 attributes
n0x , n0y , n0z ,
v1x , v1y , v1z ,
uv1s , uv1t , ///vertex 2 attributes
n1x , n1y , n1z ,
v2x , v2y , v2z ,
uv2s , uv2t , ///vertex 3 attributes
n2x , n2y , n2z
}
因此我的问题是:在桌面GPU上运行的OpenGL也是如此?如果是,那么理论上性能增益有多大?
So my question is : Is it also true for OpenGL running on desktop GPUs ? If yes ,then how big the performance gain can theoretically be ?
推荐答案
从:
我不能真正回答,但我不会期望巨大的改善。唯一可靠的方法是测量。
I can't really answer that, but I wouldn't expect huge improvement. The only sure way is to measure.
这篇关于在OpenGL4.0中使用交错属性数组的性能增益的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!