As the title of the topic states, I'm curious to know how the uniform-related behaviours are optimized. In particular I know that unused uniform are "deleted", but what I'm particularly interested into is:
- If the value passed to the uniform is exactly the same between two frames, there are some optimizations involved or not?
- If I have two shader program, says A and B, what are the implication of:
Code :A.use() upload value U in one uniform (say u1) B.use() upload same U in a uniform in B A.use() upload value U in the same uniform u1
Code :A.use() upload value U in one uniform (say u1) A.use() // I know it's pointless, but assume I have to call use again. upload value U in the same uniform u1 B.use() upload same U in a uniform in B
I assume that the second is better, but to which extent? No optimization is made for scenario 1?
Note: I'm aware of the fact that both Scenario 1 and 2 can be better written sorting the operations per program, but I'm interested in the otherwise case