Jeff Saremi
Jeff Saremi

Reputation: 3014

What is the max size for an array to be uploaded using gl.uniform1fv?

Is there any limit on the above call? Is that limit different for WebGL 1.0 vs WebGL 2.0? If there is no limit, would there be a reason to use that vs Textures for input data?

thanks

Upvotes: 2

Views: 3615

Answers (1)

HankMoody
HankMoody

Reputation: 3174

For vertex shaders the maximum size is specified by the gl.MAX_VERTEX_UNIFORM_VECTORS parameter. Minimum for WebGL 1 is 128. Minimum for WebGL 2 is 256.

gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS);

For fragment shaders the maximum size is specified by the gl.MAX_FRAGMENT_UNIFORM_VECTORS parameter. Minimum for WebGL 1 is 16. Minimum for WebGL 2 is 224.

gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS);

You can quickly check these limits in your browser on the Webgl Report site.

Note: Other uniform variables decrease these limits and for example a mat4 uniform counts as 4 uniforms.

Upvotes: 8

Related Questions