开发者

Is there a performance hit for switching between shaders in OpenGL ES 2.0?

#1 Is there a limit on how many/size of shader programs OpenGL ES 2.0 devices (iPhone/iPad) can have compiled and available at one time?

#2 Is there any performance overhead for switching between programs in the middle of a pass, for instance if I were to render 100 triangles, 50 with shader1,开发者_运维知识库 50 with shader2, will I experience performance hits in any cases of using this? For instance can it be slower alternating programs each triangle or should it be faster to batch up and do all 50 of shader1 then all 50 of shader2? I guess I'm asking if there is some internal context switch or if the OpenGL ES libraries just specify what address of shader program memory on the card to execute and it doesn't matter if I specify that differently each triangle.


  • Question 1, There is no limit, only the available amount of memory in the system.
  • Question 2, Yes, there is a performance hit for switching shaders, so batching and minimize shader switch ensures the best performance.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜