Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum size of a uniform array that can be passed to a shader in ios?

I am using instanced rendering by passing an array of model view matrices. What is the maximum array size possible for a particular uniform?

like image 945
rakeshbs Avatar asked Apr 18 '13 18:04

rakeshbs


People also ask

What is a uniform variable in a shader?

A uniform is a global Shader variable declared with the "uniform" storage qualifier. These act as parameters that the user of a shader program can pass to that program. Their values are stored in a program object.

Can uniform variables be declared in a fragment shader?

Uniform variables can appear in any shader within a shader program, and are always used as input variables. They can be declared in one or more shaders within a program, but if a variable with a given name is declared in more than one shader, its type must be the same in all shaders.


1 Answers

This value will vary by hardware and implementation. I believe that

int maxUniformVectors;
glGet(GL_MAX_VERTEX_UNIFORM_VECTORS, &maxUniformVectors);

should answer your question. From the docs: this should return "the maximum number of four-element floating-point, integer, or boolean vectors that can be held in uniform variable storage for a vertex shader. The value must be at least 128."

like image 155
Ben Pious Avatar answered Sep 16 '22 18:09

Ben Pious