GLSL float/vec3/vec4 array max size = GL_MAX_VERTEX_UNIFORM_VECTORS?

前端 未结 2 1505
谎友^
谎友^ 2020-12-16 05:07

I run

glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &maxVertUniformsVect);

and get 1024.

Than in GLSL I do

unif         


        
2条回答
  •  爱一瞬间的悲伤
    2020-12-16 05:39

    According to http://www.opengl.org/wiki/Uniform_%28GLSL%29 (Implementation limits):

    Implementation note: OpenGL implementations are allowed to reject shaders for implementation-dependent reasons. So you can have fewer active uniform components by your reckoning and still fail to link due to uniform limits. This is usually on hardware that is innately vector hardware. Pre-GeForce 8xxx hardware, and all ATi hardware does this. In this case, you should assume that each separate uniform takes up 4 components, much like it would in D3D. That means a "uniform float" is 4 components, a mat2x4 is 16 components (each row is 4 components), but a mat4x2 is 8 components.

    Which is my case, also. But it not has to be always like that. Of course, for compatible reasons it is always better to count each float/vec2/vec3 uniform value, as max size value (vec4)

提交回复
热议问题