When should a uniform be used in shader programming?

Posted by Phineas on Stack Overflow See other posts from Stack Overflow or by Phineas
Published on 2010-04-12T19:40:01Z Indexed on 2010/04/12 19:43 UTC
Read the original article Hit count: 267

Filed under:
|
|

In a vertex shader, I calculate a vector using only uniforms. Therefore, the outcome of this calculation is the same for all instantiations of the vertex shader. Should I just do this calculation on the CPU and upload it as a uniform? What if I have ten such calculations? If I upload a lot of uniforms in this way, does CPU-GPU communication ever get so slow that recomputing such values in the vertex shader is actually faster?

© Stack Overflow or respective owner

Related posts about graphics

Related posts about glsl