godlike

Driver optimizations of uniform variables inside the vertex shader? (OpenGL)

Discussion created by godlike on Jun 2, 2010
Latest reply on Jun 3, 2010 by nou

Now that the gl_*Matrix is deprecated we need to supply the shaders with our own matrices via uniforms. So far so good.

Imagine I have the following part of a vertex shader:

...
uniform mat4 my_projection_mat;
uniform mat4 my_modelview_mat;
attribute vec3
my_vertex_pos;
...
gl_Position = (my_projection_mat * my_modelview_mat) * vec4(my_vertex_pos, 1.0);
...

My question is: Will the AMD driver perform the "my_projection_mat * my_modelview_mat" multiplication for every vertex? Or it will understand that this calculation needs to be done only once?

Outcomes