Max Varying Vectors and Floats for GLES 2.0

夙愿已清 提交于 2019-12-20 04:13:30

问题


I am trying to figure out what is the maximum number of varying vectors and uniforms I can use on a device that is OpenGL ES 2.0 compatible. I am trying to understand how MAX_VARYING_VECTORS works. So if MAX_VARYING_VECTORS is 8, does that mean I can store 8 * 4 bytes of data for varyings or does it mean that I can only define 8 varyings irrespective of the data type?


回答1:


MAX_VARYING_VECTORS is measured in units of 4-member float vectors (vec4). So with the minimum guaranteed value of 8, you can have 8 varyings of type vec4.

The rules on how exactly other types fit into this available space are fairly complex. For the example where MAX_VARYING_VECTORS is 8, the whole thing is treated as a 2D array of 8 rows and 4 columns. Space in this array is allocated to varyings in a certain order (which mostly goes from largest to smallest), and rules that depend on the size of the variable and the size/location of empty space still available in the array.

The exact rules fill about 2.5 pages in the GLSL ES 1.00 spec document. They are on pages 111-113. Copying the whole thing would not make a lot of sense, and I'm afraid that I can't turn it into something much simpler while still remaining accurate.



来源:https://stackoverflow.com/questions/29551458/max-varying-vectors-and-floats-for-gles-2-0

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